From: Arnaud Charlet <charlet@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Bob Duff <duff@adacore.com>
Subject: [Ada] Library-level error on aspects
Date: Thu, 12 Nov 2015 13:25:00 -0000 [thread overview]
Message-ID: <20151112132555.GA63376@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
This patch fixes a bug where GNAT fails to detect an error on an aspect that
must be applied to a library-level entity.
The following test must give an error:
tls.adb:2:26: entity for aspect "Thread_Local_Storage" must be library level
entity
procedure Tls is
V : Natural := 0 with Thread_Local_Storage;
begin
null;
end Tls;
Tested on x86_64-pc-linux-gnu, committed on trunk
2015-11-12 Bob Duff <duff@adacore.com>
* sem_prag.adb (Check_Arg_Is_Library_Level_Local_Name): A
pragma that comes from an aspect does not "come from source",
so we need to test whether it comes from an aspect.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 708 bytes --]
Index: sem_prag.adb
===================================================================
--- sem_prag.adb (revision 230242)
+++ sem_prag.adb (working copy)
@@ -4328,8 +4328,12 @@
begin
Check_Arg_Is_Local_Name (Arg);
+ -- If it came from an aspect, we want to give the error just as if it
+ -- came from source.
+
if not Is_Library_Level_Entity (Entity (Get_Pragma_Arg (Arg)))
- and then Comes_From_Source (N)
+ and then (Comes_From_Source (N)
+ or else Present (Corresponding_Aspect (Parent (Arg))))
then
Error_Pragma_Arg
("argument for pragma% must be library level entity", Arg);
reply other threads:[~2015-11-12 13:25 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=20151112132555.GA63376@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).