-------------------------------------
-- Note: internally Disable/Enable_Atomic_Synchronization is implemented
- -- using a bogus check called Atomic_Synchronization. This is to make it
- -- more convenient to get exactly the same semantics as [Un]Suppress.
+ -- using a pseudo-check called _Atomic_Synchronization. This is to make it
+ -- more convenient to get the same placement and scope rules as
+ -- [Un]Suppress. The check name has a leading underscore to make
+ -- it reserved by the implementation.
function Atomic_Synchronization_Disabled (E : Entity_Id) return Boolean is
begin
*
"Implementation-defined check names. See 11.5(27)."
-The implementation defined check names include Alignment_Check,
-Atomic_Synchronization, Container_Checks, Duplicated_Tag_Check,
-Predicate_Check, Raise_Check, Tampering_Check, and Validity_Check.
-In addition, a user program can add implementation-defined check
-names by means of the pragma Check_Name. See the description of
-pragma ``Suppress`` for full details.
+The implementation-defined check names include Alignment_Check,
+Container_Checks, Duplicated_Tag_Check, Predicate_Check,
+Raise_Check, Tampering_Check, and Validity_Check. In addition, a
+user program can add implementation-defined check names by means
+of the pragma Check_Name. See the description of pragma
+``Suppress`` for details.
*
"Existence and meaning of second parameter of pragma Unsuppress.
pragma Disable_Atomic_Synchronization [(Entity)];
+ pragma Enable_Atomic_Synchronization [(Entity)];
Ada requires that accesses (reads or writes) of an atomic variable be
regarded as synchronization points in the case of multiple tasks.
Particularly in the case of multi-processors this may require special
-handling, e.g. the generation of memory barriers. This capability may
-be turned off using this pragma in cases where it is known not to be
-required.
-
-The placement and scope rules for this pragma are the same as those
-for ``pragma Suppress``. In particular it can be used as a
-configuration pragma, or in a declaration sequence where it applies
-till the end of the scope. If an ``Entity`` argument is present,
+handling, e.g. the generation of memory barriers. This synchronization
+is performed by default, but can be turned off using pragma
+``Disable_Atomic_Synchronization``.
+The ``Enable_Atomic_Synchronization`` pragma turns it back on.
+
+The placement and scope rules for these pragmas are the same as those
+for ``pragma Suppress``. In particular they can be used as
+configuration pragmas, or in a declaration sequence where they apply
+until the end of the scope. If an ``Entity`` argument is present,
the action applies only to that entity.
Pragma Dispatching_Domain
pragma Enable_Atomic_Synchronization [(Entity)];
-
-Ada requires that accesses (reads or writes) of an atomic variable be
-regarded as synchronization points in the case of multiple tasks.
-Particularly in the case of multi-processors this may require special
-handling, e.g. the generation of memory barriers. This synchronization
-is performed by default, but can be turned off using
-``pragma Disable_Atomic_Synchronization``. The
-``Enable_Atomic_Synchronization`` pragma can be used to turn
-it back on.
-
-The placement and scope rules for this pragma are the same as those
-for ``pragma Unsuppress``. In particular it can be used as a
-configuration pragma, or in a declaration sequence where it applies
-till the end of the scope. If an ``Entity`` argument is present,
-the action applies only to that entity.
+Reenables atomic synchronization; see ``pragma Disable_Atomic_Synchronization``
+for details.
Pragma Exceptional_Cases
========================
execution if that assumption is wrong.
The checks subject to suppression include all the checks defined by the Ada
- standard, the additional implementation defined checks ``Alignment_Check``,
- ``Duplicated_Tag_Check``, ``Predicate_Check``, ``Container_Checks``, ``Tampering_Check``,
- and ``Validity_Check``, as well as any checks introduced using ``pragma Check_Name``.
- Note that ``Atomic_Synchronization`` is not automatically suppressed by use of this option.
+ standard, as well as all implementation-defined checks,
+ including any checks introduced using ``pragma Check_Name``.
If the code depends on certain checks being active, you can use
pragma ``Unsuppress`` either as a configuration pragma or as
-- N is a node for which atomic synchronization may be required (it is
-- either an identifier, expanded name, or selected/indexed component or
-- an explicit dereference). The caller has checked the basic conditions
- -- (atomic variable appearing and Atomic_Sync not disabled). This function
- -- checks if atomic synchronization is required and if so sets the flag
- -- and if appropriate generates a warning (in -gnatw.n mode).
+ -- (atomic variable appearing and Atomic_Synchronization enabled). This
+ -- function checks if atomic synchronization is required and if so sets
+ -- the flag and (in -gnatw.n mode) generates a warning.
procedure Adjust_Condition (N : Node_Id);
-- The node N is an expression whose root-type is Boolean, and which
end if;
end if;
- -- Set default for atomic synchronization. As this synchronization
- -- between atomic accesses can be expensive, and not typically needed
- -- on some targets, an optional target parameter can turn the option
- -- off. Note Atomic Synchronization is implemented as check.
+ -- Set default for atomic synchronization
Suppress_Options.Suppress (Atomic_Synchronization) :=
not Atomic_Sync_Default_On_Target;
@copying
@quotation
-GNAT Reference Manual , Nov 08, 2024
+GNAT Reference Manual , Nov 18, 2024
AdaCore
@example
pragma Disable_Atomic_Synchronization [(Entity)];
+
+pragma Enable_Atomic_Synchronization [(Entity)];
@end example
Ada requires that accesses (reads or writes) of an atomic variable be
regarded as synchronization points in the case of multiple tasks.
Particularly in the case of multi-processors this may require special
-handling, e.g. the generation of memory barriers. This capability may
-be turned off using this pragma in cases where it is known not to be
-required.
-
-The placement and scope rules for this pragma are the same as those
-for @code{pragma Suppress}. In particular it can be used as a
-configuration pragma, or in a declaration sequence where it applies
-till the end of the scope. If an @code{Entity} argument is present,
+handling, e.g. the generation of memory barriers. This synchronization
+is performed by default, but can be turned off using pragma
+@code{Disable_Atomic_Synchronization}.
+The @code{Enable_Atomic_Synchronization} pragma turns it back on.
+
+The placement and scope rules for these pragmas are the same as those
+for @code{pragma Suppress}. In particular they can be used as
+configuration pragmas, or in a declaration sequence where they apply
+until the end of the scope. If an @code{Entity} argument is present,
the action applies only to that entity.
@node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
pragma Enable_Atomic_Synchronization [(Entity)];
@end example
-Ada requires that accesses (reads or writes) of an atomic variable be
-regarded as synchronization points in the case of multiple tasks.
-Particularly in the case of multi-processors this may require special
-handling, e.g. the generation of memory barriers. This synchronization
-is performed by default, but can be turned off using
-@code{pragma Disable_Atomic_Synchronization}. The
-@code{Enable_Atomic_Synchronization} pragma can be used to turn
-it back on.
-
-The placement and scope rules for this pragma are the same as those
-for @code{pragma Unsuppress}. In particular it can be used as a
-configuration pragma, or in a declaration sequence where it applies
-till the end of the scope. If an @code{Entity} argument is present,
-the action applies only to that entity.
+Reenables atomic synchronization; see @code{pragma Disable_Atomic_Synchronization}
+for details.
@node Pragma Exceptional_Cases,Pragma Export_Function,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
@anchor{gnat_rm/implementation_defined_pragmas pragma-exceptional-cases}@anchor{61}
“Implementation-defined check names. See 11.5(27).”
@end itemize
-The implementation defined check names include Alignment_Check,
-Atomic_Synchronization, Container_Checks, Duplicated_Tag_Check,
-Predicate_Check, Raise_Check, Tampering_Check, and Validity_Check.
-In addition, a user program can add implementation-defined check
-names by means of the pragma Check_Name. See the description of
-pragma @code{Suppress} for full details.
+The implementation-defined check names include Alignment_Check,
+Container_Checks, Duplicated_Tag_Check, Predicate_Check,
+Raise_Check, Tampering_Check, and Validity_Check. In addition, a
+user program can add implementation-defined check names by means
+of the pragma Check_Name. See the description of pragma
+@code{Suppress} for details.
@itemize *
@copying
@quotation
-GNAT User's Guide for Native Platforms , Nov 08, 2024
+GNAT User's Guide for Native Platforms , Nov 18, 2024
AdaCore
execution if that assumption is wrong.
The checks subject to suppression include all the checks defined by the Ada
-standard, the additional implementation defined checks @code{Alignment_Check},
-@code{Duplicated_Tag_Check}, @code{Predicate_Check}, @code{Container_Checks}, @code{Tampering_Check},
-and @code{Validity_Check}, as well as any checks introduced using @code{pragma Check_Name}.
-Note that @code{Atomic_Synchronization} is not automatically suppressed by use of this option.
+standard, as well as all implementation-defined checks,
+including any checks introduced using @code{pragma Check_Name}.
If the code depends on certain checks being active, you can use
pragma @code{Unsuppress} either as a configuration pragma or as
@printindex ge
-@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ }
@anchor{d2}@w{ }
+@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ }
@c %**end of body
@bye
Check_No_Identifiers;
Check_At_Most_N_Arguments (1);
- -- Modeled internally as
- -- pragma Suppress/Unsuppress (Atomic_Synchronization [,Entity])
+ -- Implemented internally as
+ -- pragma Suppress/Unsuppress (_Atomic_Synchronization [,Entity])
Rewrite (N,
Make_Pragma (Loc,
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression =>
- Make_Identifier (Loc, Name_Atomic_Synchronization)))));
+ Make_Identifier (Loc, Name_uAtomic_Synchronization)))));
if Present (Arg1) then
Append_To (Pragma_Argument_Associations (N), New_Copy (Arg1));
-- not a real check.
for J in Scope_Suppress.Suppress'Range loop
- if J /= Elaboration_Check
- and then
- J /= Atomic_Synchronization
- then
+ if J not in Elaboration_Check | Atomic_Synchronization then
Scope_Suppress.Suppress (J) := Suppress_Case;
end if;
end loop;
-- If not All_Checks, and predefined check, then set appropriate
-- scope entry. Note that we will set Elaboration_Check if this
- -- is explicitly specified. Atomic_Synchronization is allowed
- -- only if internally generated and entity is atomic.
+ -- is explicitly specified.
- elsif C in Predefined_Check_Id
- and then (not Comes_From_Source (N)
- or else C /= Atomic_Synchronization)
- then
+ elsif C in Predefined_Check_Id then
Scope_Suppress.Suppress (C) := Suppress_Case;
end if;
-- Names of recognized checks for pragma Suppress
- -- Note: the name Atomic_Synchronization can only be specified internally
- -- as a result of using pragma Enable/Disable_Atomic_Synchronization.
+ -- Note: the name _Atomic_Synchronization is used only internally
+ -- as a result of using pragmas Disable/Enable_Atomic_Synchronization.
First_Check_Name : constant Name_Id := N + $;
Name_Access_Check : constant Name_Id := N + $;
Name_Accessibility_Check : constant Name_Id := N + $;
Name_Alignment_Check : constant Name_Id := N + $; -- GNAT
Name_Allocation_Check : constant Name_Id := N + $;
- Name_Atomic_Synchronization : constant Name_Id := N + $; -- GNAT
+ Name_uAtomic_Synchronization : constant Name_Id := N + $; -- GNAT
Name_Characters_Assertion_Check : constant Name_Id := N + $;
Name_Containers_Assertion_Check : constant Name_Id := N + $;
Name_Discriminant_Check : constant Name_Id := N + $;
-- check.
for J in Suppress_Options.Suppress'Range loop
- if J /= Elaboration_Check
- and then
- J /= Atomic_Synchronization
+ if J not in Elaboration_Check | Atomic_Synchronization
then
Suppress_Options.Suppress (J) := True;
end if;
Atomic_Sync_Default_On_Target : Boolean := True;
-- Access to atomic variables requires memory barrier synchronization in
-- the general case to ensure proper behavior when such accesses are used
- -- on a multi-processor to synchronize tasks (e.g. by using spin locks).
+ -- on a multiprocessor to synchronize tasks (e.g. by using spin locks).
-- The setting of this flag determines the default behavior. Normally this
-- is True, which will mean that appropriate synchronization instructions
-- are generated by default. If it is False, then the default will be that
-- these synchronization instructions are not generated. This may be a more
-- appropriate default in some cases, e.g. on embedded targets which do not
- -- allow the possibility of multi-processors. The default can be overridden
- -- using pragmas Enable/Disable_Atomic_Synchronization and also by use of
+ -- allow the possibility of multiprocessors. The default can be overridden
+ -- using pragmas Disable/Enable_Atomic_Synchronization and also by use of
-- the corresponding debug flags -gnatd.e and -gnatd.d.
Support_Aggregates_On_Target : Boolean := True;
Tasking_Check : constant := 28;
Raise_Check : constant := 29;
-- Values used to represent individual predefined checks (including the
- -- setting of Atomic_Synchronization, which is implemented internally using
- -- a "check" whose name is Atomic_Synchronization).
+ -- pseudo-check _Atomic_Synchronization).
All_Checks : constant := 30;
-- Value used to represent All_Checks value