From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id AB1FA3983C7A for ; Mon, 16 Nov 2020 21:00:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AB1FA3983C7A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ldv@altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 26C5872C8B0 for ; Tue, 17 Nov 2020 00:00:29 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 1F81A7CC819; Tue, 17 Nov 2020 00:00:29 +0300 (MSK) Date: Tue, 17 Nov 2020 00:00:29 +0300 From: "Dmitry V. Levin" To: libc-stable@sourceware.org Subject: [2.27 COMMITTED] : Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232] Message-ID: <20201116210028.GB28063@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2020 21:00:30 -0000 From: Kamlesh Kumar Without the asm redirects, strchr et al. are not const-correct. libc++ has a wrapper header that works with and without __CORRECT_ISO_CPP_STRING_H_PROTO (using a Clang extension). But when Clang is used with libstdc++ or just C headers, the overloaded functions with the correct types are not declared. This change does not impact current GCC (with libstdc++ or libc++). (cherry picked from commit 953ceff17a4a15b10cfdd5edc3c8cae4884c8ec3) --- NEWS | 1 + string/string.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f426f29fe4..40c9e23d10 100644 --- a/NEWS +++ b/NEWS @@ -153,6 +153,7 @@ The following bugs are resolved with this release: [24744] io: Remove the copy_file_range emulation [25203] libio: Disable vtable validation for pre-2.1 interposed handles [25204] Ignore LD_PREFER_MAP_32BIT_EXEC for SUID programs + [25232] No const correctness for strchr et al. for Clang++ Version 2.27 diff --git a/string/string.h b/string/string.h index 150cfd8b13..22cd0fa08f 100644 --- a/string/string.h +++ b/string/string.h @@ -33,7 +33,8 @@ __BEGIN_DECLS #include /* Tell the caller that we provide correct C++ prototypes. */ -#if defined __cplusplus && __GNUC_PREREQ (4, 4) +#if defined __cplusplus && (__GNUC_PREREQ (4, 4) \ + || __glibc_clang_prereq (3, 5)) # define __CORRECT_ISO_CPP_STRING_H_PROTO #endif -- ldv