diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2021-03-03 21:19:39 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-16 04:43:05 -0400 |
commit | ccf0dee109ba0c71ca2b6e093a874daf1671ecf0 (patch) | |
tree | 422566c190c5f5def4f68f8e4eadf5b5414fa51c /gcc | |
parent | 1a9ff8d39c1f5a63755f2a8bb0a982c7af4ee817 (diff) | |
download | gcc-ccf0dee109ba0c71ca2b6e093a874daf1671ecf0.zip gcc-ccf0dee109ba0c71ca2b6e093a874daf1671ecf0.tar.gz gcc-ccf0dee109ba0c71ca2b6e093a874daf1671ecf0.tar.bz2 |
[Ada] Fix Is_Volatile_Function for functions declared in protected bodies
gcc/ada/
* sem_util.adb (Is_Volatile_Function): Follow the exact wording
of SPARK (regarding volatile functions) and Ada (regarding
protected functions).
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_util.adb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 6376b4e..6481d86 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -21105,9 +21105,11 @@ package body Sem_Util is begin pragma Assert (Ekind (Func_Id) in E_Function | E_Generic_Function); - -- A function declared within a protected type is volatile + -- A protected function is volatile - if Is_Protected_Type (Scope (Func_Id)) then + if Nkind (Parent (Unit_Declaration_Node (Func_Id))) = + N_Protected_Definition + then return True; -- An instance of Ada.Unchecked_Conversion is a volatile function if |