aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2022-08-12 17:04:38 -0700
committerMarc Poulhiès <poulhies@adacore.com>2022-09-06 09:14:23 +0200
commit71747dda9d491b8b28df20eaed84c71ca75f51d0 (patch)
tree1312ebe331a83136add4714f4cd2f6c4a2a3c1ec /gcc/ada/sem_attr.adb
parentfc737a6c2001e303a3509df7b1125b8e3d7ea651 (diff)
downloadgcc-71747dda9d491b8b28df20eaed84c71ca75f51d0.zip
gcc-71747dda9d491b8b28df20eaed84c71ca75f51d0.tar.gz
gcc-71747dda9d491b8b28df20eaed84c71ca75f51d0.tar.bz2
[Ada] Enable lock free protected implementation by default
In the past, the Lock_Free aspect of a protected type (including an anonymous type) defaulted to False. In the case where an explicit "Lock_Free => True" aspect specification would be legal, the aspect now defaults to True (which means that a lock-free implementation is used to implement the type's protected operations); this is like the previous behavior of the compiler with the -gnatd9 switch specified. Support for the Lock_Free attribute (which should not be confused with the Lock_Free aspect) is removed. gcc/ada/ * debug.adb: Remove comment regarding the -gnatd9 switch. * doc/gnat_rm/implementation_defined_attributes.rst: Remove all mention of the Lock_Free attribute. * gnat_rm.texi, gnat_ugn.texi: Regenerate. * exp_attr.adb, sem_attr.adb: Remove all mention of the former Attribute_Lock_Free enumeration element of the Attribute_Id type. * sem_ch9.adb (Allows_Lock_Free_Implementation): Remove the Debug_Flag_9 test. Return False in the case of a protected function whose result type requires use of the secondary stack. (Satisfies_Lock_Free_Requirements): This functions checks for certain constructs and returns False if one is found. In the case of a protected function, there is no need to check to see if the protected object is being modified. So it is ok to omit *some* checks in the case of a protected function. But other checks which are required (e.g., the test for a reference to a variable that is not part of the protected object) were being incorrectly omitted. This could result in accepting "Lock_Free => True" aspect specifications that should be rejected. * snames.adb-tmpl: Name_Lock_Free no longer requires special treatment in Get_Pragma_Id or Is_Pragma_Name (because it is no longer an attribute name). * snames.ads-tmpl: Move the declaration of Name_Lock_Free to reflect the fact that it is no longer the name of an attribute. Delete Attribute_Lock_Free from the Attribute_Id enumeration type.
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb44
1 files changed, 1 insertions, 43 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 93bb6f4..86c7d0f 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -4697,19 +4697,6 @@ package body Sem_Attr is
Set_Etype (N, Standard_Boolean);
- ---------------
- -- Lock_Free --
- ---------------
-
- when Attribute_Lock_Free =>
- Check_E0;
- Set_Etype (N, Standard_Boolean);
-
- if not Is_Protected_Type (P_Type) then
- Error_Attr_P
- ("prefix of % attribute must be a protected object");
- end if;
-
----------------
-- Loop_Entry --
----------------
@@ -8338,15 +8325,6 @@ package body Sem_Attr is
return;
- -- For Lock_Free, we apply the attribute to the type of the object.
- -- This is allowed since we have already verified that the type is a
- -- protected type.
-
- elsif Id = Attribute_Lock_Free then
- P_Entity := Etype (P);
-
- -- No other attributes for objects are folded
-
else
Check_Expressions;
return;
@@ -8476,7 +8454,6 @@ package body Sem_Attr is
Id = Attribute_Has_Access_Values or else
Id = Attribute_Has_Discriminants or else
Id = Attribute_Has_Tagged_Values or else
- Id = Attribute_Lock_Free or else
Id = Attribute_Preelaborable_Initialization or else
Id = Attribute_Type_Class or else
Id = Attribute_Unconstrained_Array or else
@@ -8595,7 +8572,7 @@ package body Sem_Attr is
-- only the First, Last and Length attributes are possibly static.
-- Atomic_Always_Lock_Free, Definite, Descriptor_Size, Has_Access_Values
- -- Has_Discriminants, Has_Tagged_Values, Lock_Free, Type_Class, and
+ -- Has_Discriminants, Has_Tagged_Values, Type_Class, and
-- Unconstrained_Array are again exceptions, because they apply as well
-- to unconstrained types.
@@ -8614,7 +8591,6 @@ package body Sem_Attr is
Id = Attribute_Has_Access_Values or else
Id = Attribute_Has_Discriminants or else
Id = Attribute_Has_Tagged_Values or else
- Id = Attribute_Lock_Free or else
Id = Attribute_Preelaborable_Initialization or else
Id = Attribute_Type_Class or else
Id = Attribute_Unconstrained_Array or else
@@ -9315,24 +9291,6 @@ package body Sem_Attr is
True);
end if;
- ---------------
- -- Lock_Free --
- ---------------
-
- when Attribute_Lock_Free => Lock_Free : declare
- V : constant Entity_Id := Boolean_Literals (Uses_Lock_Free (P_Type));
-
- begin
- Rewrite (N, New_Occurrence_Of (V, Loc));
-
- -- Analyze and resolve as boolean. Note that this attribute is a
- -- static attribute in GNAT.
-
- Analyze_And_Resolve (N, Standard_Boolean);
- Static := True;
- Set_Is_Static_Expression (N);
- end Lock_Free;
-
----------
-- Last --
----------