aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-03-21 14:07:03 -0800
committerJim Wilson <wilson@gcc.gnu.org>1994-03-21 14:07:03 -0800
commita1a77352f64af201ef95c0acb964284194dcd278 (patch)
tree406b17fb5246374e90b330fc0572279ad4bb303e /gcc
parent387fd02d7e0ec8bdca519b096dc464d2f267a979 (diff)
downloadgcc-a1a77352f64af201ef95c0acb964284194dcd278.zip
gcc-a1a77352f64af201ef95c0acb964284194dcd278.tar.gz
gcc-a1a77352f64af201ef95c0acb964284194dcd278.tar.bz2
(duplicate_decls): When pedantic, warn when any static
declaraction follows a non-static. From-SVN: r6840
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index a95e725..6fcf45b 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");