analyzer: Add exit, and _exit replacement, to sm-signal.
authorMark Wielaard <mark@klomp.org>
Sun, 17 May 2020 21:50:41 +0000 (23:50 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 22 May 2020 19:02:34 +0000 (21:02 +0200)
commit2221fb6f668a7edc8b8aad69772907aeabbbb0be
treec04cf71d53e1f9980c4b2cce159a2c752fd607ab
parentdc50686d78d4679b727548c3edc1cb6b0d3b658e
analyzer: Add exit, and _exit replacement, to sm-signal.

Warn about using exit in signal handler and suggest _exit as alternative.

gcc/analyzer/ChangeLog:

* sm-signal.cc(signal_unsafe_call::emit): Possibly add
gcc_rich_location note for replacement.
(signal_unsafe_call::get_replacement_fn): New private function.
(get_async_signal_unsafe_fns): Add "exit".

gcc/testsuite/ChangeLog:

* gcc.dg/analyzer/signal-exit.c: New testcase.
gcc/analyzer/ChangeLog
gcc/analyzer/sm-signal.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/analyzer/signal-exit.c [new file with mode: 0644]