diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-25 09:43:03 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-25 09:43:03 +0000 |
commit | 31ca26b1948f1df0f16f83053aea78680fea0965 (patch) | |
tree | 9b8fa1374187361bdd59562c00a312f85f75d707 /gcc/cppinit.c | |
parent | 5f55356392b4ab0c6f31ddb9b8b4aecb21aa86fc (diff) | |
download | gcc-31ca26b1948f1df0f16f83053aea78680fea0965.tar.gz |
* cppinit.c (builtin_array): Update.
(init_builtins): Flag builtins to warn if redefined or
undefined. Define __GXX_WEAK as a normal macro.
* cpplib.c (do_undef): Warn if flagged NODE_WARN.
* cpplib.h (NODE_WARN): New flag.
* cppmacro.c (builtin_macro): Remove handling of __GXX_WEAK__.
Handle __STDC__ as a builtin only on Solaris.
(warn_of_redefinition): Renamed from check_macro_definition.
Reverse sense of test. Always warn if NODE_WARN.
(_cpp_create_definition): Use warn_of_redefinition. Flag
any macro beginning with "__STDC_" to require a mandatory
warning if redefined or undefined.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40053 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r-- | gcc/cppinit.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 22ce18df1e3..d8efb4b559c 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -607,7 +607,9 @@ cpp_destroy (pfile) /* This structure defines one built-in identifier. A node will be entered in the hash table under the name NAME, with value VALUE (if any). If flags has OPERATOR, the node's operator field is used; if - flags has BUILTIN the node's builtin field is used. + flags has BUILTIN the node's builtin field is used. Macros that are + known at build time should not be flagged BUILTIN, as then they do + not appear in macro dumps with e.g. -dM or -dD. Two values are not compile time constants, so we tag them in the FLAGS field instead: @@ -632,7 +634,6 @@ struct builtin #define OPERATOR 0x10 #define B(n, t) { U n, 0, t, 0, BUILTIN, sizeof n - 1 } -#define BC(n, t) { U n, 0, t, 0, BUILTIN | CPLUS, sizeof n - 1 } #define C(n, v) { U n, v, 0, 0, 0, sizeof n - 1 } #define X(n, f) { U n, 0, 0, 0, f, sizeof n - 1 } #define O(n, c, f) { U n, 0, 0, c, OPERATOR | f, sizeof n - 1 } @@ -644,8 +645,6 @@ static const struct builtin builtin_array[] = B("__BASE_FILE__", BT_BASE_FILE), B("__LINE__", BT_SPECLINE), B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL), - B("__STDC__", BT_STDC), - BC("__GXX_WEAK__", BT_WEAK), X("__VERSION__", VERS), X("__USER_LABEL_PREFIX__", ULP), @@ -663,6 +662,11 @@ static const struct builtin builtin_array[] = #ifndef NO_BUILTIN_WINT_TYPE C("__WINT_TYPE__", WINT_TYPE), #endif +#ifdef STDC_0_IN_SYSTEM_HEADERS + B("__STDC__", BT_STDC), +#else + C("__STDC__", "1"), +#endif /* Named operators known to the preprocessor. These cannot be #defined and always have their stated meaning. They are treated like normal @@ -714,7 +718,7 @@ init_builtins (pfile) else { hp->type = NT_MACRO; - hp->flags |= NODE_BUILTIN; + hp->flags |= NODE_BUILTIN | NODE_WARN; hp->value.builtin = b->builtin; } } @@ -746,7 +750,13 @@ init_builtins (pfile) } if (CPP_OPTION (pfile, cplusplus)) - _cpp_define_builtin (pfile, "__cplusplus 1"); + { + _cpp_define_builtin (pfile, "__cplusplus 1"); + if (SUPPORTS_ONE_ONLY) + _cpp_define_builtin (pfile, "__GXX_WEAK__ 1"); + else + _cpp_define_builtin (pfile, "__GXX_WEAK__ 0"); + } if (CPP_OPTION (pfile, objc)) _cpp_define_builtin (pfile, "__OBJC__ 1"); |