From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7814) id 379D93856086; Wed, 25 May 2022 04:21:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 379D93856086 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Fangrui Song To: glibc-cvs@sourceware.org Subject: [glibc/google/grte/v5-2.27/master] : Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232] X-Act-Checkin: glibc X-Git-Author: Kamlesh Kumar X-Git-Refname: refs/heads/google/grte/v5-2.27/master X-Git-Oldrev: 20f6c924222f2677d9a53fa3b6c1ea76a1341840 X-Git-Newrev: 2fa202fdd10de62ca436d567f12ccc3e40f29476 Message-Id: <20220525042117.379D93856086@sourceware.org> Date: Wed, 25 May 2022 04:21:17 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2022 04:21:17 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2fa202fdd10de62ca436d567f12ccc3e40f29476 commit 2fa202fdd10de62ca436d567f12ccc3e40f29476 Author: Kamlesh Kumar Date: Thu Dec 5 16:49:00 2019 +0100 : Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232] 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) Diff: --- string/string.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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