/* 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))
/* 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);
/* 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);
+2005-03-30 Joseph S. Myers <joseph@codesourcery.com>
+
+ PR c/20368
+ * gcc.dg/pr20368-1.c, gcc.dg/pr20368-2.c, gcc.dg/pr20368-3.c: New
+ tests.
+
2005-03-30 Alan Modra <amodra@bigpond.net.au>
* gcc.c-torture/compile/pr20203.c: New test.
--- /dev/null
+/* ICE with -Wstrict-prototypes and typeof an undeclared function.
+ Bug 20368. Test with -Wmissing-declarations. */
+/* { dg-do compile } */
+/* { dg-options "-Wmissing-declarations" } */
+
+extern __typeof (f) g; /* { dg-error "error: 'f' undeclared here \\(not in a function\\)" } */
+
+int
+f (x)
+ float x;
+{
+}