diff mbox series

[Ada] Clarify code for detecting volatile refinement properties

Message ID 20220516084256.GA3843342@adacore.com
State New
Headers show
Series [Ada] Clarify code for detecting volatile refinement properties | expand

Commit Message

Pierre-Marie de Rodat May 16, 2022, 8:42 a.m. UTC
Routine Type_Or_Variable_Has_Enabled_Property handles either types or
objects; replace negation with an explicit positive condition.

Cleanup related to handling of volatile refinement aspects in SPARK;
behaviour is unaffected.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_util.adb (Type_Or_Variable_Has_Enabled_Property): Clarify.
diff mbox series

Patch

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -12696,10 +12696,10 @@  package body Sem_Util is
             return Type_Or_Variable_Has_Enabled_Property
               (First_Subtype (Etype (Base_Type (Item_Id))));
 
-         --  If not specified explicitly for an object and the type
+         --  If not specified explicitly for an object and its type
          --  is effectively volatile, then take result from the type.
 
-         elsif not Is_Type (Item_Id)
+         elsif Is_Object (Item_Id)
            and then Is_Effectively_Volatile (Etype (Item_Id))
          then
             return Has_Enabled_Property (Etype (Item_Id), Property);