diff mbox series

[Ada] Tune inconsistent message about fixed-lower-bound and -gnatX

Message ID 20220111133209.GA748639@adacore.com
State New
Headers show
Series [Ada] Tune inconsistent message about fixed-lower-bound and -gnatX | expand

Commit Message

Pierre-Marie de Rodat Jan. 11, 2022, 1:32 p.m. UTC
Use a dedicated routine to complain about the missing -gnatX switch.

Previously the message was:

  error: fixed-lower-bound array is an extension feature; use -gnatX

and after this change it is:

  error: fixed-lower-bound array is a GNAT specific extension
  error: unit must be compiled with -gnatX switch

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

gcc/ada/

	* par-ch3.adb (P_Array_Type_Definition): Use
	Error_Msg_GNAT_Extension.
diff mbox series

Patch

diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -2788,12 +2788,7 @@  package body Ch3 is
             else
                P_Index_Subtype_Def_With_Fixed_Lower_Bound (Subtype_Mark_Node);
 
-               if not Extensions_Allowed then
-                  Error_Msg_N
-                    ("fixed-lower-bound array is an extension feature; "
-                       & "use -gnatX",
-                     Token_Node);
-               end if;
+               Error_Msg_GNAT_Extension ("fixed-lower-bound array");
             end if;
 
             exit when Token = Tok_Right_Paren or else Token = Tok_Of;
@@ -2862,12 +2857,7 @@  package body Ch3 is
                      P_Index_Subtype_Def_With_Fixed_Lower_Bound
                        (Subtype_Mark_Node);
 
-                     if not Extensions_Allowed then
-                        Error_Msg_N
-                          ("fixed-lower-bound array is an extension feature; "
-                             & "use -gnatX",
-                           Token_Node);
-                     end if;
+                     Error_Msg_GNAT_Extension ("fixed-lower-bound array");
                   end if;
 
                   exit when Token = Tok_Right_Paren or else Token = Tok_Of;
@@ -3369,12 +3359,7 @@  package body Ch3 is
             --  later during analysis), and scan to the next token.
 
             if Token = Tok_Box then
-               if not Extensions_Allowed then
-                  Error_Msg_N
-                    ("fixed-lower-bound array is an extension feature; "
-                       & "use -gnatX",
-                     Expr_Node);
-               end if;
+               Error_Msg_GNAT_Extension ("fixed-lower-bound array");
 
                Expr_Node := Empty;
                Scan;