From patchwork Thu Jan 26 15:29:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 720223 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v8Qq763Lvz9tjt for ; Fri, 27 Jan 2017 02:30:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fGGKA7FF"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=sXuGfJvbT+8lvMrcezQCO3VMr0A8uinw5Cyyb3qqokETEq /TDTQyFS0wq42a0NiPFU6j77e/zpd3ojplrb/2rTMcxdjCVLTz/8b9mmGslQ91vJ TojXIFHd/nCe4TINz95krYQueHJXZBMM1j3Bv93q/GYsYuvpXg58p9dLo9oAU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=KasItymCWjqSaSW7IjYynNxRCM4=; b=fGGKA7FFruBZbPrbzQgp CtJEnahhGfUQ2fNIXT47ajYNzLLk25uE+rUpmwbO2md65Y3ZUMrLgr2GCvk0zimm I2AtLhhrHV+3bazefzo0FAI3PNQRV8SHqJ4SbbPCPNkfwj/NN6pDMlaY/tYSM0vz nyHqldJcKPAvfMnOfyQAv5U= Received: (qmail 41526 invoked by alias); 26 Jan 2017 15:30:19 -0000 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 Received: (qmail 39902 invoked by uid 89); 26 Jan 2017 15:30:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=Association, coexistence, Concepts, @section X-HELO: mail-oi0-f45.google.com Received: from mail-oi0-f45.google.com (HELO mail-oi0-f45.google.com) (209.85.218.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Jan 2017 15:30:05 +0000 Received: by mail-oi0-f45.google.com with SMTP id j15so139988669oih.2 for ; Thu, 26 Jan 2017 07:30:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=RYykytwW/iHzYbcx8f+TK67mCFFt0mumjgF9vH6Czv8=; b=jNEqRhe4UPCgfrWctE37q1ZLrfcuELJSFnPZD4PL2MulO+mK7tFNKwIxM8booFj8x1 ZU0XIcUiaZLGgP4XHILTr1NbLHwsiaAygHCyhgD13gTcq7i6JN3MOAkwYQTD5XeHIAOB GQe/N1D53mntp01ZdsOeiFlzKKYVwWAHnENv0eBi/xMQ0EZhez41CZes+S7Xusga5LId jQ6Gj4A7W88jNo6QjehdFcThK8g30S1bLlN3HDcM/SA5UvChE+1tVOt/BtzYVrkXmlkY xoebLC15ssksY9+qiFTaxCR2OUeVgDC3Q6TTEsEgdHn4pQPPJVEYqAFmZR7FiquUuP8S YECw== X-Gm-Message-State: AIkVDXK8loD/qqW6KkfEvd6NllTLyrUzCqS1rYi9lNyuVSNUlJDqwTR7xibMuFX93FxNLefLOMYzLPIShU0yPz9Q X-Received: by 10.202.170.67 with SMTP id t64mr2166043oie.117.1485444603877; Thu, 26 Jan 2017 07:30:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.173.104 with HTTP; Thu, 26 Jan 2017 07:29:43 -0800 (PST) From: Jason Merrill Date: Thu, 26 Jan 2017 10:29:43 -0500 Message-ID: Subject: C++ PATCH to warn about "strong using" To: gcc-patches List X-IsSubscribed: yes Attribute "strong" on a using-directive was a G++ extension that eventually became C++11 inline namespaces. It's been documented as deprecated for a while, but we didn't actually warn about it. This patch adds such a warning and removes the documentation. Tested x86_64-pc-linux-gnu, applying to trunk. commit 60ef52152fb50569e5f8ac08c149254bc44aa02c Author: Jason Merrill Date: Tue Jan 24 14:31:24 2017 -0500 * name-lookup.c (parse_using_directive): Deprecate strong using. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 4004640..10fb540 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -4125,6 +4125,8 @@ parse_using_directive (tree name_space, tree attribs) tree name = get_attribute_name (a); if (is_attribute_p ("strong", name)) { + warning (OPT_Wdeprecated, "strong using is deprecated; use inline " + "namespaces instead"); if (!toplevel_bindings_p ()) error ("strong using only meaningful at namespace scope"); else if (name_space != error_mark_node) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 5cb4748..20eba82 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -21802,7 +21802,6 @@ Predefined Macros,cpp,The GNU C Preprocessor}). method denoted by a @samp{->*} or @samp{.*} expression. * C++ Attributes:: Variable, function, and type attributes for C++ only. * Function Multiversioning:: Declaring multiple function versions. -* Namespace Association:: Strong using-directives for namespace association. * Type Traits:: Compiler support for type traits. * C++ Concepts:: Improved support for generic programming. * Deprecated Features:: Things will disappear from G++. @@ -22368,8 +22367,6 @@ does not have constructors or destructors. @end table -See also @ref{Namespace Association}. - @node Function Multiversioning @section Function Multiversioning @cindex function versions @@ -22428,51 +22425,6 @@ dispatching to call the right version at runtime. Refer to the @uref{http://gcc.gnu.org/wiki/FunctionMultiVersioning, GCC wiki on Function Multiversioning} for more details. -@node Namespace Association -@section Namespace Association - -@strong{Caution:} The semantics of this extension are equivalent -to C++ 2011 inline namespaces. Users should use inline namespaces -instead as this extension will be removed in future versions of G++. - -A using-directive with @code{__attribute ((strong))} is stronger -than a normal using-directive in two ways: - -@itemize @bullet -@item -Templates from the used namespace can be specialized and explicitly -instantiated as though they were members of the using namespace. - -@item -The using namespace is considered an associated namespace of all -templates in the used namespace for purposes of argument-dependent -name lookup. -@end itemize - -The used namespace must be nested within the using namespace so that -normal unqualified lookup works properly. - -This is useful for composing a namespace transparently from -implementation namespaces. For example: - -@smallexample -namespace std @{ - namespace debug @{ - template struct A @{ @}; - @} - using namespace debug __attribute ((__strong__)); - template <> struct A @{ @}; // @r{OK to specialize} - - template void f (A); -@} - -int main() -@{ - f (std::A()); // @r{lookup finds} std::f - f (std::A()); -@} -@end smallexample - @node Type Traits @section Type Traits diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-1.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns6.C similarity index 100% rename from gcc/testsuite/g++.dg/lookup/strong-using-1.C rename to gcc/testsuite/g++.dg/cpp0x/inline-ns6.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-2.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns7.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-2.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns7.C similarity index 100% rename from gcc/testsuite/g++.dg/lookup/strong-using-2.C rename to gcc/testsuite/g++.dg/cpp0x/inline-ns7.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-3.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns8.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-3.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns8.C similarity index 100% rename from gcc/testsuite/g++.dg/lookup/strong-using-3.C rename to gcc/testsuite/g++.dg/cpp0x/inline-ns8.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-5.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns9.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-5.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns9.C similarity index 100% rename from gcc/testsuite/g++.dg/lookup/strong-using-5.C rename to gcc/testsuite/g++.dg/cpp0x/inline-ns9.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-4.C b/gcc/testsuite/g++.dg/lookup/strong-using-4.C diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-4.C b/gcc/testsuite/g++.dg/lookup/strong-using-4.C deleted file mode 100644 index 5ea1784..0000000 --- a/gcc/testsuite/g++.dg/lookup/strong-using-4.C +++ /dev/null @@ -1,8 +0,0 @@ -// PR c++/16301 - -// { dg-do compile } - -namespace NS2 -{ - using namespace NS1 __attribute__ ((strong)); // { dg-error "" } -} diff --git a/libstdc++-v3/doc/html/manual/debug_mode_design.html b/libstdc++-v3/doc/html/manual/debug_mode_design.html index 3373471..3fcdb2d 100644 --- a/libstdc++-v3/doc/html/manual/debug_mode_design.html +++ b/libstdc++-v3/doc/html/manual/debug_mode_design.html @@ -250,7 +250,6 @@ namespace std }; } // namespace __cxx1998 - // namespace __debug __attribute__ ((strong)); inline namespace __debug { } }
Link- and run-time coexistence of release- and diff --git a/libstdc++-v3/doc/xml/manual/debug_mode.xml b/libstdc++-v3/doc/xml/manual/debug_mode.xml index ff2f1cc..9e97a1d 100644 --- a/libstdc++-v3/doc/xml/manual/debug_mode.xml +++ b/libstdc++-v3/doc/xml/manual/debug_mode.xml @@ -656,7 +656,6 @@ namespace std }; } // namespace __cxx1998 - // namespace __debug __attribute__ ((strong)); inline namespace __debug { } }