From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lxmtout2.gsi.de (lxmtout2.gsi.de [140.181.3.112]) by sourceware.org (Postfix) with ESMTPS id 7086B3858003; Mon, 15 Nov 2021 17:05:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7086B3858003 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gsi.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gsi.de Received: from localhost (localhost [127.0.0.1]) by lxmtout2.gsi.de (Postfix) with ESMTP id 8C18B2038F77; Mon, 15 Nov 2021 18:05:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lxmtout2.gsi.de Received: from lxmtout2.gsi.de ([127.0.0.1]) by localhost (lxmtout2.gsi.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id t1FRIes7_akN; Mon, 15 Nov 2021 18:05:21 +0100 (CET) Received: from srvex3.campus.gsi.de (unknown [10.10.4.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by lxmtout2.gsi.de (Postfix) with ESMTPS id 70E242038F62; Mon, 15 Nov 2021 18:05:21 +0100 (CET) Received: from excalibur.localnet (140.181.3.12) by srvex3.campus.gsi.de (10.10.4.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Mon, 15 Nov 2021 18:05:21 +0100 From: Matthias Kretz To: , Subject: [PATCH 1/2] libstdc++: Use diagnose_as attribute to improve string diagnostics Date: Mon, 15 Nov 2021 18:05:20 +0100 Message-ID: <1919124.eP8hAHRRDn@excalibur> Organization: GSI Helmholtzzentrum =?UTF-8?B?ZsO8cg==?= Schwerionenforschung In-Reply-To: <1849892.9kXth2LyAg@excalibur> References: <1849892.9kXth2LyAg@excalibur> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3592170.znU0eCzeS4" Content-Transfer-Encoding: 7Bit X-Originating-IP: [140.181.3.12] X-ClientProxiedBy: srvex4.Campus.gsi.de (10.10.4.36) To srvex3.campus.gsi.de (10.10.4.16) X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H2, SPF_PASS, TXREP, T_SPF_HELO_PERMERROR autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2021 17:05:25 -0000 --nextPart3592170.znU0eCzeS4 Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="UTF-8" CgpUaGlzIGhpZGVzIHRoZSBiYXNpY19zdHJpbmcgdGVtcGxhdGUgaW4gYWxsIGRpYWdub3N0aWNz LCByZWR1Y2luZyB0aGUKc2lnbmFsLXRvLW5vaXNlIHJhdGlvIHNpZ25pZmljYW50bHkuIEl0IGFs c28gaGlkZXMgdGhlIHN0ZDo6X19jeHgxMQpuYW1lc3BhY2UgZnJvbSB1c2VycyBieSBwcmVzZW50 aW5nIGl0IGFzIHN0ZC4KClNpZ25lZC1vZmYtYnk6IE1hdHRoaWFzIEtyZXR6IDxtLmtyZXR6QGdz aS5kZT4KCmxpYnN0ZGMrKy12My9DaGFuZ2VMb2c6CgoJUFIgYysrLzg5MzcwCgkqIGluY2x1ZGUv Yml0cy9jKytjb25maWc6IERpYWdub3NlIHN0ZDo6X19jeHgxMTo6IGFzIHN0ZDo6IHVzaW5nCgl0 aGUgZGlhZ25vc2VfYXMgYXR0cmlidXRlLgoJKiBpbmNsdWRlL2JpdHMvc3RyaW5nZndkLmg6IEFk ZCBkaWFnbm9zZV9hcyBhdHRyaWJ1dGUgdG8gc3RyaW5nLAoJd3N0cmlu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Bmb3IgSGVhdnkg SW9uIFJlc2VhcmNoICAgICAgICAgICAgICAgaHR0cHM6Ly9nc2kuZGUKIHN0ZOKCkzo6c2ltZAri lIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDi lIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDi lIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDi lIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIDilIA= --nextPart3592170.znU0eCzeS4 Content-Disposition: inline; filename="0001-libstdc-Use-diagnose_as-attribute-to-improve-string-.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="0001-libstdc-Use-diagnose_as-attribute-to-improve-string-.patch" diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index a6495809671..02d11afc1aa 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -318,7 +318,8 @@ namespace std #if _GLIBCXX_USE_CXX11_ABI namespace std { - inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } + inline namespace __cxx11 + __attribute__((__abi_tag__ ("cxx11"), __diagnose_as__("std"))) { } } namespace __gnu_cxx { diff --git a/libstdc++-v3/include/bits/stringfwd.h b/libstdc++-v3/include/bits/stringfwd.h index bcfd350e505..3f653feae14 100644 --- a/libstdc++-v3/include/bits/stringfwd.h +++ b/libstdc++-v3/include/bits/stringfwd.h @@ -74,22 +74,22 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 /// A string of @c char - typedef basic_string string; + typedef basic_string string __attribute__((__diagnose_as__)); /// A string of @c wchar_t - typedef basic_string wstring; + typedef basic_string wstring __attribute__((__diagnose_as__)); #ifdef _GLIBCXX_USE_CHAR8_T /// A string of @c char8_t - typedef basic_string u8string; + typedef basic_string u8string __attribute__((__diagnose_as__)); #endif #if __cplusplus >= 201103L /// A string of @c char16_t - typedef basic_string u16string; + typedef basic_string u16string __attribute__((__diagnose_as__)); /// A string of @c char32_t - typedef basic_string u32string; + typedef basic_string u32string __attribute__((__diagnose_as__)); #endif /** @} */ diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string index a8389528001..d6299e5552f 100644 --- a/libstdc++-v3/include/debug/string +++ b/libstdc++-v3/include/debug/string @@ -1296,21 +1296,21 @@ namespace __gnu_debug return __res; } - typedef basic_string string; + typedef basic_string string __attribute__((__diagnose_as__)); - typedef basic_string wstring; + typedef basic_string wstring __attribute__((__diagnose_as__)); #ifdef _GLIBCXX_USE_CHAR8_T /// A string of @c char8_t - typedef basic_string u8string; + typedef basic_string u8string __attribute__((__diagnose_as__)); #endif #if __cplusplus >= 201103L /// A string of @c char16_t - typedef basic_string u16string; + typedef basic_string u16string __attribute__((__diagnose_as__)); /// A string of @c char32_t - typedef basic_string u32string; + typedef basic_string u32string __attribute__((__diagnose_as__)); #endif template diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string index 4d92a7e39cc..91a9dd8b164 100644 --- a/libstdc++-v3/include/experimental/string +++ b/libstdc++-v3/include/experimental/string @@ -73,13 +73,13 @@ inline namespace fundamentals_v2 // basic_string typedef names using polymorphic allocator in namespace // std::experimental::pmr - typedef basic_string string; + typedef basic_string string __attribute__((__diagnose_as__)); #ifdef _GLIBCXX_USE_CHAR8_T - typedef basic_string u8string; + typedef basic_string u8string __attribute__((__diagnose_as__)); #endif - typedef basic_string u16string; - typedef basic_string u32string; - typedef basic_string wstring; + typedef basic_string u16string __attribute__((__diagnose_as__)); + typedef basic_string u32string __attribute__((__diagnose_as__)); + typedef basic_string wstring __attribute__((__diagnose_as__)); } // namespace pmr #endif diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string index af840e887d5..03a3c68050f 100644 --- a/libstdc++-v3/include/std/string +++ b/libstdc++-v3/include/std/string @@ -62,13 +62,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template> using basic_string = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; - using string = basic_string; + using string [[__gnu__::__diagnose_as__]] = basic_string; #ifdef _GLIBCXX_USE_CHAR8_T - using u8string = basic_string; + using u8string [[__gnu__::__diagnose_as__]] = basic_string; #endif - using u16string = basic_string; - using u32string = basic_string; - using wstring = basic_string; + using u16string [[__gnu__::__diagnose_as__]] = basic_string; + using u32string [[__gnu__::__diagnose_as__]] = basic_string; + using wstring [[__gnu__::__diagnose_as__]] = basic_string; } // namespace pmr template --nextPart3592170.znU0eCzeS4--