aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-03-30 19:35:49 +0000
committerJoseph Myers <joseph@codesourcery.com>2005-03-30 19:35:49 +0000
commitac33f1f21c02692fc616459419d0f92bd11ba3a4 (patch)
tree2be5b945b2d43442ad7d484da300b889093ef64a /gcc/c-decl.c
parentf3506a2459e553cbabd0afaa6d6318fc9b8c80a4 (diff)
PR c/20368
* c-decl.c (start_function): Check for old_decl being error_mark_node. testsuite: * gcc.dg/pr20368-1.c, gcc.dg/pr20368-2.c, gcc.dg/pr20368-3.c: New tests. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@97270 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index cc45e26c2fd..f333dade0b8 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5691,11 +5691,13 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
/* Optionally warn of old-fashioned def with no previous prototype. */
if (warn_strict_prototypes
+ && old_decl != error_mark_node
&& TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0
&& C_DECL_ISNT_PROTOTYPE (old_decl))
warning ("function declaration isn%'t a prototype");
/* Optionally warn of any global def with no previous prototype. */
else if (warn_missing_prototypes
+ && old_decl != error_mark_node
&& TREE_PUBLIC (decl1)
&& !MAIN_NAME_P (DECL_NAME (decl1))
&& C_DECL_ISNT_PROTOTYPE (old_decl))
@@ -5703,7 +5705,9 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
/* Optionally warn of any def with no previous prototype
if the function has already been used. */
else if (warn_missing_prototypes
- && old_decl != 0 && TREE_USED (old_decl)
+ && old_decl != 0
+ && old_decl != error_mark_node
+ && TREE_USED (old_decl)
&& TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0)
warning ("%J%qD was used with no prototype before its definition",
decl1, decl1);
@@ -5716,7 +5720,9 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
/* Optionally warn of any def with no previous declaration
if the function has already been used. */
else if (warn_missing_declarations
- && old_decl != 0 && TREE_USED (old_decl)
+ && old_decl != 0
+ && old_decl != error_mark_node
+ && TREE_USED (old_decl)
&& C_DECL_IMPLICIT (old_decl))
warning ("%J%qD was used with no declaration before its definition",
decl1, decl1);