aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-11-27 15:28:09 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-17 05:49:19 -0500
commit337cbb9f9edaebb6cd6dba2f22c9d0437e1f81a0 (patch)
treef21e627d2122bfa2faefe53fa8d05544677f819c
parent33f925094d02ce40872d494d384d4494a4313779 (diff)
downloadgcc-337cbb9f9edaebb6cd6dba2f22c9d0437e1f81a0.zip
gcc-337cbb9f9edaebb6cd6dba2f22c9d0437e1f81a0.tar.gz
gcc-337cbb9f9edaebb6cd6dba2f22c9d0437e1f81a0.tar.bz2
[Ada] Style cleanups in Parse_Aspect_Stable_Properties
gcc/ada/ * sem_ch13.adb (Parse_Aspect_Stable_Properties): Fix style; limit the scope of local variables; remove extra assignment in Extract_Entity. (Validate_Aspect_Stable_Properties): Simplify with procedural Next.
-rw-r--r--gcc/ada/sem_ch13.adb28
1 files changed, 20 insertions, 8 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 4120a47..f1a2304 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -15094,27 +15094,39 @@ package body Sem_Ch13 is
function Parse_Aspect_Stable_Properties
(Aspect_Spec : Node_Id; Negated : out Boolean) return Subprogram_List
is
- L : List_Id;
- Id : Node_Id;
-
function Extract_Entity (Expr : Node_Id) return Entity_Id;
- -- Given an element of a Stable_Properties aspect spec,
- -- return the associated entity.
+ -- Given an element of a Stable_Properties aspect spec, return the
+ -- associated entity.
-- This function updates the Negated flag as a side-effect.
+ --------------------
+ -- Extract_Entity --
+ --------------------
+
function Extract_Entity (Expr : Node_Id) return Entity_Id is
- Name : Node_Id := Expr;
+ Name : Node_Id;
begin
if Nkind (Expr) = N_Op_Not then
Negated := True;
Name := Right_Opnd (Expr);
+ else
+ Name := Expr;
end if;
+
if Nkind (Name) in N_Has_Entity then
return Entity (Name);
else
return Empty;
end if;
end Extract_Entity;
+
+ -- Local variables
+
+ L : List_Id;
+ Id : Node_Id;
+
+ -- Start of processing for Parse_Aspect_Stable_Properties
+
begin
Negated := False;
@@ -15128,7 +15140,7 @@ package body Sem_Ch13 is
for I in Result'Range loop
Result (I) := Extract_Entity (Id);
- if not Present (Result (I)) then
+ if No (Result (I)) then
pragma Assert (Serious_Errors_Detected > 0);
goto Ignore_Aspect;
end if;
@@ -15308,7 +15320,7 @@ package body Sem_Ch13 is
begin
while Present (PF_Arg) loop
Check_Property_Function_Arg (PF_Arg);
- PF_Arg := Next (PF_Arg);
+ Next (PF_Arg);
end loop;
end;
else