From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67747 invoked by alias); 11 Dec 2019 20:26:04 -0000 Mailing-List: contact libstdc++-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libstdc++-owner@gcc.gnu.org Received: (qmail 67726 invoked by uid 89); 11 Dec 2019 20:26:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=17_intro, stl_algobaseh, stl_algobase.h, UD:stl_algobase.h X-HELO: mail-wr1-f65.google.com Received: from mail-wr1-f65.google.com (HELO mail-wr1-f65.google.com) (209.85.221.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Dec 2019 20:26:02 +0000 Received: by mail-wr1-f65.google.com with SMTP id j42so56260wrj.12; Wed, 11 Dec 2019 12:26:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=OFSI897TotJrPPNAihBDhB1YexUOnLYZPE8bFVCNBsM=; b=vXfzNAfb7XKX6Xpamhtc3GBGX2lqI906Iqrkng+F4lAw64hL5KjTWARL/UKCnCvfE6 UJuQqmLOTkecfFv0hDiYnssBiimCti9Wc5WX+LOoV4GcFCdXK8xUNdpcO5VZ7XfXgf5N oCvsJ6qQJcF8CHABVMdxiMmOd8fFhqKaH0umJXhlKxeTv37ax5k3JFitQntl9ju3oX4j fzuTQCp3FKUmlJeS13XdHNsLl0LoVJ6wYf3x2QT9u/F4mKtVACnLCM88T/rEnzhd3FM7 WMlAsWwuaZN9aDb0zI5XV15Pt3inDo1tQtyD0pne1t9pJu5xrk+ZbOZKqHyczQyAQi2w HvHA== Return-Path: Received: from ?IPv6:2a01:e0a:1dc:b1c0:50b6:f57e:fe65:5305? ([2a01:e0a:1dc:b1c0:50b6:f57e:fe65:5305]) by smtp.googlemail.com with ESMTPSA id w20sm3513689wmk.34.2019.12.11.12.25.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2019 12:25:58 -0800 (PST) From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= Subject: [PATCH] Fix gnu-versioned-namespace tr1 declaration To: Jonathan Wakely Cc: "libstdc++@gcc.gnu.org" , gcc-patches References: <16fe9ee4-310a-d8d1-d581-4afdf4590d9a@gmail.com> <20191211111639.GV11522@redhat.com> <20191211112242.GW11522@redhat.com> Message-ID: Date: Wed, 11 Dec 2019 20:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20191211112242.GW11522@redhat.com> Content-Type: multipart/mixed; boundary="------------EFA0396BA2F960978E27D973" X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00052.txt.bz2 This is a multi-part message in MIME format. --------------EFA0396BA2F960978E27D973 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-length: 5395 On 12/11/19 12:22 PM, Jonathan Wakely wrote: > On 11/12/19 11:16 +0000, Jonathan Wakely wrote: >> On 11/12/19 08:29 +0100, François Dumont wrote: >>> I plan to commit this tomorrow. >>> >>> Note that rather than just adding the missing >>> _GLIBCXX_[BEGIN,END]_VERSION_NAMESPACE I also move anonymous >>> namespace usage outside std namespace. Let me know if it was >>> intentional. >> >> It was intentional, why move it? >> >> Adding the BEGIN/END_VERSION macros is unnecessary. Those namespaces >> are inline, so std::random_device already refers to >> std::__8::random_device when the original declaration was in the >> versioned namespace. >> >> The only fix needed here seems to be qualifying std::isdigit (and >> strictly-speaking we should also include to declare that). > > I was curious why that qualification is needed. Th problem is that > is being indirectly included by some other header, and so is > , so the declarations visible are ::isdigit(int) and > std::__8::isdigit(CharT, const locale&). Even after including > we still can't call it unqualified, because doesn't > use the versioned namespace: Yes, this is the other patch I wanted to propose. Make sure that tr1 namespace is always defined consistently with the version namespace. For instance 17_intro/headers/c++2011/parallel_mode.cc is failing at the moment with: /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/gamma.tcc:292: error: reference to 'tr1' is ambiguous In file included from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/random:45,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/random_number.h:36,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/partition.h:38,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/quicksort.h:36,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/sort.h:48,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/algo.h:45,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/algorithm:37,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/algorithm:80,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/stdc++.h:65,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/extc++.h:32,                  from /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/17_intro/headers/c++2011/parallel_mode.cc:24: /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/type_traits:40: note: candidates are: 'namespace std::__8::tr1 { }' In file included from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/types.h:37,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/parallel.h:38,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/base.h:40,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/parallel/algobase.h:40,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:2071,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:39,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/ios:40,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/istream:38,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/sstream:38,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/complex:45,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/ccomplex:39,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/stdc++.h:54,                  from /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/extc++.h:32,                  from /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/17_intro/headers/c++2011/parallel_mode.cc:24: /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/cstdint:61: note:                 'namespace std::tr1 { }' Tested under Linux x86_64 normal and versioned namespace. Ok to commit ? François --------------EFA0396BA2F960978E27D973 Content-Type: text/x-patch; charset=UTF-8; name="versioned_tr1_namespace.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="versioned_tr1_namespace.patch" Content-length: 3732 diff --git a/libstdc++-v3/include/tr1/cctype b/libstdc++-v3/include/tr1/cctype index ce994066188..b35cd04f0db 100644 --- a/libstdc++-v3/include/tr1/cctype +++ b/libstdc++-v3/include/tr1/cctype @@ -38,10 +38,14 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace tr1 { using ::isblank; } + +_GLIBCXX_END_NAMESPACE_VERSION } #endif diff --git a/libstdc++-v3/include/tr1/cfenv b/libstdc++-v3/include/tr1/cfenv index a058888978f..97de7542f5b 100644 --- a/libstdc++-v3/include/tr1/cfenv +++ b/libstdc++-v3/include/tr1/cfenv @@ -53,6 +53,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace tr1 { // types @@ -74,6 +76,8 @@ namespace tr1 using ::fesetenv; using ::feupdateenv; } + +_GLIBCXX_END_NAMESPACE_VERSION } #endif // _GLIBCXX_USE_C99_FENV_TR1 diff --git a/libstdc++-v3/include/tr1/cinttypes b/libstdc++-v3/include/tr1/cinttypes index e665e188289..1c08166efdc 100644 --- a/libstdc++-v3/include/tr1/cinttypes +++ b/libstdc++-v3/include/tr1/cinttypes @@ -50,6 +50,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace tr1 { // types @@ -77,6 +79,8 @@ namespace tr1 using ::wcstoumax; #endif } + +_GLIBCXX_END_NAMESPACE_VERSION } #endif // _GLIBCXX_USE_C99_INTTYPES_TR1 diff --git a/libstdc++-v3/include/tr1/cstdint b/libstdc++-v3/include/tr1/cstdint index 0597d19fb1b..3211a9690f8 100644 --- a/libstdc++-v3/include/tr1/cstdint +++ b/libstdc++-v3/include/tr1/cstdint @@ -58,6 +58,7 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION namespace tr1 { using ::int8_t; @@ -96,6 +97,7 @@ namespace tr1 using ::uintmax_t; using ::uintptr_t; } +_GLIBCXX_END_NAMESPACE_VERSION } #endif // _GLIBCXX_USE_C99_STDINT_TR1 diff --git a/libstdc++-v3/include/tr1/cstdio b/libstdc++-v3/include/tr1/cstdio index 7d72e58b5d4..f8a9182bcaa 100644 --- a/libstdc++-v3/include/tr1/cstdio +++ b/libstdc++-v3/include/tr1/cstdio @@ -37,6 +37,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace tr1 { using std::snprintf; @@ -46,6 +48,8 @@ namespace tr1 using std::vscanf; using std::vsscanf; } + +_GLIBCXX_END_NAMESPACE_VERSION } #endif diff --git a/libstdc++-v3/include/tr1/cstdlib b/libstdc++-v3/include/tr1/cstdlib index a8259575ba2..0271e884436 100644 --- a/libstdc++-v3/include/tr1/cstdlib +++ b/libstdc++-v3/include/tr1/cstdlib @@ -39,6 +39,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace tr1 { #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC @@ -63,6 +65,8 @@ namespace tr1 using std::div; #endif } + +_GLIBCXX_END_NAMESPACE_VERSION } #endif // _GLIBCXX_USE_C99_STDLIB diff --git a/libstdc++-v3/include/tr1/cwchar b/libstdc++-v3/include/tr1/cwchar index 0d45ca79933..d2517f665f8 100644 --- a/libstdc++-v3/include/tr1/cwchar +++ b/libstdc++-v3/include/tr1/cwchar @@ -37,6 +37,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace tr1 { #if _GLIBCXX_HAVE_WCSTOF @@ -58,6 +60,8 @@ namespace tr1 using std::wcstoull; #endif } + +_GLIBCXX_END_NAMESPACE_VERSION } #endif // _GLIBCXX_USE_WCHAR_T diff --git a/libstdc++-v3/include/tr1/cwctype b/libstdc++-v3/include/tr1/cwctype index b5f2c2f07fc..5d343a11c6b 100644 --- a/libstdc++-v3/include/tr1/cwctype +++ b/libstdc++-v3/include/tr1/cwctype @@ -37,12 +37,16 @@ namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace tr1 { #if _GLIBCXX_HAVE_ISWBLANK using std::iswblank; #endif } + +_GLIBCXX_END_NAMESPACE_VERSION } #endif // _GLIBCXX_USE_WCHAR_T --------------EFA0396BA2F960978E27D973--