在 2025-02-20 18:06, Seth McDonald via Mingw-w64-public 写道:
Warnings are only disabled if both _CRT_SECURE_NO_WARNINGS is defined and _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES is not 0. The _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES macro (when defined as 1) allows for MSVC-considered unsafe functions to be overloaded with the secure versions of those functions [1]. So it does make some sense to emit warnings when the user hasn't enabled this feature.However, this feature can only be used in C++, since C doesn't allow for function overloading. As such, when using C, _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES will always be either 0 or undefined (which preprocessor expressions evaluate to 0). This makes it impossible to disable warnings for specifically MSVC-considered unsafe functions when compiling for C. This bug can likely be fixed by only considering _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES if __cplusplus is defined (i.e. if compiling for C++ rather than C), by just not considering _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES at all, or something similar.
I suspect all code relevant to `_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES` can be removed. In our headers, `__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_*` macros are defined but unused. Consequentially, defining `_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES` to 1 does not enable secure functions.
-- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public