[COMMITTED,01/30] ada: Fix list of attributes defined by Ada 2022

Message ID 20240620085321.2412421-1-poulhies@adacore.com
State Committed
Commit 21b54dad4789396f6877e08024c3d40eec2861d6
Headers
Series [COMMITTED,01/30] ada: Fix list of attributes defined by Ada 2022 |

Commit Message

Marc Poulhiès June 20, 2024, 8:52 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

Recognize references to attributes Put_Image and Object_Size as
language-defined in Ada 2022 and implementation-defined in earlier
versions of Ada. Other attributes listed in Ada 2022 RM, K.2 and
currently implemented in GNAT are correctly categorized.

This change only affects code with restriction
No_Implementation_Attributes.

gcc/ada/

	* sem_attr.adb (Attribute_22): Add Put_Image and Object_Size.
	* sem_attr.ads (Attribute_Impl_Def): Remove Object_Size.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_attr.adb |  4 +++-
 gcc/ada/sem_attr.ads | 11 -----------
 2 files changed, 3 insertions(+), 12 deletions(-)
  

Patch

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 9c3bc62d321..c2bb094492d 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -185,7 +185,9 @@  package body Sem_Attr is
      (Attribute_Enum_Rep                     |
       Attribute_Enum_Val                     |
       Attribute_Index                        |
-      Attribute_Preelaborable_Initialization => True,
+      Attribute_Object_Size                  |
+      Attribute_Preelaborable_Initialization |
+      Attribute_Put_Image                    => True,
       others                                 => False);
 
    --  The following array contains all attributes that imply a modification
diff --git a/gcc/ada/sem_attr.ads b/gcc/ada/sem_attr.ads
index 52359e40ef6..17dce1fb0b0 100644
--- a/gcc/ada/sem_attr.ads
+++ b/gcc/ada/sem_attr.ads
@@ -381,17 +381,6 @@  package Sem_Attr is
       --  other composite object passed by reference, there is no other way
       --  of specifying that a zero address should be passed.
 
-      -----------------
-      -- Object_Size --
-      -----------------
-
-      Attribute_Object_Size => True,
-      --  Type'Object_Size is the same as Type'Size for all types except
-      --  fixed-point types and discrete types. For fixed-point types and
-      --  discrete types, this attribute gives the size used for default
-      --  allocation of objects and components of the size. See section in
-      --  Einfo ("Handling of Type'Size values") for further details.
-
       -------------------------
       -- Passed_By_Reference --
       -------------------------