aboutsummaryrefslogtreecommitdiff
path: root/libcpp/macro.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2014-08-29 15:28:45 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2014-08-29 15:28:45 +0000
commitb753b37bd6a43a9d1cc2433f57a091c213380147 (patch)
treebcdc43baa9947832913a10b03e07131bc343844b /libcpp/macro.c
parentef0981b8aea59164340d4d57b4e48b6810cc41fb (diff)
downloadgcc-b753b37bd6a43a9d1cc2433f57a091c213380147.zip
gcc-b753b37bd6a43a9d1cc2433f57a091c213380147.tar.gz
gcc-b753b37bd6a43a9d1cc2433f57a091c213380147.tar.bz2
macro.c (warn_of_redefinition): Suppress warnings for builtins that lack the NODE_WARN flag...
libcpp/ChangeLog: 2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org> * macro.c (warn_of_redefinition): Suppress warnings for builtins that lack the NODE_WARN flag, unless Wbuiltin-macro-redefined. (_cpp_create_definition): Use Wbuiltin-macro-redefined for builtins that lack the NODE_WARN flag. * directives.c (do_undef): Likewise. * init.c (cpp_init_special_builtins): Do not change flags depending on Wbuiltin-macro-redefined. gcc/c-family/ChangeLog: 2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org> * c.opt (Wbuiltin-macro-redefined): Use CPP, Var and Init. * c-opts.c (c_common_handle_option): Do not handle here. From-SVN: r214730
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r--libcpp/macro.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c
index a1ba137..8445ce3 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -2699,13 +2699,12 @@ warn_of_redefinition (cpp_reader *pfile, 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)
- {
- if (!pfile->cb.user_builtin_macro
- || !pfile->cb.user_builtin_macro (pfile, node))
- return false;
- }
+ /* Suppress warnings for builtins that lack the NODE_WARN flag,
+ unless Wbuiltin-macro-redefined. */
+ if (node->flags & NODE_BUILTIN
+ && (!pfile->cb.user_builtin_macro
+ || !pfile->cb.user_builtin_macro (pfile, node)))
+ return CPP_OPTION (pfile, warn_builtin_macro_redefined);
/* Redefinitions of conditional (context-sensitive) macros, on
the other hand, must be allowed silently. */
@@ -3181,14 +3180,14 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
if (warn_of_redefinition (pfile, node, macro))
{
- const int reason = (node->flags & NODE_BUILTIN)
+ const int reason = ((node->flags & NODE_BUILTIN)
+ && !(node->flags & NODE_WARN))
? CPP_W_BUILTIN_MACRO_REDEFINED : CPP_W_NONE;
- bool warned;
- warned = cpp_pedwarning_with_line (pfile, reason,
- pfile->directive_line, 0,
- "\"%s\" redefined",
- NODE_NAME (node));
+ bool warned =
+ cpp_pedwarning_with_line (pfile, reason,
+ pfile->directive_line, 0,
+ "\"%s\" redefined", NODE_NAME (node));
if (warned && node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
cpp_error_with_line (pfile, CPP_DL_NOTE,