This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] Define __CORRECT_ISO_CPP_STRING_H_PROTO correctly for Clang
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Brooks Moses <bmoses at google dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 28 Aug 2013 21:54:53 -0700
- Subject: Re: [patch] Define __CORRECT_ISO_CPP_STRING_H_PROTO correctly for Clang
- Authentication-results: sourceware.org; auth=none
- References: <CAOxa4Kqcbq-X871-kfNt4FDd1ae1ttSHj8fSBGEY3QqzcfaBCA at mail dot gmail dot com>
On Wed, Aug 28, 2013 at 5:38 PM, Brooks Moses <bmoses@google.com> 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.
>
> The attached patch thus adds the trivial change to make these headers
> work correctly with Clang. We've been carrying it locally for a
> while, but I'd rather have it upstream.
What about checking if __cplusplus >= the value for C++98 for non GCC compilers?
Thanks,
Andrew Pinski
>
> Ok for trunk?
>
> Thanks,
> - Brooks