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