From: Arnaud Charlet <charlet@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Bob Duff <duff@adacore.com>
Subject: [Ada] Wrong casing of restriction and check names
Date: Tue, 25 Apr 2017 09:54:00 -0000 [thread overview]
Message-ID: <20170425094612.GA5882@adacore.com> (raw)
[-- 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;
reply other threads:[~2017-04-25 9:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170425094612.GA5882@adacore.com \
--to=charlet@adacore.com \
--cc=duff@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).