Skip to content

Remove crt warnings - #696

Merged
majcosta merged 1 commit into
1dot13:masterfrom
majcosta:remove_crt_warnings
Aug 22, 2026
Merged

Remove crt warnings#696
majcosta merged 1 commit into
1dot13:masterfrom
majcosta:remove_crt_warnings

Conversation

@majcosta

Copy link
Copy Markdown
Collaborator

_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.

_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>
@majcosta
majcosta merged commit 98c1e6a into 1dot13:master Aug 22, 2026
6 checks passed
@majcosta
majcosta deleted the remove_crt_warnings branch August 22, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant