]> 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:49:00 +0000 (16:49 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 5 Dec 2019 15:50:00 +0000 (16:50 +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++).

string/string.h

index 73c22a535aa505d3b0b3a9b0b346971c147b1a1d..faf997b972e882d7c8bd7bc7b365ed9f1a20cb2f 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