aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch10.adb
diff options
context:
space:
mode:
authorViljar Indus <indus@adacore.com>2023-10-06 13:12:29 +0300
committerMarc Poulhiès <poulhies@adacore.com>2023-11-07 10:15:01 +0100
commit95b8d1b5b5507200724445a98d6c54e0f5bef7c5 (patch)
tree2371760749275a3df684a3dc2690894be0bdb180 /gcc/ada/sem_ch10.adb
parent5a2d82e04d394945087a1a3cdcaf2ed68be8a61b (diff)
downloadgcc-95b8d1b5b5507200724445a98d6c54e0f5bef7c5.zip
gcc-95b8d1b5b5507200724445a98d6c54e0f5bef7c5.tar.gz
gcc-95b8d1b5b5507200724445a98d6c54e0f5bef7c5.tar.bz2
ada: Fix scope of semantic style_check pragmas
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.
Diffstat (limited to 'gcc/ada/sem_ch10.adb')
-rw-r--r--gcc/ada/sem_ch10.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index ba4beae..90d2f3c 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