Anyone? On Sun, Aug 13, 2023 at 4:48 PM Julian Waters <tanksherma...@gmail.com> wrote:
> Please review a patch to add clang's invalid-noreturn flag to toggle > noreturn warnings. This patch keeps the old behaviour of always warning on > every noreturn violation, but unlike clang also adds an extra layer of fine > tuning by turning invalid-noreturn into a warning with levels, where level > 1 warns about noreturn functions that do return, level 2 warns about > noreturn functions that explicitly have return statements, and level 3, > which is the default to match old behaviour, warns for both instances. > > gcc/doc/ChangeLog: > > * invoke.texi (-Wno-invalid-noreturn, -Winvalid-noreturn=): Document new > options. > > gcc/ChangeLog: > > * tree-cfg.cc (pass_warn_function_return::execute) > : Use new warning option. > > gcc/c-family/ChangeLog: > > * c.opt (Winvalid-noreturn, Winvalid-noreturn=): New options. > > gcc/c/ChangeLog: > > * c-typeck.cc (c_finish_return): Use new warning option. > * gimple-parser.cc (c_finish_gimple_return): Likewise. > > gcc/cp/ChangeLog: > > * coroutines.cc (finish_co_return_stmt): Use new warning option. > * typeck.cc (check_return_expr): Likewise. > > gcc/c-family/c.opt | 8 ++++++++ > gcc/c/c-typeck.cc | 9 ++++++--- > gcc/c/gimple-parser.cc | 9 ++++++--- > gcc/cp/coroutines.cc | 11 +++++++---- > gcc/cp/typeck.cc | 7 +++++-- > gcc/doc/invoke.texi | 26 ++++++++++++++++++++++++++ > gcc/tree-cfg.cc | 5 ++++- > 7 files changed, 62 insertions(+), 13 deletions(-) > > >