From: Florian Weimer <fweimer@redhat.com>
To: libc-stable@sourceware.org
Subject: [2.30 COMMITTED] Don't use a custom wrapper macro around __has_include (bug 25189).
Date: Tue, 01 Jan 2019 00:00:00 -0000 [thread overview]
Message-ID: <20191122123222.DD0B383BF6F6@oldenburg2.str.redhat.com> (raw)
From: Emilio Cobos Álvarez <emilio@crisal.io>
This causes issues when using clang with -frewrite-includes to e.g.,
submit the translation unit to a distributed compiler.
In my case, I was building Firefox using sccache.
See [1] for a reduced test-case since I initially thought this was a
clang bug, and [2] for more context.
Apparently doing this is invalid C++ per [cpp.cond], which mentions [3]:
> The #ifdef and #ifndef directives, and the defined conditional
> inclusion operator, shall treat __has_include and __has_cpp_attribute
> as if they were the names of defined macros. The identifiers
> __has_include and __has_cpp_attribute shall not appear in any context
> not mentioned in this subclause.
[1]: https://bugs.llvm.org/show_bug.cgi?id=43982
[2]: https://bugs.llvm.org/show_bug.cgi?id=37990
[3]: http://eel.is/c++draft/cpp.cond#7.sentence-2
Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60
(cherry picked from commit bfa864e1645e140da2e1aae3cf0d0ba0674f6eb5)
diff --git a/NEWS b/NEWS
index 5f1ade1c49..c7dcb54bb2 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ The following bugs are resolved with this release:
[24867] malloc: Remove unwanted leading whitespace in malloc_info
[24986] alpha: new getegid, geteuid and getppid syscalls used
unconditionally
+ [25189] Don't use a custom wrapper macro around __has_include
\f
Version 2.30
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f1bd994a10..b1695376dc 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -412,14 +412,6 @@
# define __glibc_has_attribute(attr) 0
#endif
-#ifdef __has_include
-/* Do not use a function-like macro, so that __has_include can inhibit
- macro expansion. */
-# define __glibc_has_include __has_include
-#else
-# define __glibc_has_include(header) 0
-#endif
-
#if (!defined _Noreturn \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
&& !__GNUC_PREREQ (4,7))
diff --git a/sysdeps/unix/sysv/linux/bits/statx.h b/sysdeps/unix/sysv/linux/bits/statx.h
index 206878723f..aaccfdc2dc 100644
--- a/sysdeps/unix/sysv/linux/bits/statx.h
+++ b/sysdeps/unix/sysv/linux/bits/statx.h
@@ -26,11 +26,13 @@
/* 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
+#ifdef __has_include
+# if __has_include ("linux/stat.h")
+# include "linux/stat.h"
+# ifdef STATX_TYPE
+# define __statx_timestamp_defined 1
+# define __statx_defined 1
+# endif
# endif
#endif
reply other threads:[~2019-11-22 12:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191122123222.DD0B383BF6F6@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-stable@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).