Enable more test coverage for warning C4668 ('MEOW' is not defined as a preprocessor macro)#4441
Merged
StephanTLavavej merged 6 commits intomicrosoft:mainfrom Mar 8, 2024
Merged
Conversation
…ed as a preprocessor macro, replacing with `'0'` for `'#if/#elif'`.
OS-23694920 "Windows SDK uses undefined `_WIN32_WINNT_*` version macros (which may subtly break code)"
These occurrences were inconsistent.
This is a behavioral change/enhancement (the code was previously inactive). Fixes: warning C4668: '__STDC_VERSION__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
VSO-1985428 "`<limits.h>` emits warning C4668: `'__STDC_WANT_SECURE_LIB__'` is not defined as a preprocessor macro, replacing with `'0'` for `'#if/#elif'`"
Member
Author
|
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
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.
Warning C4668 is off-by-default, but quite useful because (1) we conventionally never want to rely on the Standard's behavior of expanding not-defined macros to
0, and (2) it can detect typos. We already have some test coverage for it:STL/stl/inc/__msvc_all_public_headers.hpp
Line 13 in 8b081e2
However, we haven't applied this warning to our entire test suite, so I've had to catch other PRs unintentionally expanding not-defined macros.
stdandtr1, enable warning C4668'MEOW'is not defined as a preprocessor macro, replacing with'0'for'#if/#elif'.libcxxbecause it doesn't follow our convention.<Windows.h>._WIN32_WINNT_*version macros (which may subtly break code)".<Windows.h>.#if WIDE=>#ifdef WIDEtr1/include/tdefs.h.'__STDC_VERSION__'is not defined as a preprocessor macro, replacing with'0'for'#if/#elif'".tr1, but this looks like a straightforward improvement, and it only takes effect when the "approximately equal" test is already going to fail.<limits.h>.<limits.h>emits warning C4668:'__STDC_WANT_SECURE_LIB__'is not defined as a preprocessor macro, replacing with'0'for'#if/#elif'".