diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-10-15 11:05:51 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-10-15 11:05:51 -0700 |
commit | 7c89f2fada9a852d3d358fac99e162738a0e78a4 (patch) | |
tree | 2ca074ffeb2d917a9eea17b7671f2cb2fcff8c50 /pcap/compiler-tests.h | |
parent | 26576666d6318258363ba27d5abdbbb88b1e56ac (diff) |
Indicate why we're not using defined() in macros.
Diffstat (limited to 'pcap/compiler-tests.h')
-rw-r--r-- | pcap/compiler-tests.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pcap/compiler-tests.h b/pcap/compiler-tests.h index 552941ca..8876c67c 100644 --- a/pcap/compiler-tests.h +++ b/pcap/compiler-tests.h @@ -55,6 +55,26 @@ #endif /* + * Note that the C90 spec's "6.8.1 Conditional inclusion" and the + * C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say: + * + * Prior to evaluation, macro invocations in the list of preprocessing + * tokens that will become the controlling constant expression are + * replaced (except for those macro names modified by the defined unary + * operator), just as in normal text. If the token "defined" is + * generated as a result of this replacement process or use of the + * "defined" unary operator does not match one of the two specified + * forms prior to macro replacement, the behavior is undefined. + * + * so you shouldn't use defined() in a #define that's used in #if or + * #elif. Some versions of Clang, for example, will warn about this. + * + * Instead, we check whether the pre-defined macros for particular + * compilers are defined and, if not, define the "is this version XXX + * or a later version of this compiler" macros as 0. + */ + +/* * Check whether this is GCC major.minor or a later release, or some * compiler that claims to be "just like GCC" of that version or a * later release. |