aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-05-15 10:58:33 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-06-20 10:50:53 +0200
commit09ed91df30102e17ac5c59bab314b8b37606c710 (patch)
tree981841905efac35f2b39f535f4f0eb392df98a39 /gcc/ada
parent42305c7a3acb29b7bedef4d90dbbe032a5f985c5 (diff)
downloadgcc-09ed91df30102e17ac5c59bab314b8b37606c710.zip
gcc-09ed91df30102e17ac5c59bab314b8b37606c710.tar.gz
gcc-09ed91df30102e17ac5c59bab314b8b37606c710.tar.bz2
ada: Remove redundant conditions from freezing code
Code cleanup; behavior is unaffected. gcc/ada/ * freeze.adb (Check_Current_Instance): This routine is only called with parameter E being a type entity, so there is no need to check for types just before the equality with E. * sem_ch13.adb (Analyze_Aspect_Specifications): Regroup condition to avoid unnecessary evaluation. (Check_Aspect_At_End_Of_Declarations): If In_Instance is true, then the routine exits early.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/freeze.adb1
-rw-r--r--gcc/ada/sem_ch13.adb14
2 files changed, 7 insertions, 8 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 2fcc2ce..2a0a59f 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -3086,7 +3086,6 @@ package body Freeze is
when N_Attribute_Reference =>
if Attribute_Name (N) in Name_Access | Name_Unchecked_Access
and then Is_Entity_Name (Prefix (N))
- and then Is_Type (Entity (Prefix (N)))
and then Entity (Prefix (N)) = E
then
if Ada_Version < Ada_2012 then
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index f65217b..d81b741 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -4086,12 +4086,12 @@ package body Sem_Ch13 is
Error_Msg_N ("aspect% cannot apply to subtype", Id);
goto Continue;
- elsif A_Id = Aspect_Default_Value
- and then not Is_Scalar_Type (E)
- then
- Error_Msg_N
- ("aspect% can only be applied to scalar type", Id);
- goto Continue;
+ elsif A_Id = Aspect_Default_Value then
+ if not Is_Scalar_Type (E) then
+ Error_Msg_N
+ ("aspect% can only be applied to scalar type", Id);
+ goto Continue;
+ end if;
elsif A_Id = Aspect_Default_Component_Value then
if not Is_Array_Type (E) then
@@ -11118,7 +11118,7 @@ package body Sem_Ch13 is
-- If the end of declarations comes before any other freeze point,
-- the Freeze_Expr is not analyzed: no check needed.
- if Analyzed (Freeze_Expr) and then not In_Instance then
+ if Analyzed (Freeze_Expr) then
Check_Overloaded_Name;
else
Err := False;