Skip to content
Snippets Groups Projects
Commit d1268ce0 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

vtkFloatingPointExceptions: use `extern "C"` for `signal_handler`

C++17 allows non-C functions to be put here. However, this handler is
already very suspect because it uses `cerr` which is generally very not
allowed in signal handlers (there's a lock involved somewhere and a
deadlock is going to happen if another thread is using `cerr`).

Anyways, just resolve the `bugprone-signal-handler` lint for now.
parent f2bada0e
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@
#if defined(VTK_USE_FENV)
#include <csignal>
#include <cstdio>
#include <fenv.h>
#endif
......@@ -33,9 +34,10 @@
namespace
{
void signal_handler(int signal)
extern "C" void signal_handler(int signal)
{
cerr << "Error: Floating point exception detected. Signal " << signal << endl;
// NOLINTNEXTLINE(bugprone-signal-handler)
fprintf(stderr, "Error: Floating point exception detected. Signal %d\n", signal);
// This should possibly throw an exception rather than abort, abort should
// at least give access to the stack when it fails here.
abort();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment