From patchwork Thu Nov 21 15:32:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Adhemerval Zanella (Code Review)" X-Patchwork-Id: 1199003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-107255-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gnutoolchain-gerrit.osci.io Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="QZQ3uigg"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Jk8v0V2Yz9sR4 for ; Fri, 22 Nov 2019 02:33:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:in-reply-to:references :reply-to:mime-version:content-transfer-encoding:content-type :message-id; q=dns; s=default; b=ZKXbip1WNWwOG1vdMNPzHfnq9oxCO4l qQHSQkBiYz8+tY+8ASlEAMDI50wnyrpx+HINcNoqL97EMqx9leziQjlsC9isQt9r kPukDGpzc/B/Zwe8mPNvRsJCvr7x7PHzGjJyBMEKpeTffs9en6I4PMayA2IF2p7O eIsp2CVfOOxA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:in-reply-to:references :reply-to:mime-version:content-transfer-encoding:content-type :message-id; s=default; bh=jtFrSylRWIyVGwM556etlqK5QGQ=; b=QZQ3u iggg4btTldO51ue8SJGnDhqjoTFt5SYNPki/vu+Wibiv3Joz+SHitH0xQnD4iOwj nHwtyrSK/Sdtc7mJI3EsgYPQOQhBLEsZbv4lrWZ4qmL2Is0He3/PWbBKO9tBxxTS ++X6JGS3ngYsT9FMzSpNyTGglD8i8Mg33q5geg= Received: (qmail 28877 invoked by alias); 21 Nov 2019 15:32:56 -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 28869 invoked by uid 89); 21 Nov 2019 15:32:55 -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= X-HELO: mx1.osci.io X-Gerrit-PatchSet: 3 Date: Thu, 21 Nov 2019 10:32:48 -0500 From: =?utf-8?q?Emilio_Cobos_=C3=81lvarez_=28Code_Review=29?= To: Florian Weimer , Florian Weimer , libc-alpha@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset Subject: [review v3] Don't use a custom wrapper macro around __has_include (bug 25189). X-Gerrit-Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60 X-Gerrit-Change-Number: 697 X-Gerrit-ChangeURL: X-Gerrit-Commit: 3d8e273c542c83ae0bdd60c5e1a04ee06ade7379 In-Reply-To: References: Reply-To: emilio@crisal.io, fweimer@redhat.com, libc-alpha@sourceware.org, fw@deneb.enyo.de MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191121153248.B7B652816F@gnutoolchain-gerrit.osci.io> The original change was created by Florian Weimer. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/697 ...................................................................... Don't use a custom wrapper macro around __has_include (bug 25189). 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 --- M misc/sys/cdefs.h M sysdeps/unix/sysv/linux/bits/statx.h 2 files changed, 7 insertions(+), 13 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..2015c82 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