From patchwork Thu Nov 21 12:54:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36088 Received: (qmail 95537 invoked by alias); 21 Nov 2019 12:54:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 95525 invoked by uid 89); 21 Nov 2019 12:54:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy=lvarez, cdefs.h, UD:cdefs.h, HX-Languages-Length:2408 X-HELO: mx1.osci.io X-Gerrit-PatchSet: 1 Date: Thu, 21 Nov 2019 07:54:52 -0500 From: "Florian Weimer (Code Review)" To: libc-alpha@sourceware.org Cc: Florian Weimer Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] libc: Don't use a custom wrapper macro around __has_include. X-Gerrit-Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60 X-Gerrit-Change-Number: 697 X-Gerrit-ChangeURL: X-Gerrit-Commit: adf9d51a39309bf1d67bc1b239c1eaa4b117d566 References: Reply-To: fweimer@redhat.com, fweimer@redhat.com, libc-alpha@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/697 ...................................................................... libc: Don't use a custom wrapper macro around __has_include. 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 https://bugs.llvm.org/show_bug.cgi?id=43982 for a reduced test-case since I initially thought this was a clang bug. Apparently doing this is invalid C++ per: * http://eel.is/c++draft/cpp.cond#7.sentence-2 (See https://bugs.llvm.org/show_bug.cgi?id=37990) Signed-off-by: Emilio Cobos Álvarez Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60 --- M misc/sys/cdefs.h M sysdeps/unix/sysv/linux/bits/statx.h 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index abcb0d5..467dbd9 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 ff3f2e8..14d5992 100644 --- a/sysdeps/unix/sysv/linux/bits/statx.h +++ b/sysdeps/unix/sysv/linux/bits/statx.h @@ -26,12 +26,14 @@ /* 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 -# endif +#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 #include