From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AGHT+IFI+8dkA7Ea7omVhK1DZLUqBDKIdBgoXFSvsgHbAnwGAt822V+QSACbn2RmvDWs6BDwVpAjAQ== 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=20Poulhi=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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.42.0