OSDN Git Service

* ChangeLog: Wix wrong PR number in my previous commit.
[pf3gnuchains/gcc-fork.git] / gcc / c-decl.c
index bdb6819..6f88f62 100644 (file)
@@ -788,7 +788,7 @@ pop_scope (void)
                   && TREE_PUBLIC (p)
                   && !DECL_INITIAL (p)
                   && !flag_gnu89_inline)
-           pedwarn (0, "inline function %q+D declared but never defined", p);
+           pedwarn (input_location, 0, "inline function %q+D declared but never defined", p);
 
          goto common_symbol;
 
@@ -1029,14 +1029,14 @@ diagnose_arglist_conflict (tree newdecl, tree olddecl,
       if (TREE_CHAIN (t) == 0
          && TYPE_MAIN_VARIANT (type) != void_type_node)
        {
-         inform ("a parameter list with an ellipsis can%'t match "
+         inform (input_location, "a parameter list with an ellipsis can%'t match "
                  "an empty parameter name list declaration");
          break;
        }
 
       if (c_type_promotes_to (type) != type)
        {
-         inform ("an argument type that has a default promotion can%'t match "
+         inform (input_location, "an argument type that has a default promotion can%'t match "
                  "an empty parameter name list declaration");
          break;
        }
@@ -1115,16 +1115,16 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
    first in a pair of mismatched declarations, using the diagnostic
    function DIAG.  */
 static void
-locate_old_decl (tree decl, void (*diag)(const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2))
+locate_old_decl (tree decl)
 {
   if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
     ;
   else if (DECL_INITIAL (decl))
-    diag (G_("previous definition of %q+D was here"), decl);
+    inform (input_location, "previous definition of %q+D was here", decl);
   else if (C_DECL_IMPLICIT (decl))
-    diag (G_("previous implicit declaration of %q+D was here"), decl);
+    inform (input_location, "previous implicit declaration of %q+D was here", decl);
   else
-    diag (G_("previous declaration of %q+D was here"), decl);
+    inform (input_location, "previous declaration of %q+D was here", decl);
 }
 
 /* Subroutine of duplicate_decls.  Compare NEWDECL to OLDDECL.
@@ -1165,7 +1165,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
            && !C_DECL_DECLARED_BUILTIN (olddecl)))
        {
          error ("%q+D redeclared as different kind of symbol", newdecl);
-         locate_old_decl (olddecl, error);
+         locate_old_decl (olddecl);
        }
       else if (TREE_PUBLIC (newdecl))
        warning (0, "built-in function %q+D declared as non-function",
@@ -1181,7 +1181,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
   if (TREE_CODE (olddecl) == CONST_DECL)
     {
       error ("redeclaration of enumerator %q+D", newdecl);
-      locate_old_decl (olddecl, error);
+      locate_old_decl (olddecl);
       return false;
     }
 
@@ -1225,11 +1225,11 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
               && TYPE_MAIN_VARIANT (TREE_TYPE (newtype)) == integer_type_node
               && C_FUNCTION_IMPLICIT_INT (newdecl) && !DECL_INITIAL (olddecl))
        {
-         pedwarn (0, "conflicting types for %q+D", newdecl);
+         pedwarned = pedwarn (input_location, 0,
+                              "conflicting types for %q+D", newdecl);
          /* Make sure we keep void as the return type.  */
          TREE_TYPE (newdecl) = *newtypep = newtype = oldtype;
          C_FUNCTION_IMPLICIT_INT (newdecl) = 0;
-         pedwarned = true;
        }
       /* Permit void foo (...) to match an earlier call to foo (...) with
         no declared type (thus, implicitly int).  */
@@ -1238,10 +1238,10 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
               && TYPE_MAIN_VARIANT (TREE_TYPE (oldtype)) == integer_type_node
               && C_DECL_IMPLICIT (olddecl) && !DECL_INITIAL (olddecl))
        {
-         pedwarn (0, "conflicting types for %q+D", newdecl);
+         pedwarned = pedwarn (input_location, 0,
+                              "conflicting types for %q+D", newdecl);
          /* Make sure we keep void as the return type.  */
          TREE_TYPE (olddecl) = *oldtypep = oldtype = newtype;
-         pedwarned = true;
        }
       else
        {
@@ -1250,7 +1250,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
          else
            error ("conflicting types for %q+D", newdecl);
          diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype);
-         locate_old_decl (olddecl, error);
+         locate_old_decl (olddecl);
          return false;
        }
     }
@@ -1267,7 +1267,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
        return true;  /* Allow OLDDECL to continue in use.  */
 
       error ("redefinition of typedef %q+D", newdecl);
-      locate_old_decl (olddecl, error);
+      locate_old_decl (olddecl);
       return false;
     }
 
@@ -1318,7 +1318,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
                  && same_translation_unit_p (newdecl, olddecl))
                {
                  error ("redefinition of %q+D", newdecl);
-                 locate_old_decl (olddecl, error);
+                 locate_old_decl (olddecl);
                  return false;
                }
            }
@@ -1330,7 +1330,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
               && TYPE_ACTUAL_ARG_TYPES (oldtype)
               && !validate_proto_after_old_defn (newdecl, newtype, oldtype))
        {
-         locate_old_decl (olddecl, error);
+         locate_old_decl (olddecl);
          return false;
        }
       /* A non-static declaration (even an "extern") followed by a
@@ -1354,7 +1354,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
            {
              error ("static declaration of %q+D follows "
                     "non-static declaration", newdecl);
-             locate_old_decl (olddecl, error);
+             locate_old_decl (olddecl);
            }
          return false;
        }
@@ -1364,14 +1364,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
            {
              error ("non-static declaration of %q+D follows "
                     "static declaration", newdecl);
-             locate_old_decl (olddecl, error);
+             locate_old_decl (olddecl);
              return false;
            }
          else if (warn_traditional)
            {
-             warning (OPT_Wtraditional, "non-static declaration of %q+D "
-                      "follows static declaration", newdecl);
-             warned = true;
+             warned |= warning (OPT_Wtraditional, 
+                                "non-static declaration of %q+D "
+                                "follows static declaration", newdecl);
            }
        }
 
@@ -1412,7 +1412,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
            error ("non-thread-local declaration of %q+D follows "
                   "thread-local declaration", newdecl);
 
-         locate_old_decl (olddecl, error);
+         locate_old_decl (olddecl);
          return false;
        }
 
@@ -1420,7 +1420,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
       if (DECL_INITIAL (newdecl) && DECL_INITIAL (olddecl))
        {
          error ("redefinition of %q+D", newdecl);
-         locate_old_decl (olddecl, error);
+         locate_old_decl (olddecl);
          return false;
        }
 
@@ -1441,14 +1441,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
                {
                  error ("extern declaration of %q+D follows "
                         "declaration with no linkage", newdecl);
-                 locate_old_decl (olddecl, error);
+                 locate_old_decl (olddecl);
                  return false;
                }
              else if (warn_traditional)
                {
-                 warning (OPT_Wtraditional, "non-static declaration of %q+D "
-                          "follows static declaration", newdecl);
-                 warned = true;
+                 warned |= warning (OPT_Wtraditional, 
+                                    "non-static declaration of %q+D "
+                                    "follows static declaration", newdecl);
                }
            }
          else
@@ -1460,7 +1460,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
                error ("static declaration of %q+D follows "
                       "non-static declaration", newdecl);
 
-             locate_old_decl (olddecl, error);
+             locate_old_decl (olddecl);
              return false;
            }
        }
@@ -1477,12 +1477,12 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
            {
              error ("declaration of %q+D with no linkage follows "
                     "extern declaration", newdecl);
-             locate_old_decl (olddecl, error);
+             locate_old_decl (olddecl);
            }
          else
            {
              error ("redeclaration of %q+D with no linkage", newdecl);
-             locate_old_decl (olddecl, error);
+             locate_old_decl (olddecl);
            }
 
          return false;
@@ -1495,9 +1495,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
       && DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY_SPECIFIED (olddecl)
       && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
     {
-      warning (0, "redeclaration of %q+D with different visibility "
-              "(old visibility preserved)", newdecl);
-      warned = true;
+      warned |= warning (0, "redeclaration of %q+D with different visibility "
+                        "(old visibility preserved)", newdecl);
     }
 
   if (TREE_CODE (newdecl) == FUNCTION_DECL)
@@ -1506,16 +1505,16 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
       if (DECL_DECLARED_INLINE_P (newdecl)
          && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
        {
-         warning (OPT_Wattributes, "inline declaration of %qD follows "
-                  "declaration with attribute noinline", newdecl);
-         warned = true;
+         warned |= warning (OPT_Wattributes, 
+                            "inline declaration of %qD follows "
+                            "declaration with attribute noinline", newdecl);
        }
       else if (DECL_DECLARED_INLINE_P (olddecl)
               && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
        {
-         warning (OPT_Wattributes, "declaration of %q+D with attribute "
-                  "noinline follows inline declaration ", newdecl);
-         warned = true;
+         warned |= warning (OPT_Wattributes, 
+                            "declaration of %q+D with attribute "
+                            "noinline follows inline declaration ", newdecl);
        }
     }
   else /* PARM_DECL, VAR_DECL */
@@ -1533,7 +1532,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
          && (!TREE_ASM_WRITTEN (olddecl) || TREE_ASM_WRITTEN (newdecl)))
        {
          error ("redefinition of parameter %q+D", newdecl);
-         locate_old_decl (olddecl, error);
+         locate_old_decl (olddecl);
          return false;
        }
     }
@@ -1559,14 +1558,13 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
       && !(TREE_CODE (newdecl) == VAR_DECL
           && DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl)))
     {
-      warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
-              newdecl);
-      warned = true;
+      warned = warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
+                       newdecl);
     }
 
-  /* Report location of previous decl/defn in a consistent manner.  */
+  /* Report location of previous decl/defn.  */
   if (warned || pedwarned)
-    locate_old_decl (olddecl, pedwarned ? pedwarn0 : warning0);
+    locate_old_decl (olddecl);
 
 #undef DECL_EXTERN_INLINE
 
@@ -1777,18 +1775,8 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
         throw it away, in case it was inlined into a function that
         hasn't been written out yet.  */
       if (new_is_definition && DECL_INITIAL (olddecl))
-       {
-         if (TREE_USED (olddecl)
-             /* We never inline re-defined extern inline functions.
-                FIXME: This would be better handled by keeping both functions
-                as separate declarations.  */
-             && cgraph_function_possibly_inlined_p (olddecl))
-           (*debug_hooks->outlining_inline_function) (olddecl);
-
-         /* The new defn must not be inline.  */
-         DECL_INLINE (newdecl) = 0;
-         DECL_UNINLINABLE (newdecl) = 1;
-       }
+       /* The new defn must not be inline.  */
+       DECL_UNINLINABLE (newdecl) = 1;
       else
        {
          /* If either decl says `inline', this fn is inline, unless
@@ -1841,27 +1829,21 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
          gimple_set_body (newdecl, gimple_body (olddecl));
          DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
 
-         /* Set DECL_INLINE on the declaration if we've got a body
-            from which to instantiate.  */
-         if (DECL_INLINE (olddecl) && !DECL_UNINLINABLE (newdecl))
-           {
-             DECL_INLINE (newdecl) = 1;
-             DECL_ABSTRACT_ORIGIN (newdecl)
-               = DECL_ABSTRACT_ORIGIN (olddecl);
-           }
-       }
-      else
-       {
-         /* If a previous declaration said inline, mark the
-            definition as inlinable.  */
-         if (DECL_DECLARED_INLINE_P (newdecl)
-             && !DECL_UNINLINABLE (newdecl))
-           DECL_INLINE (newdecl) = 1;
+         /* See if we've got a function to instantiate from.  */
+         if (DECL_SAVED_TREE (olddecl))
+           DECL_ABSTRACT_ORIGIN (newdecl)
+             = DECL_ABSTRACT_ORIGIN (olddecl);
        }
     }
 
    extern_changed = DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl);
 
+   /* Merge the USED information.  */
+   if (TREE_USED (olddecl))
+     TREE_USED (newdecl) = 1;
+   else if (TREE_USED (newdecl))
+     TREE_USED (olddecl) = 1;
+
   /* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
      But preserve OLDDECL's DECL_UID and DECL_CONTEXT.  */
   {
@@ -2337,14 +2319,16 @@ implicit_decl_warning (tree id, tree olddecl)
 {
   if (warn_implicit_function_declaration)
     {
+      bool warned;
+
       if (flag_isoc99)
-       pedwarn (OPT_Wimplicit_function_declaration, 
-                G_("implicit declaration of function %qE"), id);
+       warned = pedwarn (input_location, OPT_Wimplicit_function_declaration,
+                         "implicit declaration of function %qE", id);
       else 
-       warning (OPT_Wimplicit_function_declaration, 
-                G_("implicit declaration of function %qE"), id);
-      if (olddecl)
-       locate_old_decl (olddecl, inform);
+       warned = warning (OPT_Wimplicit_function_declaration, 
+                         G_("implicit declaration of function %qE"), id);
+      if (olddecl && warned)
+       locate_old_decl (olddecl);
     }
 }
 
@@ -2415,7 +2399,7 @@ implicitly_declare (tree functionid)
                {
                  error ("incompatible implicit declaration of function %qD",
                         decl);
-                 locate_old_decl (decl, error);
+                 locate_old_decl (decl);
                }
            }
          b->type = TREE_TYPE (decl);
@@ -2557,7 +2541,7 @@ declare_label (tree name)
   if (b && B_IN_CURRENT_SCOPE (b))
     {
       error ("duplicate label declaration %qE", name);
-      locate_old_decl (b->decl, error);
+      locate_old_decl (b->decl);
 
       /* Just use the previous declaration.  */
       return b->decl;
@@ -2593,7 +2577,7 @@ define_label (location_t location, tree name)
              && C_DECLARED_LABEL_FLAG (label))))
     {
       error ("%Hduplicate label %qD", &location, label);
-      locate_old_decl (label, error);
+      locate_old_decl (label);
       return 0;
     }
   else if (label && DECL_CONTEXT (label) == current_function_decl)
@@ -2850,6 +2834,31 @@ c_builtin_function (tree decl)
 
   return decl;
 }
+
+tree
+c_builtin_function_ext_scope (tree decl)
+{
+  tree type = TREE_TYPE (decl);
+  tree   id = DECL_NAME (decl);
+
+  const char *name = IDENTIFIER_POINTER (id);
+  C_DECL_BUILTIN_PROTOTYPE (decl) = (TYPE_ARG_TYPES (type) != 0);
+
+  /* Should never be called on a symbol with a preexisting meaning.  */
+  gcc_assert (!I_SYMBOL_BINDING (id));
+
+  bind (id, decl, external_scope, /*invisible=*/false, /*nested=*/false);
+
+  /* Builtins in the implementation namespace are made visible without
+     needing to be explicitly declared.  See push_file_scope.  */
+  if (name[0] == '_' && (name[1] == '_' || ISUPPER (name[1])))
+    {
+      TREE_CHAIN (decl) = visible_builtins;
+      visible_builtins = decl;
+    }
+
+  return decl;
+}
 \f
 /* Called when a declaration is seen that contains no names to declare.
    If its type is a reference to a structure, union or enum inherited
@@ -2891,7 +2900,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
              if (warned != 1 && code != ENUMERAL_TYPE)
                /* Empty unnamed enum OK */
                {
-                 pedwarn (0, "unnamed struct/union that defines no instances");
+                 pedwarn (input_location, 0,
+                          "unnamed struct/union that defines no instances");
                  warned = 1;
                }
            }
@@ -2899,8 +2909,9 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
                   && declspecs->storage_class != csc_none)
            {
              if (warned != 1)
-               pedwarn (0, "empty declaration with storage class specifier "
-                         "does not redeclare tag");
+               pedwarn (input_location, 0,
+                        "empty declaration with storage class specifier "
+                        "does not redeclare tag");
              warned = 1;
              pending_xref_error ();
            }
@@ -2910,7 +2921,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
                       || declspecs->restrict_p))
            {
              if (warned != 1)
-               pedwarn (0, "empty declaration with type qualifier "
+               pedwarn (input_location, 0,
+                        "empty declaration with type qualifier "
                          "does not redeclare tag");
              warned = 1;
              pending_xref_error ();
@@ -2931,14 +2943,15 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
        {
          if (warned != 1 && !in_system_header)
            {
-             pedwarn (0, "useless type name in empty declaration");
+             pedwarn (input_location, 0,
+                      "useless type name in empty declaration");
              warned = 1;
            }
        }
     }
   else if (warned != 1 && !in_system_header && declspecs->typedef_p)
     {
-      pedwarn (0, "useless type name in empty declaration");
+      pedwarn (input_location, 0, "useless type name in empty declaration");
       warned = 1;
     }
 
@@ -2985,7 +2998,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
   if (warned != 1)
     {
       if (!found_tag)
-       pedwarn (0, "empty declaration");
+       pedwarn (input_location, 0, "empty declaration");
     }
 }
 \f
@@ -3051,10 +3064,12 @@ build_array_declarator (tree expr, struct c_declspecs *quals, bool static_p,
   if (!flag_isoc99)
     {
       if (static_p || quals != NULL)
-       pedwarn (OPT_pedantic, "ISO C90 does not support %<static%> or type "
+       pedwarn (input_location, OPT_pedantic,
+                "ISO C90 does not support %<static%> or type "
                 "qualifiers in parameter array declarators");
       if (vla_unspec_p)
-       pedwarn (OPT_pedantic, "ISO C90 does not support %<[*]%> array declarators");
+       pedwarn (input_location, OPT_pedantic,
+                "ISO C90 does not support %<[*]%> array declarators");
     }
   if (vla_unspec_p)
     {
@@ -3162,8 +3177,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
   if (!decl)
     return 0;
 
-  if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
-      && MAIN_NAME_P (DECL_NAME (decl)))
+  if (TREE_CODE (decl) != FUNCTION_DECL && MAIN_NAME_P (DECL_NAME (decl)))
     warning (OPT_Wmain, "%q+D is usually a function", decl);
 
   if (initialized)
@@ -3310,8 +3324,9 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
       && !TREE_READONLY (decl)
       && DECL_DECLARED_INLINE_P (current_function_decl)
       && DECL_EXTERNAL (current_function_decl))
-    pedwarn (0, "%q+D is static but declared in inline function %qD "
-             "which is not static", decl, current_function_decl);
+    pedwarn (input_location, 0,
+            "%q+D is static but declared in inline function %qD "
+            "which is not static", decl, current_function_decl);
 
   /* Add this decl to the current scope.
      TEM may equal DECL or it may be a previous decl of the same name.  */
@@ -3626,7 +3641,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
          tree cleanup;
 
          /* Build "cleanup(&decl)" for the destructor.  */
-         cleanup = build_unary_op (ADDR_EXPR, decl, 0);
+         cleanup = build_unary_op (input_location, ADDR_EXPR, decl, 0);
          cleanup = build_tree_list (NULL_TREE, cleanup);
          cleanup = build_function_call (cleanup_decl, cleanup);
 
@@ -3684,7 +3699,8 @@ mark_forward_parm_decls (void)
 
   if (pedantic && !current_scope->warned_forward_parm_decls)
     {
-      pedwarn (OPT_pedantic, "ISO C forbids forward parameter declarations");
+      pedwarn (input_location, OPT_pedantic,
+              "ISO C forbids forward parameter declarations");
       current_scope->warned_forward_parm_decls = true;
     }
 
@@ -3835,7 +3851,8 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
       && type_mv != integer_type_node
       && type_mv != unsigned_type_node
       && type_mv != boolean_type_node)
-    pedwarn (OPT_pedantic, "type of bit-field %qs is a GCC extension", name);
+    pedwarn (input_location, OPT_pedantic,
+            "type of bit-field %qs is a GCC extension", name);
 
   max_width = TYPE_PRECISION (*type);
 
@@ -3852,8 +3869,8 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
     {
       struct lang_type *lt = TYPE_LANG_SPECIFIC (*type);
       if (!lt
-         || w < min_precision (lt->enum_min, TYPE_UNSIGNED (*type))
-         || w < min_precision (lt->enum_max, TYPE_UNSIGNED (*type)))
+         || w < tree_int_cst_min_precision (lt->enum_min, TYPE_UNSIGNED (*type))
+         || w < tree_int_cst_min_precision (lt->enum_max, TYPE_UNSIGNED (*type)))
        warning (0, "%qs is narrower than values of its type", name);
     }
 }
@@ -3872,20 +3889,20 @@ warn_variable_length_array (const char *name, tree size)
       if (const_size)
        {
          if (name)
-           pedwarn (OPT_Wvla, "ISO C90 forbids array %qs whose size "
+           pedwarn (input_location, OPT_Wvla, "ISO C90 forbids array %qs whose size "
                     "can%'t be evaluated",
                     name);
          else
-           pedwarn (OPT_Wvla, "ISO C90 forbids array whose size "
+           pedwarn (input_location, OPT_Wvla, "ISO C90 forbids array whose size "
                     "can%'t be evaluated");
        }
       else
        {
          if (name) 
-           pedwarn (OPT_Wvla, "ISO C90 forbids variable length array %qs",
+           pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array %qs",
                     name);
          else
-           pedwarn (OPT_Wvla, "ISO C90 forbids variable length array");
+           pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array");
        }
     }
   else if (warn_vla > 0)
@@ -4047,7 +4064,7 @@ grokdeclarator (const struct c_declarator *declarator,
          && funcdef_flag)
        warn_about_return_type = 1;
       else 
-       pedwarn_c99 (flag_isoc99 ? 0 : OPT_Wimplicit_int, 
+       pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, 
                     "type defaults to %<int%> in declaration of %qs", name);
     }
 
@@ -4076,11 +4093,11 @@ grokdeclarator (const struct c_declarator *declarator,
   if (pedantic && !flag_isoc99)
     {
       if (constp > 1)
-       pedwarn (OPT_pedantic, "duplicate %<const%>");
+       pedwarn (input_location, OPT_pedantic, "duplicate %<const%>");
       if (restrictp > 1)
-       pedwarn (OPT_pedantic, "duplicate %<restrict%>");
+       pedwarn (input_location, OPT_pedantic, "duplicate %<restrict%>");
       if (volatilep > 1)
-       pedwarn (OPT_pedantic, "duplicate %<volatile%>");
+       pedwarn (input_location, OPT_pedantic, "duplicate %<volatile%>");
     }
   if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
     type = TYPE_MAIN_VARIANT (type);
@@ -4098,7 +4115,8 @@ grokdeclarator (const struct c_declarator *declarator,
          || storage_class == csc_typedef))
     {
       if (storage_class == csc_auto)
-       pedwarn ((current_scope == file_scope) ? 0 : OPT_pedantic, 
+       pedwarn (input_location, 
+                (current_scope == file_scope) ? 0 : OPT_pedantic, 
                 "function definition declared %<auto%>");
       if (storage_class == csc_register)
        error ("function definition declared %<register%>");
@@ -4155,7 +4173,8 @@ grokdeclarator (const struct c_declarator *declarator,
       if (storage_class == csc_auto)
        error ("file-scope declaration of %qs specifies %<auto%>", name);
       if (pedantic && storage_class == csc_register)
-       pedwarn (OPT_pedantic, "file-scope declaration of %qs specifies %<register%>", name);
+       pedwarn (input_location, OPT_pedantic,
+                "file-scope declaration of %qs specifies %<register%>", name);
     }
   else
     {
@@ -4268,7 +4287,8 @@ grokdeclarator (const struct c_declarator *declarator,
              }
 
            if (pedantic && !in_system_header && flexible_array_type_p (type))
-             pedwarn (OPT_pedantic, "invalid use of structure with flexible array member");
+             pedwarn (input_location, OPT_pedantic,
+                      "invalid use of structure with flexible array member");
 
            if (size == error_mark_node)
              type = error_mark_node;
@@ -4293,7 +4313,8 @@ grokdeclarator (const struct c_declarator *declarator,
                  }
 
                if (pedantic && integer_zerop (size))
-                 pedwarn (OPT_pedantic, "ISO C forbids zero-size array %qs", name);
+                 pedwarn (input_location, OPT_pedantic,
+                          "ISO C forbids zero-size array %qs", name);
 
                if (TREE_CODE (size) == INTEGER_CST)
                  {
@@ -4365,7 +4386,8 @@ grokdeclarator (const struct c_declarator *declarator,
            else if (decl_context == FIELD)
              {
                if (pedantic && !flag_isoc99 && !in_system_header)
-                 pedwarn (OPT_pedantic, "ISO C90 does not support flexible array members");
+                 pedwarn (input_location, OPT_pedantic,
+                          "ISO C90 does not support flexible array members");
 
                /* ISO C99 Flexible array members are effectively
                   identical to GCC's zero-length array extension.  */
@@ -4510,7 +4532,8 @@ grokdeclarator (const struct c_declarator *declarator,
                   function definitions in ISO C; GCC used to used
                   them for noreturn functions.  */
                if (VOID_TYPE_P (type) && really_funcdef)
-                 pedwarn (0, "function definition has qualified void return type");
+                 pedwarn (input_location, 0,
+                          "function definition has qualified void return type");
                else
                  warning (OPT_Wignored_qualifiers,
                           "type qualifiers ignored on function return type");
@@ -4542,7 +4565,8 @@ grokdeclarator (const struct c_declarator *declarator,
 
            if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
                && type_quals)
-             pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
+             pedwarn (input_location, OPT_pedantic,
+                      "ISO C forbids qualified function types");
            if (type_quals)
              type = c_build_qualified_type (type, type_quals);
            size_varies = 0;
@@ -4623,7 +4647,8 @@ grokdeclarator (const struct c_declarator *declarator,
       tree decl;
       if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
          && type_quals)
-       pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
+       pedwarn (input_location, OPT_pedantic,
+                "ISO C forbids qualified function types");
       if (type_quals)
        type = c_build_qualified_type (type, type_quals);
       decl = build_decl (TYPE_DECL, declarator->u.id, type);
@@ -4631,7 +4656,7 @@ grokdeclarator (const struct c_declarator *declarator,
       if (declspecs->explicit_signed_p)
        C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
       if (declspecs->inline_p)
-       pedwarn (0, "typedef %q+D declared %<inline%>", decl);
+       pedwarn (input_location, 0,"typedef %q+D declared %<inline%>", decl);
       return decl;
     }
 
@@ -4646,7 +4671,8 @@ grokdeclarator (const struct c_declarator *declarator,
                  && !declspecs->inline_p);
       if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
          && type_quals)
-       pedwarn (OPT_pedantic, "ISO C forbids const or volatile function types");
+       pedwarn (input_location, OPT_pedantic,
+                "ISO C forbids const or volatile function types");
       if (type_quals)
        type = c_build_qualified_type (type, type_quals);
       return type;
@@ -4656,7 +4682,7 @@ grokdeclarator (const struct c_declarator *declarator,
       && variably_modified_type_p (type, NULL_TREE))
     {
       /* C99 6.7.2.1p8 */
-      pedwarn (OPT_pedantic, 
+      pedwarn (input_location, OPT_pedantic, 
               "a member of a structure or union cannot have a variably modified type");
     }
 
@@ -4711,7 +4737,8 @@ grokdeclarator (const struct c_declarator *declarator,
        else if (TREE_CODE (type) == FUNCTION_TYPE)
          {
            if (type_quals)
-             pedwarn (OPT_pedantic, "ISO C forbids qualified function types");
+             pedwarn (input_location, OPT_pedantic,
+                      "ISO C forbids qualified function types");
            if (type_quals)
              type = c_build_qualified_type (type, type_quals);
            type = build_pointer_type (type);
@@ -4737,7 +4764,7 @@ grokdeclarator (const struct c_declarator *declarator,
 
        DECL_ARG_TYPE (decl) = promoted_type;
        if (declspecs->inline_p)
-         pedwarn (0, "parameter %q+D declared %<inline%>", decl);
+         pedwarn (input_location, 0, "parameter %q+D declared %<inline%>", decl);
       }
     else if (decl_context == FIELD)
       {
@@ -4783,7 +4810,7 @@ grokdeclarator (const struct c_declarator *declarator,
               GCC allows 'auto', perhaps with 'inline', to support
               nested functions.  */
            if (storage_class == csc_auto)
-               pedwarn (OPT_pedantic, "invalid storage class for function %qs", name);
+               pedwarn (input_location, OPT_pedantic, "invalid storage class for function %qs", name);
            else if (storage_class == csc_static)
              {
                error ("invalid storage class for function %qs", name);
@@ -4799,7 +4826,7 @@ grokdeclarator (const struct c_declarator *declarator,
        decl = build_decl_attribute_variant (decl, decl_attr);
 
        if (pedantic && type_quals && !DECL_IN_SYSTEM_HEADER (decl))
-         pedwarn (OPT_pedantic,
+         pedwarn (input_location, OPT_pedantic,
                   "ISO C forbids qualified function types");
 
        /* GNU C interprets a volatile-qualified function type to indicate
@@ -4842,22 +4869,11 @@ grokdeclarator (const struct c_declarator *declarator,
        if (flag_hosted && MAIN_NAME_P (declarator->u.id))
          {
            if (declspecs->inline_p)
-             pedwarn (0, "cannot inline function %<main%>");
+             pedwarn (input_location, 0, "cannot inline function %<main%>");
          }
        else if (declspecs->inline_p)
-         {
-           /* Record that the function is declared `inline'.  */
-           DECL_DECLARED_INLINE_P (decl) = 1;
-
-           /* Do not mark bare declarations as DECL_INLINE.  Doing so
-              in the presence of multiple declarations can result in
-              the abstract origin pointing between the declarations,
-              which will confuse dwarf2out.  */
-           if (initialized)
-             DECL_INLINE (decl) = 1;
-         }
-       else if (initialized)
-         DECL_INLINE (decl) = 1;
+         /* Record that the function is declared `inline'.  */
+         DECL_DECLARED_INLINE_P (decl) = 1;
       }
     else
       {
@@ -4892,7 +4908,7 @@ grokdeclarator (const struct c_declarator *declarator,
          C_DECL_VARIABLE_SIZE (decl) = 1;
 
        if (declspecs->inline_p)
-         pedwarn (0, "variable %q+D declared %<inline%>", decl);
+         pedwarn (input_location, 0, "variable %q+D declared %<inline%>", decl);
 
        /* At file scope, an initialized extern declaration may follow
           a static declaration.  In that case, DECL_EXTERNAL will be
@@ -5000,7 +5016,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
   else if (arg_types && TREE_CODE (TREE_VALUE (arg_types)) == IDENTIFIER_NODE)
     {
       if (!funcdef_flag)
-       pedwarn (0, "parameter names (without types) in function declaration");
+       pedwarn (input_location, 0, "parameter names (without types) in function declaration");
 
       arg_info->parms = arg_info->types;
       arg_info->types = 0;
@@ -5363,12 +5379,15 @@ start_struct (enum tree_code code, tree name)
    WIDTH is non-NULL for bit-fields only, and is an INTEGER_CST node.
    DECL_ATTRS is as for grokdeclarator.
 
+   LOC is the location of the structure component.
+
    This is done during the parsing of the struct declaration.
    The FIELD_DECL nodes are chained together and the lot of them
    are ultimately passed to `build_struct' to make the RECORD_TYPE node.  */
 
 tree
-grokfield (struct c_declarator *declarator, struct c_declspecs *declspecs,
+grokfield (location_t loc,
+          struct c_declarator *declarator, struct c_declspecs *declspecs,
           tree width, tree *decl_attrs)
 {
   tree value;
@@ -5414,10 +5433,10 @@ grokfield (struct c_declarator *declarator, struct c_declspecs *declspecs,
        }
       if (!ok)
        {
-         pedwarn (0, "declaration does not declare anything");
+         pedwarn (loc, 0, "declaration does not declare anything");
          return NULL_TREE;
        }
-      pedwarn (OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions");
+      pedwarn (loc, OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions");
     }
 
   value = grokdeclarator (declarator, declspecs, FIELD, false,
@@ -5516,16 +5535,16 @@ finish_struct (tree t, tree fieldlist, tree attributes)
          if (TREE_CODE (t) == UNION_TYPE)
            {
              if (fieldlist)
-               pedwarn (OPT_pedantic, "union has no named members");
+               pedwarn (input_location, OPT_pedantic, "union has no named members");
              else
-               pedwarn (OPT_pedantic, "union has no members");
+               pedwarn (input_location, OPT_pedantic, "union has no members");
            }
          else
            {
              if (fieldlist)
-               pedwarn (OPT_pedantic, "struct has no named members");
+               pedwarn (input_location, OPT_pedantic, "struct has no named members");
              else
-               pedwarn (OPT_pedantic, "struct has no members");
+               pedwarn (input_location, OPT_pedantic, "struct has no members");
            }
        }
     }
@@ -5604,7 +5623,7 @@ finish_struct (tree t, tree fieldlist, tree attributes)
 
       if (pedantic && !in_system_header && TREE_CODE (t) == RECORD_TYPE
          && flexible_array_type_p (TREE_TYPE (x)))
-       pedwarn (OPT_pedantic, 
+       pedwarn (input_location, OPT_pedantic, 
                 "%Jinvalid use of structure with flexible array member", x);
 
       if (DECL_NAME (x))
@@ -5847,8 +5866,8 @@ finish_enum (tree enumtype, tree values, tree attributes)
      that normally we only go as narrow as int - and signed iff any of
      the values are negative.  */
   unsign = (tree_int_cst_sgn (minnode) >= 0);
-  precision = MAX (min_precision (minnode, unsign),
-                  min_precision (maxnode, unsign));
+  precision = MAX (tree_int_cst_min_precision (minnode, unsign),
+                  tree_int_cst_min_precision (maxnode, unsign));
 
   if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node))
     {
@@ -5897,16 +5916,16 @@ finish_enum (tree enumtype, tree values, tree attributes)
 
          /* The ISO C Standard mandates enumerators to have type int,
             even though the underlying type of an enum type is
-            unspecified.  Here we convert any enumerators that fit in
-            an int to type int, to avoid promotions to unsigned types
-            when comparing integers with enumerators that fit in the
-            int range.  When -pedantic is given, build_enumerator()
-            would have already taken care of those that don't fit.  */
-         if (int_fits_type_p (ini, integer_type_node))
-           tem = integer_type_node;
-         else
-           tem = enumtype;
-         ini = convert (tem, ini);
+            unspecified.  However, GCC allows enumerators of any
+            integer type as an extensions.  build_enumerator()
+            converts any enumerators that fit in an int to type int,
+            to avoid promotions to unsigned types when comparing
+            integers with enumerators that fit in the int range.
+            When -pedantic is given, build_enumerator() would have
+            already warned about those that don't fit. Here we
+            convert the rest to the enumerator type. */
+         if (TREE_TYPE (ini) != integer_type_node)
+           ini = convert (enumtype, ini);
 
          DECL_INITIAL (enu) = ini;
          TREE_PURPOSE (pair) = DECL_NAME (enu);
@@ -5953,7 +5972,8 @@ finish_enum (tree enumtype, tree values, tree attributes)
    Assignment of sequential values by default is handled here.  */
 
 tree
-build_enumerator (struct c_enum_contents *the_enum, tree name, tree value)
+build_enumerator (struct c_enum_contents *the_enum, tree name, tree value,
+                 location_t value_loc)
 {
   tree decl, type;
 
@@ -5987,18 +6007,31 @@ build_enumerator (struct c_enum_contents *the_enum, tree name, tree value)
       if (the_enum->enum_overflow)
        error ("overflow in enumeration values");
     }
-
-  if (pedantic && !int_fits_type_p (value, integer_type_node))
-    {
-      pedwarn (OPT_pedantic, "ISO C restricts enumerator values to range of %<int%>");
-      /* XXX This causes -pedantic to change the meaning of the program.
-        Remove?  -zw 2004-03-15  */
-      value = convert (integer_type_node, value);
-    }
+  /* Even though the underlying type of an enum is unspecified, the
+     type of enumeration constants is explicitly defined as int
+     (6.4.4.3/2 in the C99 Standard).  GCC allows any integer type as
+     an extension.  */
+  else if (!int_fits_type_p (value, integer_type_node))
+    pedwarn (value_loc, OPT_pedantic, 
+            "ISO C restricts enumerator values to range of %<int%>");
+
+  /* The ISO C Standard mandates enumerators to have type int, even
+     though the underlying type of an enum type is unspecified.
+     However, GCC allows enumerators of any integer type as an
+     extensions.  Here we convert any enumerators that fit in an int
+     to type int, to avoid promotions to unsigned types when comparing
+     integers with enumerators that fit in the int range.  When
+     -pedantic is given, we would have already warned about those that
+     don't fit. We have to do this here rather than in finish_enum
+     because this value may be used to define more enumerators.  */
+  if (int_fits_type_p (value, integer_type_node))
+    value = convert (integer_type_node, value);
 
   /* Set basis for default for next value.  */
-  the_enum->enum_next_value = build_binary_op (PLUS_EXPR, value,
-                                              integer_one_node, 0);
+  the_enum->enum_next_value
+    = build_binary_op
+         (EXPR_HAS_LOCATION (value) ? EXPR_LOCATION (value) : input_location,
+        PLUS_EXPR, value, integer_one_node, 0);
   the_enum->enum_overflow = tree_int_cst_lt (the_enum->enum_next_value, value);
 
   /* Now create a declaration for the enum value name.  */
@@ -6106,7 +6139,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
     }
 
   if (warn_about_return_type)
-    pedwarn_c99 (flag_isoc99 ? 0 
+    pedwarn_c99 (input_location, flag_isoc99 ? 0 
                 : (warn_return_type ? OPT_Wreturn_type : OPT_Wimplicit_int),
                 "return type defaults to %<int%>");
 
@@ -6225,16 +6258,16 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
     maybe_apply_pragma_weak (decl1);
 
   /* Warn for unlikely, improbable, or stupid declarations of `main'.  */
-  if (warn_main > 0 && MAIN_NAME_P (DECL_NAME (decl1)))
+  if (warn_main && MAIN_NAME_P (DECL_NAME (decl1)))
     {
       if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
          != integer_type_node)
-       pedwarn (OPT_Wmain, "return type of %q+D is not %<int%>", decl1);
+       pedwarn (input_location, OPT_Wmain, "return type of %q+D is not %<int%>", decl1);
 
-      check_main_parameter_types(decl1);
+      check_main_parameter_types (decl1);
 
       if (!TREE_PUBLIC (decl1))
-       pedwarn (OPT_Wmain, "%q+D is normally a non-static function", decl1);
+       pedwarn (input_location, OPT_Wmain, "%q+D is normally a non-static function", decl1);
     }
 
   /* Record the decl so that the function name is defined.
@@ -6382,7 +6415,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
          warn_if_shadowing (decl);
 
          if (flag_isoc99)
-           pedwarn (0, "type of %q+D defaults to %<int%>", decl);
+           pedwarn (input_location, 0, "type of %q+D defaults to %<int%>", decl);
          else 
            warning (OPT_Wmissing_parameter_type, "type of %q+D defaults to %<int%>", decl);
        }
@@ -6502,10 +6535,10 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
                             "doesn%'t match built-in prototype", parm);
                  else
                    {
-                     pedwarn (OPT_pedantic, "promoted argument %qD "
+                     pedwarn (input_location, OPT_pedantic, "promoted argument %qD "
                               "doesn%'t match prototype", parm);
-                     pedwarn (OPT_pedantic, "%Hprototype declaration",
-                              &current_function_prototype_locus);
+                     pedwarn (current_function_prototype_locus, OPT_pedantic,
+                              "prototype declaration");
                    }
                }
              else
@@ -6690,30 +6723,18 @@ finish_function (void)
   if (DECL_RESULT (fndecl) && DECL_RESULT (fndecl) != error_mark_node)
     DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
 
-  if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted)
+  if (MAIN_NAME_P (DECL_NAME (fndecl)) && flag_hosted
+      && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
+      == integer_type_node && flag_isoc99)
     {
-      if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
-         != integer_type_node)
-       {
-         /* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned.
-            If warn_main is -1 (-Wno-main) we don't want to be warned.  */
-         if (!warn_main)
-           pedwarn (0, "return type of %q+D is not %<int%>", fndecl);
-       }
-      else
-       {
-         if (flag_isoc99)
-           {
-             tree stmt = c_finish_return (integer_zero_node);
-             /* Hack.  We don't want the middle-end to warn that this return
-                is unreachable, so we mark its location as special.  Using
-                UNKNOWN_LOCATION has the problem that it gets clobbered in
-                annotate_one_with_locus.  A cleaner solution might be to
-                ensure ! should_carry_locus_p (stmt), but that needs a flag.
-             */
-             SET_EXPR_LOCATION (stmt, BUILTINS_LOCATION);
-           }
-       }
+      tree stmt = c_finish_return (integer_zero_node);
+      /* Hack.  We don't want the middle-end to warn that this return
+        is unreachable, so we mark its location as special.  Using
+        UNKNOWN_LOCATION has the problem that it gets clobbered in
+        annotate_one_with_locus.  A cleaner solution might be to
+        ensure ! should_carry_locus_p (stmt), but that needs a flag.
+      */
+      SET_EXPR_LOCATION (stmt, BUILTINS_LOCATION);
     }
 
   /* Tie off the statement tree for this function.  */
@@ -6803,13 +6824,19 @@ check_for_loop_decls (void)
   tree one_decl = NULL_TREE;
   int n_decls = 0;
 
-
   if (!flag_isoc99)
     {
+      static bool hint = true;
       /* If we get here, declarations have been used in a for loop without
         the C99 for loop scope.  This doesn't make much sense, so don't
         allow it.  */
-      error ("%<for%> loop initial declaration used outside C99 mode");
+      error ("%<for%> loop initial declarations are only allowed in C99 mode");
+      if (hint)
+       {
+         inform (input_location, 
+                 "use option -std=c99 or -std=gnu99 to compile your code");
+         hint = false;
+       }
       return NULL_TREE;
     }
   /* C99 subclause 6.8.5 paragraph 3:
@@ -6954,15 +6981,6 @@ current_stmt_tree (void)
   return &c_stmt_tree;
 }
 
-/* Nonzero if TYPE is an anonymous union or struct type.  Always 0 in
-   C.  */
-
-int
-anon_aggr_type_p (const_tree ARG_UNUSED (node))
-{
-  return 0;
-}
-
 /* Return the global value of T as a symbol.  */
 
 tree
@@ -7150,7 +7168,7 @@ declspecs_add_qual (struct c_declspecs *specs, tree qual)
       gcc_unreachable ();
     }
   if (dupe && !flag_isoc99)
-    pedwarn (OPT_pedantic, "duplicate %qE", qual);
+    pedwarn (input_location, OPT_pedantic, "duplicate %qE", qual);
   return specs;
 }
 
@@ -7199,7 +7217,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
                      break;
                    }
                  if (pedantic && !flag_isoc99 && !in_system_header)
-                   pedwarn (OPT_Wlong_long, "ISO C90 does not support %<long long%>");
+                   pedwarn (input_location, OPT_Wlong_long, "ISO C90 does not support %<long long%>");
                  specs->long_long_p = 1;
                  break;
                }
@@ -7323,7 +7341,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
            case RID_COMPLEX:
              dupe = specs->complex_p;
              if (!flag_isoc99 && !in_system_header)
-               pedwarn (OPT_pedantic, "ISO C90 does not support complex types");
+               pedwarn (input_location, OPT_pedantic, "ISO C90 does not support complex types");
              if (specs->typespec_word == cts_void)
                error ("both %<complex%> and %<void%> in "
                       "declaration specifiers");
@@ -7353,7 +7371,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
              break;
            case RID_SAT:
              dupe = specs->saturating_p;
-             pedwarn (OPT_pedantic, "ISO C does not support saturating types");
+             pedwarn (input_location, OPT_pedantic, "ISO C does not support saturating types");
              if (specs->typespec_word == cts_void)
                error ("both %<_Sat%> and %<void%> in "
                       "declaration specifiers");
@@ -7550,7 +7568,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
              }
              if (!targetm.decimal_float_supported_p ())
                error ("decimal floating point not supported for this target");
-             pedwarn (OPT_pedantic, 
+             pedwarn (input_location, OPT_pedantic, 
                       "ISO C does not support decimal floating point");
              return specs;
            case RID_FRACT:
@@ -7571,7 +7589,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
              }
              if (!targetm.fixed_point_supported_p ())
                error ("fixed-point types not supported for this target");
-             pedwarn (OPT_pedantic, 
+             pedwarn (input_location, OPT_pedantic, 
                       "ISO C does not support fixed-point types");
              return specs;
            default:
@@ -7758,7 +7776,7 @@ finish_declspecs (struct c_declspecs *specs)
       else if (specs->complex_p)
        {
          specs->typespec_word = cts_double;
-         pedwarn (OPT_pedantic, 
+         pedwarn (input_location, OPT_pedantic, 
                   "ISO C does not support plain %<complex%> meaning "
                   "%<double complex%>");
        }
@@ -7803,7 +7821,7 @@ finish_declspecs (struct c_declspecs *specs)
        specs->type = char_type_node;
       if (specs->complex_p)
        {
-         pedwarn (OPT_pedantic, 
+         pedwarn (input_location, OPT_pedantic, 
                   "ISO C does not support complex integer types");
          specs->type = build_complex_type (specs->type);
        }
@@ -7829,7 +7847,7 @@ finish_declspecs (struct c_declspecs *specs)
                       : integer_type_node);
       if (specs->complex_p)
        {
-         pedwarn (OPT_pedantic, 
+         pedwarn (input_location, OPT_pedantic, 
                   "ISO C does not support complex integer types");
          specs->type = build_complex_type (specs->type);
        }
@@ -7980,7 +7998,7 @@ c_write_global_declarations_1 (tree globals)
          && !TREE_PUBLIC (decl)
          && C_DECL_USED (decl))
        {
-         pedwarn (0, "%q+F used but never defined", decl);
+         pedwarn (input_location, 0, "%q+F used but never defined", decl);
          TREE_NO_WARNING (decl) = 1;
        }