[patch] Define __CORRECT_ISO_CPP_STRING_H_PROTO correctly for Clang
Joseph S. Myers
joseph@codesourcery.com
Thu Aug 29 12:18:00 GMT 2013
On Wed, 28 Aug 2013, Brooks Moses wrote:
> In the string/string.h and string/strings.h headers, we have a couple
> of macros that "tell the caller that we provide correct C++
> prototypes" according to the comment; they are used to determine
> whether to wrap some prototypes in "extern "C++"" (and provide
> multiple overloads of them, and some other magic) when __cplusplus is
> defined.
>
> The macros are set to check for sufficiently-recent GCC versions (4.4
> and later), but this is not the right check for non-GCC compilers. In
> particular, these macros should also be set when using Clang -- if
> they are not set, then Clang will be unable to correctly diagnose a
> number of subtle bugs that will be errors in GCC compilations.
What's the logic behind the GCC version check in the first place? Is it
about compiler (language) features, or about corresponding support in the
standard C++ library? If the former, do you need a Clang version check?
If the latter, do you need a check on what version of libstdc++ or libc++
might be used with Clang?
Does any C++ library use these macros, or are they purely used within
glibc to determine what glibc's own headers declare?
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list