From 30c6e576a32bfa132fd57434a80b35b712f05458 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 14 Jan 2020 21:56:28 +0100 Subject: [PATCH] [Ada] Get rid of more references to Universal_Integer in expanded code 2020-06-03 Eric Botcazou gcc/ada/ * libgnat/s-atopar.adb (Atomic_Fetch_And_Add): Make use of an equivalent static expression. (Atomic_Fetch_And_Subtract): Likewise. (Is_Lock_Free): Likewise. * libgnat/s-atopex.adb (Atomic_Exchange): Likewise. (Atomic_Compare_And_Exchange): Likewise. (Is_Lock_Free): Likewise. --- gcc/ada/libgnat/s-atopar.adb | 7 ++++--- gcc/ada/libgnat/s-atopex.adb | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gcc/ada/libgnat/s-atopar.adb b/gcc/ada/libgnat/s-atopar.adb index 1fad13c2f8d..d4590c708e8 100644 --- a/gcc/ada/libgnat/s-atopar.adb +++ b/gcc/ada/libgnat/s-atopar.adb @@ -88,7 +88,7 @@ package body System.Atomic_Operations.Arithmetic is pragma Warnings (On); begin - case Item'Size is + case Atomic_Type'Size is when 8 => return Atomic_Fetch_Add_1 (Item'Address, Value); when 16 => return Atomic_Fetch_Add_2 (Item'Address, Value); when 32 => return Atomic_Fetch_Add_4 (Item'Address, Value); @@ -125,7 +125,7 @@ package body System.Atomic_Operations.Arithmetic is pragma Warnings (On); begin - case Item'Size is + case Atomic_Type'Size is when 8 => return Atomic_Fetch_Sub_1 (Item'Address, Value); when 16 => return Atomic_Fetch_Sub_2 (Item'Address, Value); when 32 => return Atomic_Fetch_Sub_4 (Item'Address, Value); @@ -139,9 +139,10 @@ package body System.Atomic_Operations.Arithmetic is ------------------ function Is_Lock_Free (Item : aliased Atomic_Type) return Boolean is + pragma Unreferenced (Item); use type Interfaces.C.size_t; begin - return Boolean (Atomic_Always_Lock_Free (Item'Size / 8)); + return Boolean (Atomic_Always_Lock_Free (Atomic_Type'Size / 8)); end Is_Lock_Free; end System.Atomic_Operations.Arithmetic; diff --git a/gcc/ada/libgnat/s-atopex.adb b/gcc/ada/libgnat/s-atopex.adb index b0a6ccc72b7..1c2921f9151 100644 --- a/gcc/ada/libgnat/s-atopex.adb +++ b/gcc/ada/libgnat/s-atopex.adb @@ -66,7 +66,7 @@ package body System.Atomic_Operations.Exchange is pragma Warnings (On); begin - case Item'Size is + case Atomic_Type'Size is when 8 => return Atomic_Exchange_1 (Item'Address, Value); when 16 => return Atomic_Exchange_2 (Item'Address, Value); when 32 => return Atomic_Exchange_4 (Item'Address, Value); @@ -124,7 +124,7 @@ package body System.Atomic_Operations.Exchange is pragma Warnings (On); begin - case Item'Size is + case Atomic_Type'Size is when 8 => return Boolean (Atomic_Compare_Exchange_1 @@ -151,9 +151,10 @@ package body System.Atomic_Operations.Exchange is ------------------ function Is_Lock_Free (Item : aliased Atomic_Type) return Boolean is + pragma Unreferenced (Item); use type Interfaces.C.size_t; begin - return Boolean (Atomic_Always_Lock_Free (Item'Size / 8)); + return Boolean (Atomic_Always_Lock_Free (Atomic_Type'Size / 8)); end Is_Lock_Free; end System.Atomic_Operations.Exchange; -- 2.30.2