5f7b84
commit bfa864e1645e140da2e1aae3cf0d0ba0674f6eb5
5f7b84
Author: Emilio Cobos Álvarez <emilio@crisal.io>
5f7b84
Date:   Tue Nov 12 19:18:32 2019 +0100
5f7b84
5f7b84
    Don't use a custom wrapper macro around __has_include (bug 25189).
5f7b84
    
5f7b84
    This causes issues when using clang with -frewrite-includes to e.g.,
5f7b84
    submit the translation unit to a distributed compiler.
5f7b84
    
5f7b84
    In my case, I was building Firefox using sccache.
5f7b84
    
5f7b84
    See [1] for a reduced test-case since I initially thought this was a
5f7b84
    clang bug, and [2] for more context.
5f7b84
    
5f7b84
    Apparently doing this is invalid C++ per [cpp.cond], which mentions [3]:
5f7b84
    
5f7b84
    > The #ifdef and #ifndef directives, and the defined conditional
5f7b84
    > inclusion operator, shall treat __has_include and __has_cpp_attribute
5f7b84
    > as if they were the names of defined macros.  The identifiers
5f7b84
    > __has_include and __has_cpp_attribute shall not appear in any context
5f7b84
    > not mentioned in this subclause.
5f7b84
    
5f7b84
    [1]: https://bugs.llvm.org/show_bug.cgi?id=43982
5f7b84
    [2]: https://bugs.llvm.org/show_bug.cgi?id=37990
5f7b84
    [3]: http://eel.is/c++draft/cpp.cond#7.sentence-2
5f7b84
    
5f7b84
    Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60
5f7b84
5f7b84
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
5f7b84
index 9e840e602f815d86..3f6fe3cc8563b493 100644
5f7b84
--- a/misc/sys/cdefs.h
5f7b84
+++ b/misc/sys/cdefs.h
5f7b84
@@ -412,14 +412,6 @@
5f7b84
 # define __glibc_has_attribute(attr)	0
5f7b84
 #endif
5f7b84
 
5f7b84
-#ifdef __has_include
5f7b84
-/* Do not use a function-like macro, so that __has_include can inhibit
5f7b84
-   macro expansion.  */
5f7b84
-# define __glibc_has_include __has_include
5f7b84
-#else
5f7b84
-# define __glibc_has_include(header)	0
5f7b84
-#endif
5f7b84
-
5f7b84
 #if (!defined _Noreturn \
5f7b84
      && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
5f7b84
      &&  !__GNUC_PREREQ (4,7))
5f7b84
diff --git a/sysdeps/unix/sysv/linux/bits/statx.h b/sysdeps/unix/sysv/linux/bits/statx.h
5f7b84
index 206878723fd37881..aaccfdc2dc03a1dc 100644
5f7b84
--- a/sysdeps/unix/sysv/linux/bits/statx.h
5f7b84
+++ b/sysdeps/unix/sysv/linux/bits/statx.h
5f7b84
@@ -26,11 +26,13 @@
5f7b84
 
5f7b84
 /* Use "" to work around incorrect macro expansion of the
5f7b84
    __has_include argument (GCC PR 80005).  */
5f7b84
-#if __glibc_has_include ("linux/stat.h")
5f7b84
-# include "linux/stat.h"
5f7b84
-# ifdef STATX_TYPE
5f7b84
-#  define __statx_timestamp_defined 1
5f7b84
-#  define __statx_defined 1
5f7b84
+#ifdef __has_include
5f7b84
+# if __has_include ("linux/stat.h")
5f7b84
+#  include "linux/stat.h"
5f7b84
+#  ifdef STATX_TYPE
5f7b84
+#   define __statx_timestamp_defined 1
5f7b84
+#   define __statx_defined 1
5f7b84
+#  endif
5f7b84
 # endif
5f7b84
 #endif
5f7b84