Remove crt warnings - #696
Merged
Merged
Conversation
_CRT_SECURE_NO_DEPRECATE, _CRT_SECURE_NO_WARNINGS, _SCL_SECURE_NO_WARNINGS and _CRT_NON_CONFORMING_SWPRINTFS all do one thing: hide the deprecation attributes the CRT headers put on strcpy, sprintf, swprintf and friends. That warning is C4996 for cl and -Wdeprecated-declarations for clang-cl, and cmake/Warnings.cmake already suppresses both by name, per compiler, with a count next to it. Two mechanisms for one warning, one of them invisible to anyone reading the warning list. _CRT_NON_CONFORMING_SWPRINTFS is the only one that could have done more, and it does not: its macro redirect to the argument-count-free swprintf is guarded by !defined __cplusplus (corecrt_wstdio.h), so in C++ the traditional overloads are declared either way and only the deprecation text changes. No codegen change. Recompiling sgp/video.cpp with and without the four defines gives objects that differ in .debug$T alone, by the 128 bytes of the recorded compiler command line; every other section is byte-identical. All four applications build clean under clang-cl /W3 /WX. The counts in cmake/Warnings.cmake for /wd4996 and -Wno-deprecated-declarations were harvested with these defines in place, so both now understate the real number. They are stale figures, not wrong suppressions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_CRT_SECURE_NO_DEPRECATE, _CRT_SECURE_NO_WARNINGS, _SCL_SECURE_NO_WARNINGS and _CRT_NON_CONFORMING_SWPRINTFS all do one thing: hide the deprecation attributes the CRT headers put on strcpy, sprintf, swprintf and friends. That warning is C4996 for cl and -Wdeprecated-declarations for clang-cl, and cmake/Warnings.cmake already suppresses both by name, per compiler, with a count next to it. Two mechanisms for one warning, one of them invisible to anyone reading the warning list.
_CRT_NON_CONFORMING_SWPRINTFS is the only one that could have done more, and it does not: its macro redirect to the argument-count-free swprintf is guarded by !defined __cplusplus (corecrt_wstdio.h), so in C++ the traditional overloads are declared either way and only the deprecation text changes.
No codegen change. Recompiling sgp/video.cpp with and without the four defines gives objects that differ in .debug$T alone, by the 128 bytes of the recorded compiler command line; every other section is byte-identical. All four applications build clean under clang-cl /W3 /WX.
The counts in cmake/Warnings.cmake for /wd4996 and -Wno-deprecated-declarations were harvested with these defines in place, so both now understate the real number. They are stale figures, not wrong suppressions.