gcc/c

        * c-decl.c (define_label, shadow_tag_warned)
        (check_bitfield_type_and_width, grokdeclarator, grokparms,
        store_parm_decls_newstyle, store_parm_decls_oldstyle)
        (declspecs_add_type): Remove use of in_system_header macro.
        * c-parser.c (c_parser_unary_expression): Likewise.
        * c-typeck.c (store_init_value, process_init_element)
        (c_start_case): Likewise.

        * c-decl.c (build_enumerator): Remove use of EXPR_LOC_OR_HERE
        macro.

        * c-parser.c (c_parser_set_source_position_from_token): Remove
        reference to in_system_header from comment.
---
 gcc/c/c-decl.c   | 49 +++++++++++++++++++++++++++++--------------------
 gcc/c/c-parser.c |  5 ++---
 gcc/c/c-typeck.c |  6 +++---
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 4125bd9..1d4f1af 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -3328,7 +3328,7 @@ define_label (location_t location, tree name)
       bind_label (name, label, current_function_scope, label_vars);
     }
 
-  if (!in_system_header && lookup_name (name))
+  if (!in_system_header_at (input_location) && lookup_name (name))
     warning_at (location, OPT_Wtraditional,
                "traditional C lacks a separate namespace "
                "for labels, identifier %qE conflicts", name);
@@ -3762,7 +3762,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, 
int warned)
        }
       else
        {
-         if (warned != 1 && !in_system_header)
+         if (warned != 1 && !in_system_header_at (input_location))
            {
              pedwarn (input_location, 0,
                       "useless type name in empty declaration");
@@ -3770,7 +3770,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, 
int warned)
            }
        }
     }
-  else if (warned != 1 && !in_system_header && declspecs->typedef_p)
+  else if (warned != 1 && !in_system_header_at (input_location)
+          && declspecs->typedef_p)
     {
       pedwarn (input_location, 0, "useless type name in empty declaration");
       warned = 1;
@@ -3802,30 +3803,34 @@ shadow_tag_warned (const struct c_declspecs *declspecs, 
int warned)
       warned = 1;
     }
 
-  if (!warned && !in_system_header && declspecs->storage_class != csc_none)
+  if (!warned && !in_system_header_at (input_location)
+      && declspecs->storage_class != csc_none)
     {
       warning (0, "useless storage class specifier in empty declaration");
       warned = 2;
     }
 
-  if (!warned && !in_system_header && declspecs->thread_p)
+  if (!warned && !in_system_header_at (input_location) && declspecs->thread_p)
     {
       warning (0, "useless %qs in empty declaration",
               declspecs->thread_gnu_p ? "__thread" : "_Thread_local");
       warned = 2;
     }
 
-  if (!warned && !in_system_header && (declspecs->const_p
-                                      || declspecs->volatile_p
-                                      || declspecs->atomic_p
-                                      || declspecs->restrict_p
-                                      || declspecs->address_space))
+  if (!warned
+      && !in_system_header_at (input_location)
+      && (declspecs->const_p
+         || declspecs->volatile_p
+         || declspecs->atomic_p
+         || declspecs->restrict_p
+         || declspecs->address_space))
     {
       warning (0, "useless type qualifier in empty declaration");
       warned = 2;
     }
 
-  if (!warned && !in_system_header && declspecs->alignas_p)
+  if (!warned && !in_system_header_at (input_location)
+      && declspecs->alignas_p)
     {
       warning (0, "useless %<_Alignas%> in empty declaration");
       warned = 2;
@@ -4821,7 +4826,7 @@ check_bitfield_type_and_width (tree *type, tree *width, 
tree orig_name)
     }
 
   type_mv = TYPE_MAIN_VARIANT (*type);
-  if (!in_system_header
+  if (!in_system_header_at (input_location)
       && type_mv != integer_type_node
       && type_mv != unsigned_type_node
       && type_mv != boolean_type_node)
@@ -5071,7 +5076,7 @@ grokdeclarator (const struct c_declarator *declarator,
 
   /* Diagnose defaulting to "int".  */
 
-  if (declspecs->default_int_p && !in_system_header)
+  if (declspecs->default_int_p && !in_system_header_at (input_location))
     {
       /* Issue a warning if this is an ISO C 99 program or if
         -Wreturn-type and this is a function, or if -Wimplicit;
@@ -5351,7 +5356,8 @@ grokdeclarator (const struct c_declarator *declarator,
                type = error_mark_node;
              }
 
-           if (pedantic && !in_system_header && flexible_array_type_p (type))
+           if (pedantic && !in_system_header_at (input_location)
+               && flexible_array_type_p (type))
              pedwarn (loc, OPT_Wpedantic,
                       "invalid use of structure with flexible array member");
 
@@ -5529,7 +5535,8 @@ grokdeclarator (const struct c_declarator *declarator,
                    flexible_array_member = (t->kind == cdk_id);
                  }
                if (flexible_array_member
-                   && pedantic && !flag_isoc99 && !in_system_header)
+                   && pedantic && !flag_isoc99
+                   && !in_system_header_at (input_location))
                  pedwarn (loc, OPT_Wpedantic,
                           "ISO C90 does not support flexible array members");
 
@@ -6383,7 +6390,8 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
       error ("%<[*]%> not allowed in other than function prototype scope");
     }
 
-  if (arg_types == 0 && !funcdef_flag && !in_system_header)
+  if (arg_types == 0 && !funcdef_flag
+      && !in_system_header_at (input_location))
     warning (OPT_Wstrict_prototypes,
             "function declaration isn%'t a prototype");
 
@@ -7782,7 +7790,7 @@ build_enumerator (location_t decl_loc, location_t loc,
 
   /* Set basis for default for next value.  */
   the_enum->enum_next_value
-    = build_binary_op (EXPR_LOC_OR_HERE (value),
+    = build_binary_op (EXPR_LOC_OR_LOC (value, input_location),
                       PLUS_EXPR, value, integer_one_node, 0);
   the_enum->enum_overflow = tree_int_cst_lt (the_enum->enum_next_value, value);
 
@@ -8056,7 +8064,8 @@ store_parm_decls_newstyle (tree fndecl, const struct 
c_arg_info *arg_info)
      warning if we got here because ARG_INFO_TYPES was error_mark_node
      (this happens when a function definition has just an ellipsis in
      its parameter list).  */
-  else if (!in_system_header && !current_function_scope
+  else if (!in_system_header_at (input_location)
+          && !current_function_scope
           && arg_info->types != error_mark_node)
     warning_at (DECL_SOURCE_LOCATION (fndecl), OPT_Wtraditional,
                "traditional C rejects ISO C style function definitions");
@@ -8110,7 +8119,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct 
c_arg_info *arg_info)
   tree parmids = arg_info->parms;
   struct pointer_set_t *seen_args = pointer_set_create ();
 
-  if (!in_system_header)
+  if (!in_system_header_at (input_location))
     warning_at (DECL_SOURCE_LOCATION (fndecl),
                OPT_Wold_style_definition, "old-style function definition");
 
@@ -9468,7 +9477,7 @@ declspecs_add_type (location_t loc, struct c_declspecs 
*specs,
                  error_at (loc, "%<__int128%> is not supported for this 
target");
                  return specs;
                }
-             if (!in_system_header)
+             if (!in_system_header_at (input_location))
                pedwarn (loc, OPT_Wpedantic,
                         "ISO C does not support %<__int128%> type");
 
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index ea3aa9a..1e3689f 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -775,8 +775,7 @@ c_parser_consume_pragma (c_parser *parser)
   parser->in_pragma = true;
 }
 
-/* Update the globals input_location and in_system_header from
-   TOKEN.  */
+/* Update the global input_location from TOKEN.  */
 static inline void
 c_parser_set_source_position_from_token (c_token *token)
 {
@@ -6301,7 +6300,7 @@ c_parser_unary_expression (c_parser *parser)
       ret.value = build_indirect_ref (op_loc, op.value, RO_UNARY_STAR);
       return ret;
     case CPP_PLUS:
-      if (!c_dialect_objc () && !in_system_header)
+      if (!c_dialect_objc () && !in_system_header_at (input_location))
        warning_at (op_loc,
                    OPT_Wtraditional,
                    "traditional C rejects the unary plus operator");
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 8e74b7b..1ae75fb 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -6185,7 +6185,7 @@ store_init_value (location_t init_loc, tree decl, tree 
init, tree origtype)
 
   /* Store the expression if valid; else report error.  */
 
-  if (!in_system_header
+  if (!in_system_header_at (input_location)
       && AGGREGATE_TYPE_P (TREE_TYPE (decl)) && !TREE_STATIC (decl))
     warning (OPT_Wtraditional, "traditional C rejects automatic "
             "aggregate initialization");
@@ -8686,7 +8686,7 @@ process_init_element (struct c_expr value, bool implicit,
             again on the assumption that this must be conditional on
             __STDC__ anyway (and we've already complained about the
             member-designator already).  */
-         if (!in_system_header && !constructor_designated
+         if (!in_system_header_at (input_location) && !constructor_designated
              && !(value.value && (integer_zerop (value.value)
                                   || real_zerop (value.value))))
            warning (OPT_Wtraditional, "traditional C rejects initialization "
@@ -9287,7 +9287,7 @@ c_start_case (location_t switch_loc,
        {
          tree type = TYPE_MAIN_VARIANT (orig_type);
 
-         if (!in_system_header
+         if (!in_system_header_at (input_location)
              && (type == long_integer_type_node
                  || type == long_unsigned_type_node))
            warning_at (switch_cond_loc,
-- 
1.7.11.7

Reply via email to