about summary refs log tree commit diff
path: root/string/string.h
diff options
context:
space:
mode:
authorKamlesh Kumar <kamleshbhalui@gmail.com>2019-12-05 16:49:00 +0100
committerDmitry V. Levin <ldv@altlinux.org>2020-11-16 08:00:00 +0000
commit26f5442ec185defe7a265e0d605c271f799101bf (patch)
treea79284da4df0ddc471b820360dd783589eb48d21 /string/string.h
parent4b64a4245c85cda5fbf4a40f6d949d0ed4ee566e (diff)
downloadglibc-26f5442ec185defe7a265e0d605c271f799101bf.tar.gz
glibc-26f5442ec185defe7a265e0d605c271f799101bf.tar.xz
glibc-26f5442ec185defe7a265e0d605c271f799101bf.zip
<string.h>: 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)
Diffstat (limited to 'string/string.h')
-rw-r--r--string/string.h3
1 files changed, 2 insertions, 1 deletions
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 <stddef.h>
 
 /* 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