]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux: Fix __glibc_has_include use for <sys/stat.h> and statx
authorFlorian Weimer <fweimer@redhat.com>
Fri, 14 Jun 2019 14:28:41 +0000 (16:28 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 14 Jun 2019 14:28:41 +0000 (16:28 +0200)
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>
ChangeLog
sysdeps/unix/sysv/linux/bits/statx.h

index 4aae5e74f797a561577865091bfdaba6d0d72a2d..efd86e05ede341f6b8fe6ac9ee39a4ccf5e068dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-14  Florian Weimer  <fweimer@redhat.com>
+
+       * sysdeps/unix/sysv/linux/bits/statx.h: Use string literal in
+       argument to __glibc_has_include to inhibit macro expansion.
+
 2019-06-14  Florian Weimer  <fweimer@redhat.com>
 
        * misc/sys/cdefs.h (__glibc_has_include): Do not use a
index d36f44efc60a0bed998959cd4bde396b3e6b0dae..206878723fd37881378df0c657ae990a19282bde 100644 (file)
 #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