aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2009-06-22 16:49:03 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2009-06-22 16:49:03 +0000
commit7a5d2eb861a39a2422fb25e4e106941a5aba79d8 (patch)
treeb04b7d452e4afa1ea57eb1317a2bd224cb2ab8f4 /gcc/c-decl.c
parent86e3c83a1cc35d293f60ebd6128993b754a9e7ad (diff)
downloadgcc-7a5d2eb861a39a2422fb25e4e106941a5aba79d8.zip
gcc-7a5d2eb861a39a2422fb25e4e106941a5aba79d8.tar.gz
gcc-7a5d2eb861a39a2422fb25e4e106941a5aba79d8.tar.bz2
linux.opt: Put mglibc ahead of muclibc.
./: * config/linux.opt: Put mglibc ahead of muclibc. * c-decl.c (diagnose_mismatched_decls): Add -Wc++-compat warning for duplicate decls. testsuite/: * gcc.dg/Wcxx-compat-19.c: New testcase. From-SVN: r148808
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 8234e01..5eab454 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1991,6 +1991,18 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
return false;
}
+
+ /* C++ does not permit a decl to appear multiple times at file
+ scope. */
+ if (warn_cxx_compat
+ && DECL_FILE_SCOPE_P (newdecl)
+ && !DECL_EXTERNAL (newdecl)
+ && !DECL_EXTERNAL (olddecl))
+ warned |= warning_at (DECL_SOURCE_LOCATION (newdecl),
+ OPT_Wc___compat,
+ ("duplicate declaration of %qD is "
+ "invalid in C++"),
+ newdecl);
}
/* warnings */