This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
[glibc/release/2.30/master] <string.h>: Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232]
- From: Florian Weimer <fw at sourceware dot org>
- To: glibc-cvs at sourceware dot org
- Date: 5 Dec 2019 16:21:11 -0000
- Subject: [glibc/release/2.30/master] <string.h>: Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232]
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4719e1851cd1101e555f314497504a54ba3fb99a
commit 4719e1851cd1101e555f314497504a54ba3fb99a
Author: Kamlesh Kumar <kamleshbhalui@gmail.com>
Date: Thu Dec 5 16:54:47 2019 +0100
<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)
Diff:
---
NEWS | 1 +
string/string.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index a02fa10..74826b9 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ The following bugs are resolved with this release:
[25203] libio: Disable vtable validation for pre-2.1 interposed handles
[25204] Ignore LD_PREFER_MAP_32BIT_EXEC for SUID programs
[25225] ld.so fails to link on x86 if GCC defaults to -fcf-protection
+ [25232] No const correctness for strchr et al. for Clang++
Version 2.30
diff --git a/string/string.h b/string/string.h
index c38eea9..608ed49 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