public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2122] [Ada] Code cleanups in System.Atomic_Counters
@ 2021-07-07 16:26 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-07 16:26 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:347d939028d648d55e72738c7500743ddcc70147
commit r12-2122-g347d939028d648d55e72738c7500743ddcc70147
Author: Arnaud Charlet <charlet@adacore.com>
Date: Wed May 12 05:28:29 2021 -0400
[Ada] Code cleanups in System.Atomic_Counters
gcc/ada/
* libgnat/s-atocou.ads, libgnat/s-atocou__builtin.adb: Code
cleanups.
Diff:
---
gcc/ada/libgnat/s-atocou.ads | 1 -
gcc/ada/libgnat/s-atocou__builtin.adb | 20 +++++---------------
2 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/gcc/ada/libgnat/s-atocou.ads b/gcc/ada/libgnat/s-atocou.ads
index a75173acaa1..9488b6dd731 100644
--- a/gcc/ada/libgnat/s-atocou.ads
+++ b/gcc/ada/libgnat/s-atocou.ads
@@ -101,7 +101,6 @@ private
type Atomic_Counter is record
Value : aliased Atomic_Unsigned := 1;
- pragma Atomic (Value);
end record;
end System.Atomic_Counters;
diff --git a/gcc/ada/libgnat/s-atocou__builtin.adb b/gcc/ada/libgnat/s-atocou__builtin.adb
index 2ca8b9ec6e9..d87f9ad7494 100644
--- a/gcc/ada/libgnat/s-atocou__builtin.adb
+++ b/gcc/ada/libgnat/s-atocou__builtin.adb
@@ -51,24 +51,19 @@ package body System.Atomic_Counters is
procedure Decrement (Item : aliased in out Atomic_Unsigned) is
begin
- if Sync_Sub_And_Fetch (Item'Unrestricted_Access, 1) = 0 then
+ if Sync_Sub_And_Fetch (Item'Unchecked_Access, 1) = 0 then
null;
end if;
end Decrement;
function Decrement (Item : aliased in out Atomic_Unsigned) return Boolean is
begin
- return Sync_Sub_And_Fetch (Item'Unrestricted_Access, 1) = 0;
+ return Sync_Sub_And_Fetch (Item'Unchecked_Access, 1) = 0;
end Decrement;
function Decrement (Item : in out Atomic_Counter) return Boolean is
begin
- -- Note: the use of Unrestricted_Access here is required because we
- -- are obtaining an access-to-volatile pointer to a non-volatile object.
- -- This is not allowed for [Unchecked_]Access, but is safe in this case
- -- because we know that no aliases are being created.
-
- return Sync_Sub_And_Fetch (Item.Value'Unrestricted_Access, 1) = 0;
+ return Sync_Sub_And_Fetch (Item.Value'Unchecked_Access, 1) = 0;
end Decrement;
---------------
@@ -77,17 +72,12 @@ package body System.Atomic_Counters is
procedure Increment (Item : aliased in out Atomic_Unsigned) is
begin
- Sync_Add_And_Fetch (Item'Unrestricted_Access, 1);
+ Sync_Add_And_Fetch (Item'Unchecked_Access, 1);
end Increment;
procedure Increment (Item : in out Atomic_Counter) is
begin
- -- Note: the use of Unrestricted_Access here is required because we are
- -- obtaining an access-to-volatile pointer to a non-volatile object.
- -- This is not allowed for [Unchecked_]Access, but is safe in this case
- -- because we know that no aliases are being created.
-
- Sync_Add_And_Fetch (Item.Value'Unrestricted_Access, 1);
+ Sync_Add_And_Fetch (Item.Value'Unchecked_Access, 1);
end Increment;
----------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-07 16:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 16:26 [gcc r12-2122] [Ada] Code cleanups in System.Atomic_Counters 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).