+2009-04-10 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.ads, sem_warn.adb (Check_Low_Bound_Tested): Catch more cases
+ for warning suppression.
+
+2009-04-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Use_One_Type): If the two use_type clauses are
+ identical, there is no redudancy to check.
+
+2009-04-10 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch5.adb (Expand_N_Extended_Return_Statement): Delete redundant
+ calls initializing SS_Allocator (which is initialized in following
+ code).
+ (Expand_Simple_Function_Return): Add comment about False value for
+ Comes_From_Source on secondary-stack allocator.
+
+ * exp_ch9.adb (Build_Entry_Family_Name): Add comment.
+ (Build_Entry_Name): Add comment.
+
2009-04-10 Robert Dewar <dewar@adacore.com>
* einfo.ads, einfo.adb (Low_Bound_Tested): New name for Low_Bound_Known
Expression =>
New_Copy_Tree (Return_Obj_Expr)));
- SS_Allocator := New_Copy_Tree (Heap_Allocator);
-
else
-- If the function returns a class-wide type we cannot
-- use the return type for the allocator. Instead we
-- then the object will be default initialized twice.
Set_No_Initialization (Heap_Allocator);
-
- SS_Allocator := New_Copy_Tree (Heap_Allocator);
end if;
-- If the No_Allocators restriction is active, then only
-- an allocator for secondary stack allocation is needed.
+ -- It's OK for such allocators to have Comes_From_Source
+ -- set to False, because gigi knows not to flag them as
+ -- being a violation of No_Implicit_Heap_Allocations.
if Restriction_Active (No_Allocators) then
SS_Allocator := Heap_Allocator;
Heap_Allocator := Make_Null (Loc);
- -- Otherwise the heap allocator may be needed, so we
- -- make another allocator for secondary stack allocation.
+ -- Otherwise the heap allocator may be needed, so we make
+ -- another allocator for secondary stack allocation.
else
SS_Allocator := New_Copy_Tree (Heap_Allocator);
-- allocator (that is, it will only be executed on
-- behalf of callers that call the function as
-- initialization for such an allocator). This
- -- prevents errors when No_Implicit_Heap_Allocation
+ -- prevents errors when No_Implicit_Heap_Allocations
-- is in force.
Set_Comes_From_Source (Heap_Allocator, True);
Set_Associated_Storage_Pool (Acc_Typ, RTE (RE_SS_Pool));
+ -- This is an allocator for the secondary stack, and it's fine
+ -- to have Comes_From_Source set False on it, as gigi knows not
+ -- to flag it as a violation of No_Implicit_Heap_Allocations.
+
Alloc_Node :=
Make_Allocator (Loc,
Expression =>
-- Generate:
-- new String'("<Entry name>" & Lnn'Img);
+ -- This is an implicit heap allocation, and Comes_From_Source is
+ -- False, which ensures that it will get flagged as a violation of
+ -- No_Implicit_Heap_Allocations when that restriction applies.
+
Val :=
Make_Allocator (Loc,
Make_Qualified_Expression (Loc,
begin
Get_Name_String (Chars (Id));
+
+ -- This is an implicit heap allocation, and Comes_From_Source is
+ -- False, which ensures that it will get flagged as a violation of
+ -- No_Implicit_Heap_Allocations when that restriction applies.
+
Val :=
Make_Allocator (Loc,
Make_Qualified_Expression (Loc,
and then
Nkind (Parent (Clause2)) = N_Compilation_Unit
then
+
+ -- If the unit is a subprogram body that acts as spec,
+ -- the context clause is shared with the constructed
+ -- subprogram spec. Clearly there is no redundancy.
+
+ if Clause1 = Clause2 then
+ return;
+ end if;
+
Unit1 := Unit (Parent (Clause1));
Unit2 := Unit (Parent (Clause2));
and then Attribute_Name (L) = Name_First
and then Is_Entity_Name (Prefix (L))
and then Is_Formal (Entity (Prefix (L)))
- and then Nkind (R) = N_Integer_Literal
then
Set_Low_Bound_Tested (Entity (Prefix (L)));
end if;
+
+ if Nkind (R) = N_Attribute_Reference
+ and then Attribute_Name (R) = Name_First
+ and then Is_Entity_Name (Prefix (R))
+ and then Is_Formal (Entity (Prefix (R)))
+ then
+ Set_Low_Bound_Tested (Entity (Prefix (R)));
+ end if;
end;
end if;
end Check_Low_Bound_Tested;
procedure Check_Low_Bound_Tested (Expr : Node_Id);
-- Expr is the node for a comparison operation. This procedure checks if
- -- the comparison is a source comparison of P'First with a literal and if
- -- so, sets the Low_Bound_Tested flag in Expr to suppress warnings about
- -- improper low bound assumptions (we assume that if the code explicitly
- -- checks X'First, then it is not operating in blind assumption mode).
+ -- the comparison is a source comparison of P'First with some other value
+ -- and if so, sets the Low_Bound_Tested flag in Expr to suppress warnings
+ -- about improper low bound assumptions (we assume that if the code has a
+ -- test that explicitly checks X'First, then it is not operating in blind
+ -- assumption mode).
procedure Warn_On_Known_Condition (C : Node_Id);
-- C is a node for a boolean expression resulting from a relational