[PATCH] D49067: Stop wrapping __has_include in another macro

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 23 17:18:38 PDT 2018


rsmith added inline comments.


================
Comment at: include/__config:153
+#ifndef __has_include
+#define __has_include(...) 0
 #endif
----------------
arichardson wrote:
> EricWF wrote:
> > I do prefer not hijacking this name, but if it's needed to make things work, then it's OK with me.
> > 
> > @mclow.lists Are you OK if we steal this identifier and `#define` it ourselves.
> This is the correct way of dealing with missing `__has_include()` according to @rsmith
If you would prefer to not define this name yourself, the other option would be to replace all uses of `__has_include(blah)` with

```
#ifdef __has_include
#if __has_include(blah)
//...
#endif
#endif
```


================
Comment at: include/__config:1062-1075
 #  if defined(__FreeBSD__) || \
       defined(__Fuchsia__) || \
       defined(__NetBSD__) || \
       defined(__linux__) || \
       defined(__APPLE__) || \
       defined(__CloudABI__) || \
       defined(__sun__) || \
----------------
Example:

```
#if defined(__MINGW32__) && defined(__has_include)
#if __has_include(<pthread.h>)
#define _LIBCPP_MINGW32_HAS_PTHREAD
#endif
#endif
#if defined(__FreeBSD__) || \
// [...]
    defined(__sun__) || \
    defined(_LIBCPP_MINGW32_HAS_PTHREAD)
```


Repository:
  rCXX libc++

https://reviews.llvm.org/D49067





More information about the cfe-commits mailing list