diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2022-06-02 17:32:15 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-07-05 08:28:18 +0000 |
commit | 9fde6c7114f079b38ebee420a541e14387bcc928 (patch) | |
tree | 75e83513ce19cd081a5feaa6c747bb16c94fcc94 /gcc/ada/libgnat | |
parent | 684194f4a45e00e56687289386eea7105a762cf7 (diff) | |
download | gcc-9fde6c7114f079b38ebee420a541e14387bcc928.zip gcc-9fde6c7114f079b38ebee420a541e14387bcc928.tar.gz gcc-9fde6c7114f079b38ebee420a541e14387bcc928.tar.bz2 |
[Ada] Remove unnecessary dead code after calls to nonreturning procedures
A new warning about unreachable code that follows calls to procedures
with No_Return would flag some dead defensive code. Comments next to
this code suggest that it was added to please some ancient version of
the compiler, but recent releases of GNAT do not require such a code.
gcc/ada/
* gnatls.adb (Corresponding_Sdep_Entry): Remove dead return
statement in defensive path; there is another return statement
for a normal execution of this routine, so rule Ada RM 6.5(5),
which requires function to have at least one return statement is
still satisfied.
(Gnatls): Remove dead, call to nonreturning Exit_Program after
Output_License_Information which itself does not return.
* libgnat/a-exstat.adb (Bad_EO): Remove raise statement that was
meant to please some ancient version of GNAT.
* libgnat/g-awk.adb (Raise_With_Info): Likewise.
* sem_attr.adb (Check_Reference): Remove dead return statement;
rule Ada RM 6.5(5), which requires function to have at least one
return statement is still satisfied.
(Analyze_Attribute): Remove dead exit statement.
(Check_Reference): Same as above.
* sem_ch12.adb (Instantiate_Formal_Package): Remove dead raise
statement; it was inconsistent with other calls to
Abandon_Instantiation, which are not followed by a raise
statement.
* sem_prag.adb (Process_Convention): Remove dead defensive
assignment.
(Interrupt_State): Remove dead defensive exit statement.
(Do_SPARK_Mode): Likewise.
* sfn_scan.adb (Scan_String): Remove dead defensive assignment.
Diffstat (limited to 'gcc/ada/libgnat')
-rw-r--r-- | gcc/ada/libgnat/a-exstat.adb | 7 | ||||
-rw-r--r-- | gcc/ada/libgnat/g-awk.adb | 1 |
2 files changed, 0 insertions, 8 deletions
diff --git a/gcc/ada/libgnat/a-exstat.adb b/gcc/ada/libgnat/a-exstat.adb index a3f808e..acc2516 100644 --- a/gcc/ada/libgnat/a-exstat.adb +++ b/gcc/ada/libgnat/a-exstat.adb @@ -109,13 +109,6 @@ package body Stream_Attributes is Raise_Exception (Program_Error'Identity, "bad exception occurrence in stream input"); - - -- The following junk raise of Program_Error is required because - -- this is a No_Return procedure, and unfortunately Raise_Exception - -- can return (this particular call can't, but the back end is not - -- clever enough to know that). - - raise Program_Error; end Bad_EO; procedure Next_String is diff --git a/gcc/ada/libgnat/g-awk.adb b/gcc/ada/libgnat/g-awk.adb index 1c88785..9b2e127 100644 --- a/gcc/ada/libgnat/g-awk.adb +++ b/gcc/ada/libgnat/g-awk.adb @@ -1211,7 +1211,6 @@ package body GNAT.AWK is Exceptions.Raise_Exception (E, '[' & Filename & ':' & Line & "] " & Message); - raise Constraint_Error; -- to please GNAT as this is a No_Return proc end Raise_With_Info; --------------- |