From: Jim Wilson Date: Mon, 21 Mar 1994 22:07:03 +0000 (-0800) Subject: (duplicate_decls): When pedantic, warn when any static X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1a77352f64af201ef95c0acb964284194dcd278;p=gcc.git (duplicate_decls): When pedantic, warn when any static declaraction follows a non-static. From-SVN: r6840 --- diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a95e7259297..6fcf45be81f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1576,9 +1576,10 @@ duplicate_decls (newdecl, olddecl) && DECL_INITIAL (olddecl) != 0) warning_with_decl (newdecl, "`%s' declared inline after its definition"); - /* It is nice to warn when a function is declared - global first and then static. */ - if (TREE_CODE (olddecl) == FUNCTION_DECL + + /* If pedantic, warn when static declaration follows a non-static + declaration. Otherwise, do so only for functions. */ + if ((pedantic || TREE_CODE (olddecl) == FUNCTION_DECL) && TREE_PUBLIC (olddecl) && !TREE_PUBLIC (newdecl)) warning_with_decl (newdecl, "static declaration for `%s' follows non-static");