From patchwork Wed Aug 23 17:35:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fran=C3=A7ois_Dumont?= X-Patchwork-Id: 74578 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AF1238768BB for ; Wed, 23 Aug 2023 17:35:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AF1238768BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692812156; bh=j40STO78eDZRO/CVDb3zfibUieKJWZLQ3TE1c4i87kg=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=oO+HRNFnbFjsmKybFCndoEMMPc9+TwN2xSRMxZsOGCdwUbT8OrhYD9+to02fMoWYV +O3Nup+YBOgO4H8/NdDqz2kp0cK2lfVHTFmDvR26YZ/pIImnkcfAvmC6XH1qIrBYpF WDSJdFw8apsCu3tZXJv0DvSGVS7H50FIVcXSW+Xg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id A79473858401; Wed, 23 Aug 2023 17:35:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A79473858401 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso780450866b.1; Wed, 23 Aug 2023 10:35:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692812124; x=1693416924; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j40STO78eDZRO/CVDb3zfibUieKJWZLQ3TE1c4i87kg=; b=Gopik/fjFnr9h1fFrx7NVLDJZbGVaue9xrrp5/1fHIO0qhQRtVfNycz7E2obZiP5OD tx8p/jzaJVJOnlsJ0MhKhdVrVhPKgkLkRHkhwszLgDmfjeNTfkNSsciVNLvX+Ufktsc2 UGVTe90MKkhD8neBsBxAsQ4mpG4fvl3hRpZYDjIGlVd8OjPQTy4hDJ9L3lPSztkwBujP gggCkM6l7GaGxtefHL4GF+Jyjr0mL71w8xCNS8TJx/wtQhInkPXZZK+fnvjoXrGtm+a6 JEJ9Uvuh91daItD/trmwtYCqH3K19+ezJxlMUeclKHqQ8STp/c9z/y610IU236N468nA 2KsQ== X-Gm-Message-State: AOJu0Yzr6CnGeaN3hw5u90kzo8WaexDDudmG4k5pCveRit92T6jjURyO np35tRZEynfEKUXWSTL7b6XgF/U7cPw= X-Google-Smtp-Source: AGHT+IE6yvBeIwNzW7pUoZiAdSC1tAFKW/bpQ0wVJpOR91m0Prky9cQVQfGR8dt2yFpYXBctjCAU3w== X-Received: by 2002:a17:906:7485:b0:9a1:c44d:7056 with SMTP id e5-20020a170906748500b009a1c44d7056mr4105716ejl.26.1692812123511; Wed, 23 Aug 2023 10:35:23 -0700 (PDT) Received: from [10.5.1.95] ([89.207.171.94]) by smtp.gmail.com with ESMTPSA id i6-20020a170906698600b009928b4e3b9fsm10000795ejr.114.2023.08.23.10.35.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Aug 2023 10:35:22 -0700 (PDT) Message-ID: Date: Wed, 23 Aug 2023 19:35:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: libstdc++ Cc: gcc-patches Subject: [PATCH][_GLIBCXX_INLINE_VERSION] Fix friend declarations X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Fran=C3=A7ois_Dumont_via_Gcc-patches?= From: =?utf-8?q?Fran=C3=A7ois_Dumont?= Reply-To: =?utf-8?q?Fran=C3=A7ois_Dumont?= Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi The few tests that are failing in versioned namespace mode are due to those friend declarations. This is a fix proposal even if I considered 2 other options: 1. Make __format::_Arg_store a struct and so do not bother with friend declarations. 2. Consider it as a compiler bug and do nothing. In this case I think we might still need this patch to avoid a non-working format library in versioned namespace mode in gcc 14 if compiler bug is not fixed. I can also define _GLIBCXX_STD_V at level to limit impact.     libstdc++: [_GLIBCXX_INLINE_VERSION] Fix friend declarations     GCC do not consider the inline namespace in friend declarations. We need     to explicit this namespace.     libstdc++-v3/ChangeLog:             * include/bits/c++config (_GLIBCXX_STD_V): New macro giving current             std namespace with optionally the version namespace.             * include/std/format (std::__format::_Arg_store): Use latter on friend             declarations. Tested under versioned mode. Ok to commit ? François diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 0a41cdd29a9..a917fb58225 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -449,6 +449,7 @@ _GLIBCXX_END_NAMESPACE_VERSION // of some nested namespace within it corresponding to the active mode. // _GLIBCXX_STD_A // _GLIBCXX_STD_C +// _GLIBCXX_STD_V // // Macros for opening/closing conditional namespaces. // _GLIBCXX_BEGIN_NAMESPACE_ALGO @@ -477,6 +478,12 @@ _GLIBCXX_END_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_ALGO #endif +#if _GLIBCXX_INLINE_VERSION +# define _GLIBCXX_STD_V std::__8 +#else +# define _GLIBCXX_STD_V std +#endif + // GLIBCXX_ABI Deprecated // Define if compatibility should be provided for -mlong-double-64. #undef _GLIBCXX_LONG_DOUBLE_COMPAT diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index f3d9ae152f9..94417c321e4 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -3429,11 +3429,11 @@ namespace __format template class __format::_Arg_store { - friend std::basic_format_args<_Context>; + friend _GLIBCXX_STD_V::basic_format_args<_Context>; template friend auto - std::make_format_args(_Argz&&...) noexcept; + _GLIBCXX_STD_V::make_format_args(_Argz&&...) noexcept; // For a sufficiently small number of arguments we only store values. // basic_format_args can get the types from the _Args pack.