diff mbox series

[Ada] Consistent diagnostic on missing -gnat2020 switch for aspects

Message ID 20210428094139.GA140033@adacore.com
State New
Headers show
Series [Ada] Consistent diagnostic on missing -gnat2020 switch for aspects | expand

Commit Message

Pierre-Marie de Rodat April 28, 2021, 9:41 a.m. UTC
Reuse Error_Msg_Ada_2020_Feature for messages that reference the
currently processed aspect using the '%' insertion character. Cleanup
only; behaviour is not affected.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_ch13.adb (Analyze_Aspect_Static): Reuse
	Error_Msg_Ada_2020_Feature for aspect Static.
	(Analyze_One_Aspect): Likewise for aspect Full_Access.
diff mbox series

Patch

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -2500,10 +2500,7 @@  package body Sem_Ch13 is
 
             begin
                if Ada_Version < Ada_2020 then
-                  Error_Msg_N
-                    ("aspect % is an Ada 202x feature", Aspect);
-                  Error_Msg_N ("\compile with -gnat2020", Aspect);
-
+                  Error_Msg_Ada_2020_Feature ("aspect %", Sloc (Aspect));
                   return;
                end if;
 
@@ -4575,11 +4572,7 @@  package body Sem_Ch13 is
                   --  Ada 202x (AI12-0363): Full_Access_Only
 
                   elsif A_Id = Aspect_Full_Access_Only then
-                     if Ada_Version < Ada_2020 then
-                        Error_Msg_N
-                          ("aspect % is an Ada 202x feature", Aspect);
-                        Error_Msg_N ("\compile with -gnat2020", Aspect);
-                     end if;
+                     Error_Msg_Ada_2020_Feature ("aspect %", Sloc (Aspect));
 
                   --  Ada 202x (AI12-0075): static expression functions