aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch4.adb
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2022-04-05 20:20:10 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-18 08:41:06 +0000
commit72de114c23027f1d1f0df4c78e69c4302e39e058 (patch)
treec5c1ffd439a5e669ba8b3f8b1ec1f54d3618e501 /gcc/ada/par-ch4.adb
parentb271095d5076f837391b2726c1265ae2e91fafa8 (diff)
downloadgcc-72de114c23027f1d1f0df4c78e69c4302e39e058.zip
gcc-72de114c23027f1d1f0df4c78e69c4302e39e058.tar.gz
gcc-72de114c23027f1d1f0df4c78e69c4302e39e058.tar.bz2
[Ada] Improve error messages for occurrence of GNAT extensions without -gnatX
The error message issued for use of GNAT extension features without specifying -gnatX (or pragma Extensions_Allowed) was confusing in the presence of a pragma specifying a language version (such as "pragma Ada_2022;"), because the pragma supersedes the switch. The message is improved by testing for use of such a pragma, plus use of pragma Extensions_Allowed is now suggested, and several cases are changed to call the common error procedure for flagging uses of extension features. gcc/ada/ * errout.ads (Error_Msg_GNAT_Extension): Add formal Loc and revise comment. * errout.adb (Error_Msg_GNAT_Extension): Condition message on the flag Ada_Version_Pragma, and add suggestion to use of pragma Extensions_Allowed in messages. * par-ch3.adb, par-ch5.adb, par-ch6.adb, par-ch11.adb, par-ch12.adb: Add actual Token_Ptr on calls to Error_Msg_GNAT_Extension. * par-ch4.adb: Change Error_Msg to Error_Msg_GNAT_Extension for error calls related to use of extension features. * sem_ch13.adb: Likewise.
Diffstat (limited to 'gcc/ada/par-ch4.adb')
-rw-r--r--gcc/ada/par-ch4.adb11
1 files changed, 4 insertions, 7 deletions
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index bfefd14..e0f3ca9 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -1783,9 +1783,8 @@ package body Ch4 is
Box_With_Identifier_Present := True;
Scan; -- past ">"
else
- Error_Msg
- ("Identifier within box only supported under -gnatX",
- Token_Ptr);
+ Error_Msg_GNAT_Extension
+ ("identifier within box", Token_Ptr);
Box_Present := True;
-- Avoid cascading errors by ignoring the identifier
end if;
@@ -1816,10 +1815,8 @@ package body Ch4 is
Id := P_Defining_Identifier;
if not Extensions_Allowed then
- Error_Msg
- ("IS following component association"
- & " only supported under -gnatX",
- Token_Ptr);
+ Error_Msg_GNAT_Extension
+ ("IS following component association", Token_Ptr);
elsif Box_With_Identifier_Present then
Error_Msg
("Both identifier-in-box and trailing identifier"