]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Define No_Return flag only for subprograms
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 1 Jul 2024 08:25:07 +0000 (10:25 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 1 Aug 2024 15:14:36 +0000 (17:14 +0200)
...instead of defining it for all entities.

gcc/ada/

* einfo.ads (No_Return): Change description and adjust
accordingly.
* gen_il-gen-gen_entities.adb (Entity_Kind): Remove No_Return.
(Subprogram_Kind): Add No_Return.
(Generic_Subprogram_Kind): Likewise.
* sem_ch6.adb (Analyze_Return_Statement): Adjust No_Return test.

gcc/ada/einfo.ads
gcc/ada/gen_il-gen-gen_entities.adb
gcc/ada/sem_ch6.adb

index e51ab691860aacb8812ba0675afa9f97dac24158..95f524e6c219248375b5ecc751eebc862757a16f 100644 (file)
@@ -3799,8 +3799,8 @@ package Einfo is
 --       pragma No_Component_Reordering applies.
 
 --    No_Return
---       Defined in all entities. Set for subprograms and generic subprograms
---       to which a valid aspect or pragma No_Return applies.
+--       Defined in subprograms and generic subprograms. Set if a valid aspect
+--       or pragma No_Return applies.
 
 --    No_Strict_Aliasing [base type only]
 --       Defined in access types. Set to direct the backend to avoid any
@@ -4969,7 +4969,6 @@ package Einfo is
    --    Materialize_Entity
    --    Needs_Debug_Info
    --    Never_Set_In_Source
-   --    No_Return
    --    Overlays_Constant
    --    Referenced
    --    Referenced_As_LHS
@@ -5579,6 +5578,7 @@ package Einfo is
    --    Is_Visible_Lib_Unit
    --    Is_Wrapper
    --    Needs_No_Actuals
+   --    No_Return
    --    Requires_Overriding                  (non-generic case only)
    --    Return_Present
    --    Returns_By_Ref
index 80b5925ebb850b26aaf8984f1d9399b9f5962a3c..2e0d51f6592c5f068ad104604a8cdf064d00313f 100644 (file)
@@ -215,7 +215,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (Needs_Activation_Record, Flag),
         Sm (Needs_Debug_Info, Flag),
         Sm (Never_Set_In_Source, Flag),
-        Sm (No_Return, Flag),
         Sm (Overlays_Constant, Flag),
         Sm (Prev_Entity, Node_Id),
         Sm (Referenced, Flag),
@@ -985,6 +984,7 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (Linker_Section_Pragma, Node_Id),
         Sm (Overridden_Operation, Node_Id),
         Sm (Protected_Body_Subprogram, Node_Id),
+        Sm (No_Return, Flag),
         Sm (Scope_Depth_Value, Unat),
         Sm (Static_Call_Helper, Node_Id),
         Sm (SPARK_Pragma, Node_Id),
@@ -1193,6 +1193,7 @@ begin -- Gen_IL.Gen.Gen_Entities
        (Sm (Has_Out_Or_In_Out_Parameter, Flag),
         Sm (Is_Primitive, Flag),
         Sm (Next_Inlined_Subprogram, Node_Id),
+        Sm (No_Return, Flag),
         Sm (Overridden_Operation, Node_Id)));
 
    Cc (E_Generic_Function, Generic_Subprogram_Kind,
index 852055a3586a1acf085208319e124d7a5b111d19..0988fad97e8a6f16e3cc6ebbdeb30225ae3fbcaf 100644 (file)
@@ -1937,8 +1937,8 @@ package body Sem_Ch6 is
       --  Check that pragma No_Return is obeyed. Don't complain about the
       --  implicitly-generated return that is placed at the end.
 
-      if No_Return (Scope_Id)
-        and then Kind in E_Procedure | E_Generic_Procedure
+      if Kind in E_Procedure | E_Generic_Procedure
+        and then No_Return (Scope_Id)
         and then Comes_From_Source (N)
       then
          Error_Msg_N