077c9d
commit 48c3c1238925410b4e777dc94e2fde4cc9132d44
077c9d
Author: Florian Weimer <fweimer@redhat.com>
077c9d
Date:   Fri Jun 14 16:28:41 2019 +0200
077c9d
077c9d
    Linux: Fix __glibc_has_include use for <sys/stat.h> and statx
077c9d
    
077c9d
    The identifier linux is used as a predefined macro, so the actually
077c9d
    used path is 1/stat.h or 1/stat64.h.  Using the quote-based version
077c9d
    triggers a file lookup for /usr/include/bits/linux/stat.h (or whatever
077c9d
    directory is used to store bits/statx.h), but since bits/ is pretty
077c9d
    much reserved by glibc, this appears to be acceptable.
077c9d
    
077c9d
    This is related to GCC PR 80005: incorrect macro expansion of the
077c9d
    argument of __has_include.
077c9d
    
077c9d
    Suggested by Zack Weinberg.
077c9d
    
077c9d
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
077c9d
077c9d
diff --git a/sysdeps/unix/sysv/linux/bits/statx.h b/sysdeps/unix/sysv/linux/bits/statx.h
077c9d
index d36f44efc60a0bed..206878723fd37881 100644
077c9d
--- a/sysdeps/unix/sysv/linux/bits/statx.h
077c9d
+++ b/sysdeps/unix/sysv/linux/bits/statx.h
077c9d
@@ -23,8 +23,11 @@
077c9d
 #endif
077c9d
 
077c9d
 /* Use the Linux kernel header if available.  */
077c9d
-#if __glibc_has_include (<linux/stat.h>)
077c9d
-# include <linux/stat.h>
077c9d
+
077c9d
+/* Use "" to work around incorrect macro expansion of the
077c9d
+   __has_include argument (GCC PR 80005).  */
077c9d
+#if __glibc_has_include ("linux/stat.h")
077c9d
+# include "linux/stat.h"
077c9d
 # ifdef STATX_TYPE
077c9d
 #  define __statx_timestamp_defined 1
077c9d
 #  define __statx_defined 1