aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-10-20 11:24:48 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-26 03:39:42 -0500
commit5f7ee280184215b592e945e906902da92f3428e8 (patch)
tree3cdd82413bbcd3fdf21983d17bce9a1e30307ad4
parent21d66365ad62c6d807dd5245101e30c67d563922 (diff)
downloadgcc-5f7ee280184215b592e945e906902da92f3428e8.zip
gcc-5f7ee280184215b592e945e906902da92f3428e8.tar.gz
gcc-5f7ee280184215b592e945e906902da92f3428e8.tar.bz2
[Ada] Simplify checks for library unit pragmas
gcc/ada/ * sem_prag.adb (Check_Valid_Library_Unit_Pragma): Raise exception. (Analyze_Pragma): Remove detection of rewritten pragmas.
-rw-r--r--gcc/ada/sem_prag.adb37
1 files changed, 3 insertions, 34 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 87497e5..a54ece6 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -4073,7 +4073,8 @@ package body Sem_Prag is
-- than library level instantiations these can appear in contexts which
-- would normally be invalid (they only apply to the original template
-- and to library level instantiations), and they are simply ignored,
- -- which is implemented by rewriting them as null statements.
+ -- which is implemented by rewriting them as null statements and raising
+ -- exception to terminate analysis.
procedure Check_Variant (Variant : Node_Id; UU_Typ : Entity_Id);
-- Check an Unchecked_Union variant for lack of nested variants and
@@ -6586,7 +6587,7 @@ package body Sem_Prag is
if Loc not in Source_First (Sindex) .. Source_Last (Sindex) then
Rewrite (N, Make_Null_Statement (Loc));
- return;
+ raise Pragma_Exit;
-- If before first declaration, the pragma applies to the
-- enclosing unit, and the name if present must be this name.
@@ -12551,10 +12552,6 @@ package body Sem_Prag is
Check_Ada_83_Warning;
Check_Valid_Library_Unit_Pragma;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
Lib_Entity := Find_Lib_Unit_Name;
-- A pragma that applies to a Ghost entity becomes Ghost for the
@@ -15745,10 +15742,6 @@ package body Sem_Prag is
Check_Ada_83_Warning;
Check_Valid_Library_Unit_Pragma;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
Cunit_Node := Cunit (Current_Sem_Unit);
Cunit_Ent := Cunit_Entity (Current_Sem_Unit);
@@ -19453,10 +19446,6 @@ package body Sem_Prag is
GNAT_Pragma;
Check_Valid_Library_Unit_Pragma;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
-- Must appear for a spec or generic spec
if Nkind (Unit (Cunit (Current_Sem_Unit))) not in
@@ -21190,10 +21179,6 @@ package body Sem_Prag is
Check_Ada_83_Warning;
Check_Valid_Library_Unit_Pragma;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
Ent := Find_Lib_Unit_Name;
-- A pragma that applies to a Ghost entity becomes Ghost for the
@@ -21839,10 +21824,6 @@ package body Sem_Prag is
Check_Valid_Library_Unit_Pragma;
end if;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
Ent := Find_Lib_Unit_Name;
-- A pragma that applies to a Ghost entity becomes Ghost for the
@@ -22379,10 +22360,6 @@ package body Sem_Prag is
Check_Ada_83_Warning;
Check_Valid_Library_Unit_Pragma;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
Cunit_Node := Cunit (Current_Sem_Unit);
K := Nkind (Unit (Cunit_Node));
Cunit_Ent := Cunit_Entity (Current_Sem_Unit);
@@ -22422,10 +22399,6 @@ package body Sem_Prag is
Check_Ada_83_Warning;
Check_Valid_Library_Unit_Pragma;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
Cunit_Node := Cunit (Current_Sem_Unit);
Cunit_Ent := Cunit_Entity (Current_Sem_Unit);
@@ -22622,10 +22595,6 @@ package body Sem_Prag is
Check_Ada_83_Warning;
Check_Valid_Library_Unit_Pragma;
- if Nkind (N) = N_Null_Statement then
- return;
- end if;
-
Cunit_Node := Cunit (Current_Sem_Unit);
Cunit_Ent := Cunit_Entity (Current_Sem_Unit);