Clean up and improve fatal error handling
- Hide gmx_strerror() within fatalerror.cpp, and clean up the
implementation.
- Move more error formatting responsibility into the fatal error handler
in fatalerror.cpp, and make it use the shared formatting code in
errorformat.h. This has a side effect of providing automatic line
wrapping for gmx_fatal().
- Move all output from gmx_abort() to the fatal error output routines.
- Centralize the handling of aborting the program on various error
conditions to gmx_exit_on_fatal_error().
- Flush various streams before calling std::abort() to try to ensure
that there is no buffered data left (such as the just-printed fatal
error).
- Call std::abort() instead of std::exit() in cases where the
application cannot be guaranteed to be in a clean state: std::exit()
calls destructors for all global and static singleton objects, which
can cause issues if, e.g., other threads are still executing code.
- Remove essentially unused code for handling errno in gmx_fatal().
There was a single instance passing anything else except 0, and the
way perror() was used would not produce anything useful in this case,
either.
Change-Id: I0a4c458308cde0e149f986b321caa7cd5cbb1eca