[Ada] Tweak the warning about missing local raises
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 7 Oct 2021 15:34:21 +0000 (17:34 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 11 Oct 2021 13:38:13 +0000 (13:38 +0000)
gcc/ada/

* gcc-interface/trans.c (gnat_to_gnu) <N_Pop_Constraint_Error_Label>:
Given the warning only if No_Exception_Propagation is active.
<N_Pop_Storage_Error_Label>: Likewise.
<N_Pop_Program_Error_Label>: Likewise.

gcc/ada/gcc-interface/trans.c

index 3fec060..8a192c7 100644 (file)
@@ -7872,21 +7872,24 @@ gnat_to_gnu (Node_Id gnat_node)
     case N_Pop_Constraint_Error_Label:
       gnat_temp = gnu_constraint_error_label_stack.pop ();
       if (Present (gnat_temp)
-         && !TREE_USED (gnat_to_gnu_entity (gnat_temp, NULL_TREE, false)))
+         && !TREE_USED (gnat_to_gnu_entity (gnat_temp, NULL_TREE, false))
+         && No_Exception_Propagation_Active ())
        Warn_If_No_Local_Raise (gnat_temp);
       break;
 
     case N_Pop_Storage_Error_Label:
       gnat_temp = gnu_storage_error_label_stack.pop ();
       if (Present (gnat_temp)
-         && !TREE_USED (gnat_to_gnu_entity (gnat_temp, NULL_TREE, false)))
+         && !TREE_USED (gnat_to_gnu_entity (gnat_temp, NULL_TREE, false))
+         && No_Exception_Propagation_Active ())
        Warn_If_No_Local_Raise (gnat_temp);
       break;
 
     case N_Pop_Program_Error_Label:
       gnat_temp = gnu_program_error_label_stack.pop ();
       if (Present (gnat_temp)
-         && !TREE_USED (gnat_to_gnu_entity (gnat_temp, NULL_TREE, false)))
+         && !TREE_USED (gnat_to_gnu_entity (gnat_temp, NULL_TREE, false))
+         && No_Exception_Propagation_Active ())
        Warn_If_No_Local_Raise (gnat_temp);
       break;