public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Allow attributes Version and Body_Version prefixed by entries
@ 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: 521 bytes --]

Prefix of attributes Version and Body_Version denotes any program unit,
including protected entries, which were wrongly rejected this context.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_attr.adb (Check_Program_Unit): Replace tests for Task_Kind
	and Protected_Kind with a collective test for Concurrent_Kind;
	likewise, replace calls to Is_Task_Type and Is_Protected_Type
	with a collective call to Is_Concurrent_Type; simplify into a
	single membership test; add missing Entry_Kind alternative.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1028 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
@@ -2302,16 +2302,12 @@ package body Sem_Attr is
                T : constant Entity_Id   := Etype (Entity (P));
 
             begin
-               if K in Subprogram_Kind
-                 or else K in Task_Kind
-                 or else K in Protected_Kind
-                 or else K = E_Package
-                 or else K in Generic_Unit_Kind
-                 or else (K = E_Variable
-                            and then
-                              (Is_Task_Type (T)
-                                 or else
-                               Is_Protected_Type (T)))
+               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))
                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] Allow attributes Version and Body_Version prefixed by entries 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).