diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-decl.c | 12 | ||||
-rw-r--r-- | gcc/config/linux.opt | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wcxx-compat-19.c | 19 |
5 files changed, 48 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d16cd5f..769976e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2009-06-22 Ian Lance Taylor <iant@google.com> + + * config/linux.opt: Put mglibc ahead of muclibc. + + * c-decl.c (diagnose_mismatched_decls): Add -Wc++-compat warning + for duplicate decls. + 2009-06-22 Matthias Klose <doko@ubuntu.com> * Makefile.in (install-plugin): Remove extra `/' after $(DESTDIR). 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 */ diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt index fe8c075..a9b40f0 100644 --- a/gcc/config/linux.opt +++ b/gcc/config/linux.opt @@ -1,6 +1,6 @@ ; Processor-independent options for GNU/Linux. ; -; Copyright (C) 2006, 2007 Free Software Foundation, Inc. +; Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. ; Contributed by CodeSourcery. ; ; This file is part of GCC. @@ -19,10 +19,10 @@ ; along with GCC; see the file COPYING3. If not see ; <http://www.gnu.org/licenses/>. -muclibc -Target RejectNegative Report Mask(UCLIBC) Var(linux_uclibc) Init(UCLIBC_DEFAULT ? OPTION_MASK_UCLIBC : 0) -Use uClibc instead of GNU libc - mglibc -Target RejectNegative Report InverseMask(UCLIBC, GLIBC) Var(linux_uclibc) VarExists +Target RejectNegative Report InverseMask(UCLIBC, GLIBC) Var(linux_uclibc) Init(UCLIBC_DEFAULT ? OPTION_MASK_UCLIBC : 0) Use GNU libc instead of uClibc + +muclibc +Target RejectNegative Report Mask(UCLIBC) Var(linux_uclibc) VarExists +Use uClibc instead of GNU libc diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7ba2ddc..2bb9f6f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-06-22 Ian Lance Taylor <iant@google.com> + + * gcc.dg/Wcxx-compat-19.c: New testcase. + 2009-06-22 Matthias Klose <doko@ubuntu.com> PR objc/28050 diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-19.c b/gcc/testsuite/gcc.dg/Wcxx-compat-19.c new file mode 100644 index 0000000..120ccf5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-19.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ +int v1; /* { dg-message "previous declaration" } */ +int v1; /* { dg-warning "invalid in C\[+\]\[+\]" } */ +int v2; /* { dg-message "previous declaration" } */ +int v2 = 1; /* { dg-warning "invalid in C\[+\]\[+\]" } */ +extern int v3; +int v3; /* { dg-message "previous declaration" } */ +int v3 = 1; /* { dg-warning "invalid in C\[+\]\[+\]" } */ +extern int v4; +int v4 = 1; +static int v5; /* { dg-message "previous declaration" } */ +static int v5; /* { dg-warning "invalid in C\[+\]\[+\]" } */ +static int v6; /* { dg-message "previous declaration" } */ +static int v6 = 1; /* { dg-warning "invalid in C\[+\]\[+\]" } */ +int v7; +extern int v7; +int v8 = 1; +extern int v8; |