From: Kamlesh Kumar Date: Thu, 5 Dec 2019 15:49:00 +0000 (+0100) Subject: : Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232] X-Git-Tag: glibc-2.31~178 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=953ceff17a4a15b10cfdd5edc3c8cae4884c8ec3;p=thirdparty%2Fglibc.git : 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++). --- diff --git a/string/string.h b/string/string.h index 73c22a535aa..faf997b972e 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