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
This commit is contained in:
Ian Lance Taylor 2009-06-22 16:49:03 +00:00 committed by Ian Lance Taylor
parent 86e3c83a1c
commit 7a5d2eb861
5 changed files with 48 additions and 6 deletions

View File

@ -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> 2009-06-22 Matthias Klose <doko@ubuntu.com>
* Makefile.in (install-plugin): Remove extra `/' after $(DESTDIR). * Makefile.in (install-plugin): Remove extra `/' after $(DESTDIR).

View File

@ -1991,6 +1991,18 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
return false; 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 */ /* warnings */

View File

@ -1,6 +1,6 @@
; Processor-independent options for GNU/Linux. ; 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. ; Contributed by CodeSourcery.
; ;
; This file is part of GCC. ; This file is part of GCC.
@ -19,10 +19,10 @@
; along with GCC; see the file COPYING3. If not see ; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>. ; <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 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 Use GNU libc instead of uClibc
muclibc
Target RejectNegative Report Mask(UCLIBC) Var(linux_uclibc) VarExists
Use uClibc instead of GNU libc

View File

@ -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> 2009-06-22 Matthias Klose <doko@ubuntu.com>
PR objc/28050 PR objc/28050

View File

@ -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;