diff options
author | Kamlesh Kumar <kamleshbhalui@gmail.com> | 2019-12-05 16:56:04 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2019-12-05 16:56:04 +0100 |
commit | ef0051070f820dd5c83a73c0f069cfc4fb373db8 (patch) | |
tree | 105eea2de200fbde17fef8dd0ae9c17a638a5db3 | |
parent | 9f917f7b411c307c34eb1bae85d72ffe26167523 (diff) | |
download | glibc-ef0051070f820dd5c83a73c0f069cfc4fb373db8.tar.gz glibc-ef0051070f820dd5c83a73c0f069cfc4fb373db8.tar.xz glibc-ef0051070f820dd5c83a73c0f069cfc4fb373db8.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)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | string/string.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/NEWS b/NEWS index d488f14ae5..ace1b86fdb 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,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: 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 |