* [Ada] Fix attributes Version and Body_Version for concurrent units
@ 2021-05-03 9:29 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-03 9:29 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 435 bytes --]
Attributes Version and Body_Version can be prefixed by program units,
which include protected units and task units. Those attributes were
wrongly accepted when prefixed by protected subtype, task subtype and by
any object of a concurrent type.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_attr.adb (Check_Program_Unit): Fix references to
Concurrent_Kind and Is_Concurrent_Type; avoid repeated calls to
Entity.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1108 bytes --]
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -2298,16 +2298,15 @@ package body Sem_Attr is
begin
if Is_Entity_Name (P) then
declare
- K : constant Entity_Kind := Ekind (Entity (P));
- T : constant Entity_Id := Etype (Entity (P));
-
+ E : constant Entity_Id := Entity (P);
begin
- if K in Concurrent_Kind
- | Entry_Kind
- | Generic_Unit_Kind
- | Subprogram_Kind
- | E_Package
- or else (K = E_Variable and then Is_Concurrent_Type (T))
+ if Ekind (E) in E_Protected_Type
+ | E_Task_Type
+ | Entry_Kind
+ | Generic_Unit_Kind
+ | Subprogram_Kind
+ | E_Package
+ or else Is_Single_Concurrent_Object (E)
then
return;
end if;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-03 9:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 9:29 [Ada] Fix attributes Version and Body_Version for concurrent units Pierre-Marie de Rodat
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).