a2cf7d
commit 953ceff17a4a15b10cfdd5edc3c8cae4884c8ec3
a2cf7d
Author: Kamlesh Kumar <kamleshbhalui@gmail.com>
a2cf7d
Date:   Thu Dec 5 16:49:00 2019 +0100
a2cf7d
a2cf7d
    <string.h>: Define __CORRECT_ISO_CPP_STRING_H_PROTO for Clang [BZ #25232]
a2cf7d
    
a2cf7d
    Without the asm redirects, strchr et al. are not const-correct.
a2cf7d
    
a2cf7d
    libc++ has a wrapper header that works with and without
a2cf7d
    __CORRECT_ISO_CPP_STRING_H_PROTO (using a Clang extension).  But when
a2cf7d
    Clang is used with libstdc++ or just C headers, the overloaded functions
a2cf7d
    with the correct types are not declared.
a2cf7d
    
a2cf7d
    This change does not impact current GCC (with libstdc++ or libc++).
a2cf7d
a2cf7d
diff --git a/string/string.h b/string/string.h
a2cf7d
index 73c22a535a..faf997b972 100644
a2cf7d
--- a/string/string.h
a2cf7d
+++ b/string/string.h
a2cf7d
@@ -33,7 +33,8 @@ __BEGIN_DECLS
a2cf7d
 #include <stddef.h>
a2cf7d
 
a2cf7d
 /* Tell the caller that we provide correct C++ prototypes.  */
a2cf7d
-#if defined __cplusplus && __GNUC_PREREQ (4, 4)
a2cf7d
+#if defined __cplusplus && (__GNUC_PREREQ (4, 4) \
a2cf7d
+			    || __glibc_clang_prereq (3, 5))
a2cf7d
 # define __CORRECT_ISO_CPP_STRING_H_PROTO
a2cf7d
 #endif
a2cf7d