about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-06-14 16:28:41 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-06-14 16:28:41 +0200
commit48c3c1238925410b4e777dc94e2fde4cc9132d44 (patch)
tree47fe7ff3defaf090e7b6a37302bc1797613b0c59 /sysdeps
parent8d141877e07cc594e9fefc3795b8ba729288093c (diff)
downloadglibc-48c3c1238925410b4e777dc94e2fde4cc9132d44.tar.gz
glibc-48c3c1238925410b4e777dc94e2fde4cc9132d44.tar.xz
glibc-48c3c1238925410b4e777dc94e2fde4cc9132d44.zip
Linux: Fix __glibc_has_include use for <sys/stat.h> and statx
The identifier linux is used as a predefined macro, so the actually
used path is 1/stat.h or 1/stat64.h.  Using the quote-based version
triggers a file lookup for /usr/include/bits/linux/stat.h (or whatever
directory is used to store bits/statx.h), but since bits/ is pretty
much reserved by glibc, this appears to be acceptable.

This is related to GCC PR 80005: incorrect macro expansion of the
argument of __has_include.

Suggested by Zack Weinberg.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/bits/statx.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/bits/statx.h b/sysdeps/unix/sysv/linux/bits/statx.h
index d36f44efc6..206878723f 100644
--- a/sysdeps/unix/sysv/linux/bits/statx.h
+++ b/sysdeps/unix/sysv/linux/bits/statx.h
@@ -23,8 +23,11 @@
 #endif
 
 /* Use the Linux kernel header if available.  */
-#if __glibc_has_include (<linux/stat.h>)
-# include <linux/stat.h>
+
+/* Use "" to work around incorrect macro expansion of the
+   __has_include argument (GCC PR 80005).  */
+#if __glibc_has_include ("linux/stat.h")
+# include "linux/stat.h"
 # ifdef STATX_TYPE
 #  define __statx_timestamp_defined 1
 #  define __statx_defined 1