]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Warn about unreachable code after calls with No_Return
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 3 Jun 2022 13:18:24 +0000 (15:18 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 12 Jul 2022 12:24:11 +0000 (12:24 +0000)
commit1710ba9e5d09493690c5f474a5c37b5c8f5d7b19
tree8e0d8ef1e695dcbd46c435df9b6c1dee75a90edd
parent2148f2996ae76a7773eb7d8e30c02bd036ec7b3c
[Ada] Warn about unreachable code after calls with No_Return

GNAT was already warning about unreachable code after raise/goto/exit
statements, but not after calls to procedures with No_Return. Now this
warning is extended.

Also, previously the warning was suppressed for unreachable RETURN after
RAISE statements. Now this suppression is narrowed to functions, because
only in function such a RETURN statement might be indeed needed (where
it is the only RETURN statement of a function).

gcc/ada/

* sem_ch5.adb (Check_Unreachable_Code): Extend suppression to
calls with No_Return aspect, but narrow it to functions.
* sem_res.adb (Resolve_Call): Warn about unreachable code after
calls with No_Return.
gcc/ada/sem_ch5.adb
gcc/ada/sem_res.adb