(duplicate_decls): When pedantic, warn when any static

declaraction follows a non-static.

From-SVN: r6840
This commit is contained in:
Jim Wilson 1994-03-21 14:07:03 -08:00
parent 387fd02d7e
commit a1a77352f6

View File

@ -1576,9 +1576,10 @@ duplicate_decls (newdecl, olddecl)
&& DECL_INITIAL (olddecl) != 0) && DECL_INITIAL (olddecl) != 0)
warning_with_decl (newdecl, warning_with_decl (newdecl,
"`%s' declared inline after its definition"); "`%s' declared inline after its definition");
/* It is nice to warn when a function is declared
global first and then static. */ /* If pedantic, warn when static declaration follows a non-static
if (TREE_CODE (olddecl) == FUNCTION_DECL declaration. Otherwise, do so only for functions. */
if ((pedantic || TREE_CODE (olddecl) == FUNCTION_DECL)
&& TREE_PUBLIC (olddecl) && TREE_PUBLIC (olddecl)
&& !TREE_PUBLIC (newdecl)) && !TREE_PUBLIC (newdecl))
warning_with_decl (newdecl, "static declaration for `%s' follows non-static"); warning_with_decl (newdecl, "static declaration for `%s' follows non-static");