+2017-09-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_warn.adb (Warn_On_Overlapping_Actuals): Refine previous
+ fix and preserve older GNAT warning on overlapping actuals that
+ are not elementary types.
+
+2017-09-06 Justin Squirek <squirek@adacore.com>
+
+ * sem_attr.adb: Comment correction.
+
2017-09-06 Gary Dismukes <dismukes@adacore.com>
* sem_util.adb: Minor reformatting.
-- Check that P is an object reference
procedure Check_Object_Reference_Image (Str_Typ : Entity_Id);
- -- Verify that the prefix of an image attribute.... ???
+ -- Verify that the prefix of an image attribute is an object reference
+ -- and set the Etype of the prefix to that specified by Str_Typ.
procedure Check_PolyORB_Attribute;
-- Validity checking for PolyORB/DSA attribute
-- Local variables
- Act1 : Node_Id;
- Act2 : Node_Id;
- Form1 : Entity_Id;
- Form2 : Entity_Id;
+ Act1 : Node_Id;
+ Act2 : Node_Id;
+ Form1 : Entity_Id;
+ Form2 : Entity_Id;
+ Warn_Only : Boolean;
+ -- GNAT warns on overlapping in-out parameters even when there
+ -- sre no two in-out parameters of an elementary type, as stated in
+ -- RM 6.5.1 (17/2).
-- Start of processing for Warn_On_Overlapping_Actuals
return;
end if;
+ -- The call is illegal only if there are at least two in-out
+ -- parameters of the same elementary type.
+
+ Warn_Only := True;
+ Form1 := First_Formal (Subp);
+ while Present (Form1) loop
+ Form2 := Next_Formal (Form1);
+ while Present (Form2) loop
+ if Is_Elementary_Type (Etype (Form1))
+ and then Is_Elementary_Type (Etype (Form2))
+ and then Ekind (Form1) /= E_In_Parameter
+ and then Ekind (Form2) /= E_In_Parameter
+ then
+ Warn_Only := False;
+ exit;
+ end if;
+
+ Next_Formal (Form2);
+ end loop;
+
+ Next_Formal (Form1);
+ end loop;
+
-- Exclude calls rewritten as enumeration literals
if Nkind (N) not in N_Subprogram_Call
then
null;
- -- If the types of the formals are different there can
- -- be no aliasing (even though there might be overlap
- -- through address clauses, which must be intentional).
-
- elsif Base_Type (Etype (Form1)) /= Base_Type (Etype (Form2))
- then
- null;
-
-- Here we may need to issue overlap message
else
or else not Is_Elementary_Type (Etype (Form1))
- -- Finally, debug flag -gnatd.E changes the error to a
+ -- debug flag -gnatd.E changes the error to a
-- warning even in Ada 2012 mode.
- or else Error_To_Warning;
+ or else Error_To_Warning
+
+ or else Warn_Only;
declare
Act : Node_Id;