]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
<string.h>: Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232]
authorKamlesh Kumar <kamleshbhalui@gmail.com>
Thu, 5 Dec 2019 15:55:19 +0000 (16:55 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 5 Dec 2019 15:55:19 +0000 (16:55 +0100)
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
string/string.h

diff --git a/NEWS b/NEWS
index 42cf8a780fa07aa72d8fd766ad11fdcf3716eb69..2df50c1da4f5170a8e1c7920bfa1b54bec4c4178 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,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++
 
 Security related changes:
 
index c38eea971f4396c678598f51602082318ec5349d..608ed496b99272f7668165ef6379fa7e242a5bc8 100644 (file)
@@ -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