[cfe-dev] Best way to detect libc++ at compile time?

Richard Smith richard at metafoo.co.uk
Sat Jul 21 17:43:40 PDT 2012


On Sat, Jul 21, 2012 at 1:56 PM, Joe Groff <arcata at gmail.com> wrote:

> On Sat, Jul 21, 2012 at 1:46 PM, Rich E <reakinator at gmail.com> wrote:
> > I was doing this for a while, but I decided it was cluttering up the
> > includes section since you also need a check for __clang__
>
> You can do something like this so you don't need to guard every single
> use of __has_include:
>
> #if !__clang__
> #define __has_include(x) 0
> #endif


The recommended approach is

#ifndef __has_include
#define __has_include(x) 0
#endif

This would work correctly both in the presence of versions of clang which
do not support __has_include, and for other compilers which do, but which
don't claim to be clang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120721/20b36d11/attachment.html>


More information about the cfe-dev mailing list