From patchwork Fri Sep 10 10:18:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Rivas X-Patchwork-Id: 64369 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0C723B70F9 for ; Fri, 10 Sep 2010 20:19:06 +1000 (EST) Received: (qmail 982 invoked by alias); 10 Sep 2010 10:19:02 -0000 Received: (qmail 969 invoked by uid 22791); 10 Sep 2010 10:19:01 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Sep 2010 10:18:54 +0000 Received: by wye20 with SMTP id 20so2644966wye.20 for ; Fri, 10 Sep 2010 03:18:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.137.199 with SMTP id x7mr811266wbt.107.1284113931298; Fri, 10 Sep 2010 03:18:51 -0700 (PDT) Received: by 10.216.53.137 with HTTP; Fri, 10 Sep 2010 03:18:51 -0700 (PDT) In-Reply-To: <4C74A970.6030800@redhat.com> References: <1280185724.5689.2.camel@abajo> <4C6C5BD8.30606@redhat.com> <4C735352.3020804@redhat.com> <4C74A970.6030800@redhat.com> Date: Fri, 10 Sep 2010 12:18:51 +0200 Message-ID: Subject: Re: [PATCH, C++] PR43824 pedantic with inline namespaces From: Rodrigo Rivas To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello. At last my copyright assignment is complete! I've updated the patch to the latest SVN revision. I think that now it is ready for commit. Rodrigo. Changelog. --- gcc/cp 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. gcc/testsuite/ 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. Index: gcc/testsuite/g++.dg/lookup/strong-using-1.C =================================================================== --- gcc/testsuite/g++.dg/lookup/strong-using-1.C (revision 164143) +++ gcc/testsuite/g++.dg/lookup/strong-using-1.C (working copy) @@ -1,5 +1,6 @@ // PR c++/13594 (secondary) +// { dg-options "" } // { dg-do compile } namespace fool { Index: gcc/testsuite/g++.dg/lookup/strong-using-5.C =================================================================== --- gcc/testsuite/g++.dg/lookup/strong-using-5.C (revision 164143) +++ gcc/testsuite/g++.dg/lookup/strong-using-5.C (working copy) @@ -1,5 +1,7 @@ // PR c++/33486 +// { dg-options "" } + namespace A { inline namespace B Index: gcc/testsuite/g++.dg/lookup/strong-using-2.C =================================================================== --- gcc/testsuite/g++.dg/lookup/strong-using-2.C (revision 164143) +++ gcc/testsuite/g++.dg/lookup/strong-using-2.C (working copy) @@ -1,5 +1,6 @@ // PR c++/13594 +// { dg-options "" } // { dg-do compile } namespace foo { Index: gcc/testsuite/g++.dg/lookup/strong-using-3.C =================================================================== --- gcc/testsuite/g++.dg/lookup/strong-using-3.C (revision 164143) +++ gcc/testsuite/g++.dg/lookup/strong-using-3.C (working copy) @@ -1,5 +1,6 @@ // PR c++/13659 +// { dg-options "" } // { dg-do compile } namespace bar { Index: gcc/testsuite/g++.dg/cpp0x/inline-ns3.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/inline-ns3.C (revision 164143) +++ gcc/testsuite/g++.dg/cpp0x/inline-ns3.C (working copy) @@ -1,3 +1,5 @@ +// { dg-options -std=c++0x } + namespace C { void f(); Index: gcc/testsuite/g++.dg/cpp0x/inline-ns4.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/inline-ns4.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/inline-ns4.C (revision 0) @@ -0,0 +1,2 @@ +// { dg-options "-std=gnu++98 -pedantic" } +inline namespace { } // { dg-warning "inline namespaces" } Index: gcc/testsuite/g++.dg/cpp0x/inline-ns5.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/inline-ns5.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/inline-ns5.C (revision 0) @@ -0,0 +1,2 @@ +// { dg-options "-std=gnu++98 -pedantic-errors" } +inline namespace { } // { dg-error "inline namespaces" } Index: gcc/cp/error.c =================================================================== --- gcc/cp/error.c (revision 164143) +++ gcc/cp/error.c (working copy) @@ -3029,6 +3029,11 @@ maybe_warn_cpp0x (cpp0x_warn_str str) "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(); } Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 164143) +++ gcc/cp/parser.c (working copy) @@ -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); } Index: gcc/cp/cp-tree.h =================================================================== --- gcc/cp/cp-tree.h (revision 164143) +++ gcc/cp/cp-tree.h (working copy) @@ -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. */