From patchwork Tue Nov 7 09:19:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 162325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp111160vqo; Tue, 7 Nov 2023 01:19:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTqBUrsAKRCwB7JVKbnYlilLoqa4ulqXBAfL8rCbrq2dxRgn9B8khau61dKOEeq5qx+Zo2 X-Received: by 2002:a05:622a:287:b0:41c:b94a:98ac with SMTP id z7-20020a05622a028700b0041cb94a98acmr39164861qtw.57.1699348791455; Tue, 07 Nov 2023 01:19:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699348791; cv=pass; d=google.com; s=arc-20160816; b=sQ+FwJQ5TUMETXXz56f5XzSv7fMjW408T80ERZeW+UMFWCszn4pFPiPtG3oIcs/vQO 6YuarJ2tujsnyG2IH/67CCgx0/ghN724F352hSmx6ZOMNuVD6blh8hA/ZbCwR+BaElsF YNIShNOzka1UvnaVVwcAMSOzxv5nESJBoIz9MUN4K3gKPGAYiWhiEFVlrzZgewhF1Hn5 SLS13XoeS18xucDEwVbcRz0E5MJBYZfXhOl1Oq9JU6XCyhvATlbJ60Rsj+mTwseqBoZT hkloaNZ2moZuFTkP1R37f7j5QoFh7BvQVqKs+VXpEpvtiw3A1EgTof9NRukoeLfZgCoO H+Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=zA7r0L4MFhmNsA5bEnJxerb9d0EWrQZnkY2UdjNpyXo=; fh=V3FUX71dhq7uYqp2NU3QsSvdKCASDvtMIqKaZekiAR8=; b=Fu0YihYSNN4y6OKSBPDRDbqn33IDdFnoVmthrTpDN92PD0eeqxld97DOpfpOPP+2qc Sud2qFd+7RNisNJavwlCFE8aLba7debOsXPdHw8lJNRODyEKrbAJHv44tLkbbzQki0UU 2Xztp2QJO6yD3PdZCfIikeVCnY1gDu6xVB2Z0RUCMpV3EDYJPRNI3uBYMCLYeR+dD+X9 wThwfzmOprhqWB8uYd23cahn6tiufRn0XgYZiZDhq2NnXmUg9HECh3DN/OyqFWwGwTrf 4BAUsz+v5T15zFUILaF2N//+1OjHiwCrN25872OfVbU5Oc1DRIG3rTImgmDfsxDVGsqd umJw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=K76xBoE+; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i15-20020ac85c0f000000b004195aa3bc1dsi6978554qti.577.2023.11.07.01.19.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:51 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=K76xBoE+; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D79BC3857355 for ; Tue, 7 Nov 2023 09:19:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 76B913857725 for ; Tue, 7 Nov 2023 09:19:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76B913857725 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 76B913857725 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348755; cv=none; b=PUoZXMl9Ez1jdCS7mDPyIw/Zjw0AYDzyFPKJHMX0p1f7CkdkNzhLwU62IxZfrnNp+QYLRT8Zk0oU/MmCWLZacR7rM5cSryIoh/QjJinJz9O1zvzfh7TtZqx+ppdV2raAoA8VFaVskoVNfTYmbg8b9MYqTwGjNFNsI+lAxyn1vZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348755; c=relaxed/simple; bh=TEztLRR26O2gDdRG/gMx6Fbf+HaDV/tFvQhNJvLiUVI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PTiCuf3T1eVY4mAHwjIf5LjnHSfrn6q0KtFCnGKBNNUi2xw9FI4hedQupvFvHnm/jIojoIBfus8KQgkqILHcDXAMqzNrGdf2KNSXepd+wEVlFMUOli4sNNgzMDWmXOuguK3YD5XQNo4ti9r2nXUiC9dRis2S4Ke4ixUAIIu0QQ4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4083f61312eso41158195e9.3 for ; Tue, 07 Nov 2023 01:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348752; x=1699953552; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zA7r0L4MFhmNsA5bEnJxerb9d0EWrQZnkY2UdjNpyXo=; b=K76xBoE+bNS+J+641e9DRxopdRB/DYlQHHoPZhfeP6LhKvT1S5PA0pG/HX1BZLZanY GQM2zHfIsyotC/s8+GZ0q51rytfr9E7DwhxJoYYBSgpJHwNA6UrZPb982+IbksVm/Z+n 1irKBukqFEUzSUXwgjKEBsjM3y37kjoiPat+CjqeO2AkL4urwzqKUgKmn3GuNYX+/Ceu +aBXQ07LzoZ3DacplZGq3kshb1nyzabYJ1b3T0da1TfffCWDMYZn+yGvlgFdg7R/GYKA xBbM7OwUk9ZInJGzjrqy0+kwTj7Swsu/NTia8knvGIqZBPSXq0oum+3gtWyhVAZABc17 bIog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348752; x=1699953552; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zA7r0L4MFhmNsA5bEnJxerb9d0EWrQZnkY2UdjNpyXo=; b=cO3cCn5KHAwpnPHCclp0eKM3Be78/MnzqsXYqi4gtQvSO1bzKky2Z4XutD6gDfSEHR /+3zbSvacUBxWDj8dzo1VrzA4h/BV80JB+lqVW23W0FZwTc0ZHJxXJ9eft/0zagYyPGA w6rWwWGKP9ZfYMpRE26/nr4KRPxzC8LWYdakpQqr6OKqsDmDuJ2eqUDeCWnyKOGcE3WK X4n2a8wNtKzu//lwpCOu8fclNwz0/AUGDJZpkA869CsU5ArgQDMHJbGrS6eedv/Ofp/Y kN8IaW1ZuXx/3sjZC4yP7Ko2dNXCwqz0aq0hkMkRYP+waC/M1bwyuZsRRdTSamaG93/V SP+g== X-Gm-Message-State: AOJu0YwopMnKUsLtswGHXYmupqp/BR7+kcBUPeCLEkpQ8aKJTYq7wMxC 9Q3Ef/q3r/4UhOzaq3KDsUv1Mc7u1UmHvg2Zr/ZozQ== X-Received: by 2002:a5d:47a8:0:b0:32f:9a76:ea0f with SMTP id 8-20020a5d47a8000000b0032f9a76ea0fmr17974282wrb.46.1699348752118; Tue, 07 Nov 2023 01:19:12 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id r1-20020a5d4941000000b0032da8fb0d05sm1779899wrs.110.2023.11.07.01.19.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:11 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED] ada: Fix scope of semantic style_check pragmas Date: Tue, 7 Nov 2023 10:19:06 +0100 Message-ID: <20231107091907.3905160-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896358542191113 X-GMAIL-MSGID: 1781896358542191113 From: Viljar Indus Restore the original state of Style_Check pragmas before analyzing each compilation unit to avoid Style_Check pragmas from unit affecting the style checks of a different unit. gcc/ada/ * sem_ch10.adb: (Analyze_Compilation_Unit): Restore the orignal state of style check pragmas at the end of the analysis. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch10.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index ba4beae2851..90d2f3c6c74 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -638,6 +638,7 @@ package body Sem_Ch10 is Par_Spec_Name : Unit_Name_Type; Spec_Id : Entity_Id; Unum : Unit_Number_Type; + Options : Style_Check_Options; -- Start of processing for Analyze_Compilation_Unit @@ -717,6 +718,11 @@ package body Sem_Ch10 is Set_Context_Pending (N); end if; + -- Store the style check options before analyzing context pragmas that + -- might change them for this compilation unit. + + Save_Style_Check_Options (Options); + Analyze_Context (N); Set_Context_Pending (N, False); @@ -1395,6 +1401,10 @@ package body Sem_Ch10 is Pop_Scope; end if; + -- Finally restore all the original style check options + + Set_Style_Check_Options (Options); + -- If No_Elaboration_Code_All was encountered, this is where we do the -- transitive test of with'ed units to make sure they have the aspect. -- This is delayed till the end of analyzing the compilation unit to