From: Rodrigo Rivas Costa Date: Fri, 10 Sep 2010 18:28:59 +0000 (+0000) Subject: re PR c++/43824 (C++0x feature "inline namespace" enabled under -std=c++98; no warnings) X-Git-Tag: releases/gcc-4.6.0~4400 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc2c4cb45ec9f5ad78cbe21711f053c22c41a29b;p=thirdparty%2Fgcc.git re PR c++/43824 (C++0x feature "inline namespace" enabled under -std=c++98; no warnings) PR c++/43824 * error.c (maybe_warn_cpp0x): Add new warning CPP0X_INLINE_NAMESPACES. * parser.c (cp_parser_namespace_definition): Likewise. * cp-tree.h (cpp0x_warn_str): Likewise. From-SVN: r164201 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a5d46a8d679b..5c5873322634 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2010-09-10 Rodrigo Rivas Costa + + PR c++/43824 + * error.c (maybe_warn_cpp0x): Add new warning + CPP0X_INLINE_NAMESPACES. + * parser.c (cp_parser_namespace_definition): Likewise. + * cp-tree.h (cpp0x_warn_str): Likewise. + 2010-09-10 Richard Guenther * decl.c (reshape_init_vector): For VECTOR_TYPEs, use diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cb3b55f484f0..bf8017e267d7 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -387,7 +387,9 @@ typedef enum cpp0x_warn_str /* scoped enums */ CPP0X_SCOPED_ENUMS, /* defaulted and deleted functions */ - CPP0X_DEFAULTED_DELETED + CPP0X_DEFAULTED_DELETED, + /* inline namespaces */ + CPP0X_INLINE_NAMESPACES } cpp0x_warn_str; /* The various kinds of operation used by composite_pointer_type. */ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 2bcc35bcc3fc..981b71f5452f 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -3028,6 +3028,11 @@ maybe_warn_cpp0x (cpp0x_warn_str str) pedwarn (input_location, 0, "defaulted and deleted functions " "only available with -std=c++0x or -std=gnu++0x"); + break; + case CPP0X_INLINE_NAMESPACES: + pedwarn (input_location, OPT_pedantic, + "inline namespaces " + "only available with -std=c++0x or -std=gnu++0x"); break; default: gcc_unreachable(); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8faf21d8850d..3f2c4de05329 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -13255,6 +13255,7 @@ cp_parser_namespace_definition (cp_parser* parser) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_INLINE)) { + maybe_warn_cpp0x (CPP0X_INLINE_NAMESPACES); is_inline = true; cp_lexer_consume_token (parser->lexer); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9815d188de2e..da33e090e1e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2010-09-10 Rodrigo Rivas Costa + + PR c++/43824 + * g++.dg/lookup/strong-using-1.C: Set dg-options to "". + * g++.dg/lookup/strong-using-2.C: Likewise. + * g++.dg/lookup/strong-using-3.C: Likewise. + * g++.dg/lookup/strong-using-5.C: Likewise. + + * g++.dg/cpp0x/inline-ns3.C: Add -std=c++0x. + * g++.dg/cpp0x/inline-ns4.C: New. + * g++.dg/cpp0x/inline-ns5.C: New. + 2010-09-10 H.J. Lu PR middle-end/45634 diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C index 8981a57ac4c4..7c9d6b9b5469 100644 --- a/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C @@ -1,3 +1,5 @@ +// { dg-options -std=c++0x } + namespace C { void f(); diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns4.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns4.C new file mode 100644 index 000000000000..25caefc0ae25 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns4.C @@ -0,0 +1,2 @@ +// { dg-options "-std=gnu++98 -pedantic" } +inline namespace { } // { dg-warning "inline namespaces" } diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns5.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns5.C new file mode 100644 index 000000000000..20a3dc6bb8e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inline-ns5.C @@ -0,0 +1,2 @@ +// { dg-options "-std=gnu++98 -pedantic-errors" } +inline namespace { } // { dg-error "inline namespaces" } diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-1.C b/gcc/testsuite/g++.dg/lookup/strong-using-1.C index 739dc936e405..aa0c5f9be157 100644 --- a/gcc/testsuite/g++.dg/lookup/strong-using-1.C +++ b/gcc/testsuite/g++.dg/lookup/strong-using-1.C @@ -1,5 +1,6 @@ // PR c++/13594 (secondary) +// { dg-options "" } // { dg-do compile } namespace fool { diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-2.C b/gcc/testsuite/g++.dg/lookup/strong-using-2.C index 314aa52388a0..38bb54c2f58d 100644 --- a/gcc/testsuite/g++.dg/lookup/strong-using-2.C +++ b/gcc/testsuite/g++.dg/lookup/strong-using-2.C @@ -1,5 +1,6 @@ // PR c++/13594 +// { dg-options "" } // { dg-do compile } namespace foo { diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-3.C b/gcc/testsuite/g++.dg/lookup/strong-using-3.C index 17c50329df0a..7679c6f1dc7b 100644 --- a/gcc/testsuite/g++.dg/lookup/strong-using-3.C +++ b/gcc/testsuite/g++.dg/lookup/strong-using-3.C @@ -1,5 +1,6 @@ // PR c++/13659 +// { dg-options "" } // { dg-do compile } namespace bar { diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-5.C b/gcc/testsuite/g++.dg/lookup/strong-using-5.C index 789c8e34181b..555adb0c9b1c 100644 --- a/gcc/testsuite/g++.dg/lookup/strong-using-5.C +++ b/gcc/testsuite/g++.dg/lookup/strong-using-5.C @@ -1,5 +1,7 @@ // PR c++/33486 +// { dg-options "" } + namespace A { inline namespace B