diff options
author | simonb <simonb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-18 15:39:08 +0000 |
---|---|---|
committer | simonb <simonb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-18 15:39:08 +0000 |
commit | 2ad0b097c1c8904b22684e42942913dd6fbf6308 (patch) | |
tree | e6725c527874d936bd2e164a6a7f885ebaffaf47 /libcpp/macro.c | |
parent | 9a7beb5fca4286c28b28d14fae2fa9584a2bf07b (diff) | |
download | gcc-2ad0b097c1c8904b22684e42942913dd6fbf6308.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140461 138bc75d-0d04-0410-961f-82ee72b054a4
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 9a470ef460b..8122648ea39 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) |