aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 34a8f42..a9eb619 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -358,7 +358,7 @@ int warn_long_long = 1;
/* Nonzero means message about use of implicit function declarations;
1 means warning; 2 means error. */
-int mesg_implicit_function_declaration;
+int mesg_implicit_function_declaration = -1;
/* Nonzero means give string constants the type `const char *'
to get extra warnings from them. These warnings will be too numerous
@@ -2525,15 +2525,8 @@ implicitly_declare (functionid)
rest_of_decl_compilation (decl, NULL_PTR, 0, 0);
- if (mesg_implicit_function_declaration && implicit_warning)
- {
- if (mesg_implicit_function_declaration == 2)
- error ("implicit declaration of function `%s'",
- IDENTIFIER_POINTER (functionid));
- else
- warning ("implicit declaration of function `%s'",
- IDENTIFIER_POINTER (functionid));
- }
+ if (implicit_warning)
+ implicit_decl_warning (functionid);
else if (warn_traditional && traditional_warning)
warning ("function `%s' was previously declared within a block",
IDENTIFIER_POINTER (functionid));
@@ -2546,6 +2539,17 @@ implicitly_declare (functionid)
return decl;
}
+void
+implicit_decl_warning (id)
+ tree id;
+{
+ char *name = IDENTIFIER_POINTER (id);
+ if (mesg_implicit_function_declaration == 2)
+ error ("implicit declaration of function `%s'", name);
+ else if (mesg_implicit_function_declaration == 1)
+ warning ("implicit declaration of function `%s'", name);
+}
+
/* Return zero if the declaration NEWDECL is valid
when the declaration OLDDECL (assumed to be for the same name)
has already been seen.