Commit 32501d71 by Bob Duff Committed by Pierre-Marie de Rodat

[Ada] Enable delta_aggregate only in Ada 2020 mode

If the delta_aggregate feature is used, the -gnat2020 or -gnatX switch
must be given.

The following test must get an error if neither
-gnat2020 nor -gnatX is specified:

gcc -c delta_aggregate.ads -gnat2012

delta_aggregate.ads:4:18: delta_aggregate is an Ada 202x feature
delta_aggregate.ads:4:18: compile with -gnatX

package Delta_Aggregate is

   X : String := "Hello";
   Y : String := (X with delta 1 => 'h');

end Delta_Aggregate;

2019-08-20  Bob Duff  <duff@adacore.com>

gcc/ada/

	* par-ch4.adb: Minor wording change in error messages.
	* sem_aggr.adb (Resolve_Delta_Aggregate): Emit an error for Ada
	versions prior to Ada 2020.

From-SVN: r274729
parent 7e7f0b0a
2019-08-20 Bob Duff <duff@adacore.com> 2019-08-20 Bob Duff <duff@adacore.com>
* par-ch4.adb: Minor wording change in error messages.
* sem_aggr.adb (Resolve_Delta_Aggregate): Emit an error for Ada
versions prior to Ada 2020.
2019-08-20 Bob Duff <duff@adacore.com>
* freeze.adb (Is_Atomic_VFA_Aggregate): Make the temp for * freeze.adb (Is_Atomic_VFA_Aggregate): Make the temp for
initialization of the atomic variable be constant. This is initialization of the atomic variable be constant. This is
cleaner, and might improve efficiency. cleaner, and might improve efficiency.
......
...@@ -2850,7 +2850,7 @@ package body Ch4 is ...@@ -2850,7 +2850,7 @@ package body Ch4 is
when Tok_At_Sign => -- AI12-0125 : target_name when Tok_At_Sign => -- AI12-0125 : target_name
if Ada_Version < Ada_2020 then if Ada_Version < Ada_2020 then
Error_Msg_SC ("target name is an Ada 2020 extension"); Error_Msg_SC ("target name is an Ada 202x feature");
Error_Msg_SC ("\compile with -gnatX"); Error_Msg_SC ("\compile with -gnatX");
end if; end if;
...@@ -3325,7 +3325,7 @@ package body Ch4 is ...@@ -3325,7 +3325,7 @@ package body Ch4 is
Set_Expression (Assoc_Node, P_Expression); Set_Expression (Assoc_Node, P_Expression);
if Ada_Version < Ada_2020 then if Ada_Version < Ada_2020 then
Error_Msg_SC ("iterated component is an Ada 2020 extension"); Error_Msg_SC ("iterated component is an Ada 202x feature");
Error_Msg_SC ("\compile with -gnatX"); Error_Msg_SC ("\compile with -gnatX");
end if; end if;
......
...@@ -2799,6 +2799,11 @@ package body Sem_Aggr is ...@@ -2799,6 +2799,11 @@ package body Sem_Aggr is
Base : constant Node_Id := Expression (N); Base : constant Node_Id := Expression (N);
begin begin
if Ada_Version < Ada_2020 then
Error_Msg_N ("delta_aggregate is an Ada 202x feature", N);
Error_Msg_N ("\compile with -gnatX", N);
end if;
if not Is_Composite_Type (Typ) then if not Is_Composite_Type (Typ) then
Error_Msg_N ("not a composite type", N); Error_Msg_N ("not a composite type", N);
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment