From patchwork Fri Aug 27 17:50:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 44800 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC3653857C71 for ; Fri, 27 Aug 2021 17:51:25 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id B18B63858C60 for ; Fri, 27 Aug 2021 17:50:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B18B63858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: VCwoegiYvkMQNdZyynMcfIP3BArsUuMSrwfnMKrq0Sa6n8EQUpMsSe55rTK3/PO8G3XPQzFbiP HTnOjvlzkPKz02r2O1uj2TZxu0kKvGowGUUQUMO+SJG1e0q5byLh/BW6WJrkiDTQiLKIkjpb7M El04+G6edS/FOeU0OSKZ5tKWVPg8oN1pp9BO9u5DuYXU6AnrUOQGVjDvqjCUxt59V2tpWXLeMR PDItKb8Iz9f2lBlOSCmoZUB5tHOdJoGIZ2MxaDvekzWt0yh6FnxNIKpVrFC0N5zBkngKjuaR2v xPIdmTFzOf4T3tp01Frpu1kf X-IronPort-AV: E=Sophos;i="5.84,357,1620720000"; d="scan'208";a="67703903" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 27 Aug 2021 09:51:00 -0800 IronPort-SDR: 6SZ3AN/ZmYQPUe+DuP3YuTZGMJ4qtQC/H1gcAR7WekYaDBsaYZrGS7wtGdjCYAjaTTeqMpEx21 CNQyAH6JUqwh5k3HKrbneCrS590KxvMAxh0pES5rguachgjffbuASJ4b8KDbnxUYI+WLlZKUi6 LKNcLdW7wnTV4STYmlJU5APNpwCNRTGahJWGIS1Eg4cmwTLGX4URMaVJMCGa49oizV7W/KuZJ0 rQMN4+rDPAPOgEGaWgE5KIplqYj+KqlI6dQdZ3cnhPOpOmGQAh4bzS0bw76Of+/dpZeJRMxLPx bF0= Date: Fri, 27 Aug 2021 17:50:52 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Martin Sebor Subject: Allow #pragma GCC in headers in conformtest [committed] (was: Re: [PATCH v3] remove attribute access from regexec) In-Reply-To: <9b9247b6-2839-906b-3ed1-acf3651c178f@gmail.com> Message-ID: References: <15a32181-8060-4135-cb72-9e79831697d5@gmail.com> <4251e9f2-d4d1-b649-8e86-a4336164a5b1@cs.ucla.edu> <1024a9e9-a880-7da2-7b99-3e8b8012a94a@cs.ucla.edu> <3e8fa13e-14e4-0e98-18e2-952cf5e9c278@cs.ucla.edu> <7e615633-ef4e-87b7-2808-8042a565911d@gmail.com> <745a8432-57b9-134b-7024-c7ddbe9bc1da@cs.ucla.edu> <21f69be8-e594-97a0-a7fe-2d6d16cd7011@cs.ucla.edu> <9b9247b6-2839-906b-3ed1-acf3651c178f@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3124.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: GNU C Library Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" No "#pragma GCC" pragma allows macro-expansion of its arguments, so no namespace issues arise from use of such pragmas in installed headers. Ignore them in conformtest tests of header namespace. Tested for x86_64, in conjunction with Paul's patch adding use of such pragmas to installed headers shared with gnulib. --- On Fri, 27 Aug 2021, Martin Sebor via Libc-alpha wrote: > I'm guessing it's due to a limitation of the conformance test script > that considers the GCC diagnostic pragmas unsafe to use because they > are in the user-namespace (even though they're not subject to macro > expansion). I'm still not sure I understand why the #pragma is > needed since -Wvla shouldn't trigger in a system header. That conform test issue should be fixed by this (committed) patch (which makes sense independent of whether we actually add such pragmas to any installed headers, given that use of #pragma GCC there is indeed namespace-safe). diff --git a/conform/conformtest.py b/conform/conformtest.py index f0405b7186..b0ec8e7ed1 100644 --- a/conform/conformtest.py +++ b/conform/conformtest.py @@ -624,6 +624,14 @@ class HeaderTests(object): continue if re.match(r'# [1-9]', line): continue + if line.startswith('#pragma GCC '): + # No GCC pragma uses macro expansion, so no + # namespace issues arise from such pragmas. (Some + # pragmas not in the GCC namespace do macro-expand + # their arguments and so could be affected by + # macros defined by user code including the + # header.) + continue match = re.match(r'#define (.*)', line) if match: self.check_token(bad_tokens, match.group(1))