* [Ada] Wrong casing of restriction and check names
@ 2017-04-25 9:54 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-04-25 9:54 UTC (permalink / raw)
To: gcc-patches; +Cc: Bob Duff
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
Fixes bugs in which the wrong casing was used for restriction names in
pragmas Restrictions and Restriction_Warnings, and check names in pragma
Check. No test is available -- too complicated to make it fail.
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-04-25 Bob Duff <duff@adacore.com>
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Use Source_Index (Current_Sem_Unit) to find the correct casing.
* exp_prag.adb (Expand_Pragma_Check): Use Source_Index
(Current_Sem_Unit) to find the correct casing.
* par.adb (Par): Null out Current_Source_File, to ensure that
the above bugs won't rear their ugly heads again.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 2858 bytes --]
Index: exp_prag.adb
===================================================================
--- exp_prag.adb (revision 247162)
+++ exp_prag.adb (working copy)
@@ -33,6 +33,7 @@
with Exp_Util; use Exp_Util;
with Expander; use Expander;
with Inline; use Inline;
+with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
@@ -432,11 +433,12 @@
Add_Str_To_Name_Buffer ("failed invariant from ");
-- For all other checks, the string is "xxx failed at yyy"
- -- where xxx is the check name with current source file casing.
+ -- where xxx is the check name with appropriate casing.
else
Get_Name_String (Nam);
- Set_Casing (Identifier_Casing (Current_Source_File));
+ Set_Casing
+ (Identifier_Casing (Source_Index (Current_Sem_Unit)));
Add_Str_To_Name_Buffer (" failed at ");
end if;
Index: sem_prag.adb
===================================================================
--- sem_prag.adb (revision 247165)
+++ sem_prag.adb (working copy)
@@ -9416,7 +9416,8 @@
if Is_Bad_Spelling_Of (Chars (Expr), Name_Enter) then
Set_Casing
- (Identifier_Casing (Current_Source_File));
+ (Identifier_Casing
+ (Source_Index (Current_Sem_Unit)));
Error_Msg_String (1 .. Rnm'Length) :=
Name_Buffer (1 .. Name_Len);
Error_Msg_Strlen := Rnm'Length;
Index: par.adb
===================================================================
--- par.adb (revision 247150)
+++ par.adb (working copy)
@@ -1457,6 +1457,8 @@
procedure Labl is separate;
procedure Load is separate;
+ Result : List_Id := Empty_List;
+
-- Start of processing for Par
begin
@@ -1472,13 +1474,13 @@
begin
loop
if Token = Tok_EOF then
- Compiler_State := Analyzing;
- return Pragmas;
+ Result := Pragmas;
+ exit;
elsif Token /= Tok_Pragma then
Error_Msg_SC ("only pragmas allowed in configuration file");
- Compiler_State := Analyzing;
- return Error_List;
+ Result := Error_List;
+ exit;
else
P_Node := P_Pragma;
@@ -1690,7 +1692,9 @@
Restore_Opt_Config_Switches (Save_Config_Switches);
Set_Comes_From_Source_Default (False);
- Compiler_State := Analyzing;
- return Empty_List;
end if;
+
+ Compiler_State := Analyzing;
+ Current_Source_File := No_Source_File;
+ return Result;
end Par;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-25 9:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 9:54 [Ada] Wrong casing of restriction and check names Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).