+2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * checks.adb, exp_ch6.adb, gnat1drv.adb, sem_aux.adb,
+ sem_ch2.adb, sem_ch8.adb, sem_res.adb: Minor reformatting.
+
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch8.adb (Analyze_Object_Renaming): Obtain the object being
Typ : Entity_Id;
Insert_Node : Node_Id)
is
+ Loc : constant Source_Ptr := Sloc (N);
+
Check_Cond : Node_Id;
- Loc : constant Source_Ptr := Sloc (N);
- Param_Ent : Entity_Id := Param_Entity (N);
+ Param_Ent : Entity_Id := Param_Entity (N);
Param_Level : Node_Id;
Type_Level : Node_Id;
-- Raise Program_Error if the accessibility level of the access
-- parameter is deeper than the level of the target access type.
- Check_Cond := Make_Op_Gt (Loc,
- Left_Opnd => Param_Level,
- Right_Opnd => Type_Level);
+ Check_Cond :=
+ Make_Op_Gt (Loc,
+ Left_Opnd => Param_Level,
+ Right_Opnd => Type_Level);
Insert_Action (Insert_Node,
Make_Raise_Program_Error (Loc,
and then Entity (Check_Cond) = Standard_True
then
Error_Msg_Warn := SPARK_Mode /= On;
- Error_Msg_N
- ("accessibility check fails<<", N);
- Error_Msg_N
- ("\Program_Error [<<", N);
+ Error_Msg_N ("accessibility check fails<<", N);
+ Error_Msg_N ("\Program_Error [<<", N);
end if;
end if;
end Apply_Accessibility_Check;
function Can_Fold_Predicate_Call (P : Entity_Id) return Boolean is
Actual : constant Node_Id :=
First (Parameter_Associations (Call_Node));
- Subt : constant Entity_Id := Etype (First_Entity (P));
- Pred : Node_Id;
function May_Fold (N : Node_Id) return Traverse_Result;
-- The predicate expression is foldable if it only contains operators
-- value of the actual. This is done on a copy of the analyzed
-- expression for the predicate.
+ --------------
+ -- May_Fold --
+ --------------
+
function May_Fold (N : Node_Id) return Traverse_Result is
begin
case Nkind (N) is
- when N_Binary_Op | N_Unary_Op =>
+ when N_Binary_Op
+ | N_Unary_Op
+ =>
return OK;
- when N_Identifier | N_Expanded_Name =>
+ when N_Expanded_Name
+ | N_Identifier
+ =>
if Ekind (Entity (N)) = E_In_Parameter
and then Entity (N) = First_Entity (P)
then
return Abandon;
end if;
- when N_If_Expression | N_Case_Expression =>
+ when N_Case_Expression
+ | N_If_Expression
+ =>
return OK;
when N_Integer_Literal =>
function Try_Fold is new Traverse_Func (May_Fold);
+ -- Local variables
+
+ Subt : constant Entity_Id := Etype (First_Entity (P));
+ Pred : Node_Id;
+
-- Start of processing for Can_Fold_Predicate_Call
begin
-- Retrieve the analyzed expression for the predicate
Pred :=
- New_Copy_Tree
- (Expression (Find_Aspect (Subt, Aspect_Dynamic_Predicate)));
+ New_Copy_Tree
+ (Expression (Find_Aspect (Subt, Aspect_Dynamic_Predicate)));
if Try_Fold (Pred) = OK then
Rewrite (Call_Node, Pred);
Analyze_And_Resolve (Call_Node, Standard_Boolean);
return True;
- else
- -- Continue expansion of function call
+ -- Otherwise continue the expansion of the function call
+ else
return False;
end if;
end Can_Fold_Predicate_Call;
for U in Main_Unit .. Last_Unit loop
if In_Extended_Main_Source_Unit (Cunit_Entity (U)) then
declare
- Nam : constant String :=
- Get_Name_String (File_Name (Source_Index (U))) & ".json";
- Namid : constant File_Name_Type := Name_Enter (Nam);
+ Nam : constant String :=
+ Get_Name_String
+ (File_Name (Source_Index (U))) & ".json";
+ Namid : constant File_Name_Type := Name_Enter (Nam);
Index : constant Source_File_Index := Load_Config_File (Namid);
begin
function Is_Protected_Operation (E : Entity_Id) return Boolean is
begin
- return Is_Entry (E)
- or else (Is_Subprogram (E)
- and then Nkind (Parent (Unit_Declaration_Node (E))) =
- N_Protected_Definition);
+ return
+ Is_Entry (E)
+ or else (Is_Subprogram (E)
+ and then Nkind (Parent (Unit_Declaration_Node (E))) =
+ N_Protected_Definition);
end Is_Protected_Operation;
----------------------
with Rident; use Rident;
with Sem_Ch8; use Sem_Ch8;
with Sem_Dim; use Sem_Dim;
--- with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Stand; use Stand;
with Uintp; use Uintp;
-- prior analysis (or construction) of the literal, and after type
-- checking and resolution.
- if No (Etype (N))
- or else not Is_Modular_Integer_Type (Etype (N))
- then
+ if No (Etype (N)) or else not Is_Modular_Integer_Type (Etype (N)) then
Set_Etype (N, Universal_Integer);
end if;
-- it does not apply to records with limited components, for which
-- this syntactic flag is not set, but whose size is also fixed.
- elsif (Is_Record_Type (Typ)
- and then Is_Limited_Type (Typ))
+ elsif (Is_Record_Type (Typ) and then Is_Limited_Type (Typ))
or else
(Ekind (Typ) = E_Limited_Private_Type
and then Has_Discriminants (Typ)
or else Nkind (Original_Node (N)) not in N_Subprogram_Call
or else (Nkind (Name (N)) = N_Identifier
and then Present (Entity (Name (N)))
- and then Nkind (Entity (Name (N)))
- = N_Defining_Operator_Symbol)
+ and then Nkind (Entity (Name (N))) =
+ N_Defining_Operator_Symbol)
or else not Comes_From_Source (N)
then
return;