[cfe-dev] Clang++ always defines _GNU_SOURCE

Eric Fiselier via cfe-dev cfe-dev at lists.llvm.org
Tue Jun 14 01:54:12 PDT 2016


>  Does libc++ also rely on this macro to work on Linux?

Yes. Adding -U_GNU_SOURCE during the libc++ build results in a litany of
errors.
The libc++ headers depend on a number of C library symbols that only get
defined when -D_GNU_SOURCE=1 is present.

/Eric

On Tue, Jun 14, 2016 at 2:40 AM, Lei Zhang via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi,
>
> I noticed that clang++ unconditionally defines _GNU_SOURCE on Linux,
> even when I'm not including any headers in my code. Switching from
> stdlibc++ to libc++ doesn't change this, either.
>
> I understand that g++ does this because stdlibc++ heavily relies on
> _GNU_SOURCE. But what is the reason for clang++ to do so when using
> libc++? Does libc++ also rely on this macro to work on Linux?
>
>
> Regards,
> Lei
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160614/72a172bd/attachment.html>


More information about the cfe-dev mailing list