diff options
author | Simon Baldwin <simonb@google.com> | 2008-09-18 15:39:08 +0000 |
---|---|---|
committer | Simon Baldwin <simonb@gcc.gnu.org> | 2008-09-18 15:39:08 +0000 |
commit | c047ce93830ab288948c3e225fc8c5efdfbe3c2a (patch) | |
tree | e6725c527874d936bd2e164a6a7f885ebaffaf47 /libcpp/macro.c | |
parent | 1d295886287812ee7e5b5bfc63ff598a2a9e9958 (diff) | |
download | gcc-c047ce93830ab288948c3e225fc8c5efdfbe3c2a.zip gcc-c047ce93830ab288948c3e225fc8c5efdfbe3c2a.tar.gz gcc-c047ce93830ab288948c3e225fc8c5efdfbe3c2a.tar.bz2 |
cpplib.h (struct cpp_options): Add new boolean flag warn_builtin_macro_redefined.
* include/cpplib.h (struct cpp_options): Add new boolean flag
warn_builtin_macro_redefined.
* init.c (cpp_create_reader): Initialize warn_builtin_macro_redefined.
* (struct builtin_operator): Split out from previous struct builtin,
enhance extra const correctness.
* (struct builtin_macro): Split out from previous struct builtin, add
new always_warn_if_redefined flag, enhance const correctness.
* (mark_named_operators): Use struct builtin_operator.
* (cpp_init_special_builtins): Use struct builtin_macro, add NODE_WARN
to builtins selectively.
* macro.c (warn_of_redefinition): Return false if a builtin macro
is not flagged with NODE_WARN.
* c-opts.c (c_common_handle_option): Add handling for
-Wbuiltin-macro-redefined command line option.
* c.opt: Added builtin-macro-redefined option.
* doc/invoke.texi (Warning Options): Add -Wbuiltin-macro-redefined
documentation.
* gcc.dg/builtin-redefine.c: New.
From-SVN: r140461
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r-- | libcpp/macro.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c index 9a470ef..8122648 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -1392,6 +1392,10 @@ warn_of_redefinition (cpp_reader *pfile, const cpp_hashnode *node, if (node->flags & NODE_WARN) return true; + /* Suppress warnings for builtins that lack the NODE_WARN flag. */ + if (node->flags & NODE_BUILTIN) + return false; + /* Redefinitions of conditional (context-sensitive) macros, on the other hand, must be allowed silently. */ if (node->flags & NODE_CONDITIONAL) |