The asm redirect magic is currently restricted to GCC versions with sufficiently new libstdc++: /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && __GNUC_PREREQ (4, 4) # define __CORRECT_ISO_CPP_STRING_H_PROTO #endif Clang supports asm redirects and could use this facility as well, at least with libstdc++. Mailing list discussion: https://sourceware.org/ml/libc-alpha/2019-11/msg00996.html
The master branch has been updated by Florian Weimer <fw@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=953ceff17a4a15b10cfdd5edc3c8cae4884c8ec3 commit 953ceff17a4a15b10cfdd5edc3c8cae4884c8ec3 Author: Kamlesh Kumar <kamleshbhalui@gmail.com> Date: Thu Dec 5 16:49:00 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++).
Fixed for glibc 2.31.
The release/2.28/master branch has been updated by Florian Weimer <fw@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ef0051070f820dd5c83a73c0f069cfc4fb373db8 commit ef0051070f820dd5c83a73c0f069cfc4fb373db8 Author: Kamlesh Kumar <kamleshbhalui@gmail.com> Date: Thu Dec 5 16:56:04 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)
The release/2.29/master branch has been updated by Florian Weimer <fw@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=42786ee476baa05c78e2ed8de8321e789e08ae09 commit 42786ee476baa05c78e2ed8de8321e789e08ae09 Author: Kamlesh Kumar <kamleshbhalui@gmail.com> Date: Thu Dec 5 16:55:19 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)
The release/2.30/master branch has been updated by Florian Weimer <fw@sourceware.org>: 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)