Tests executables made several assumptions that are only valid on
some system/compiler:
* That the main function is found even in a shared library (not true
on windows). To fix this, test_main is now an ojbect library
* That the extern test_registry in test.cpp will be initialized
before any actual test uses it. This was either a lucky coincidence
on linux, or being related to the variable being initialized in a
shared library. The variable is now initialized by a function,
guarantaaing initialization order.
* That test.hpp is only inluded once per binary, which was only true
because it was once part of a DLL, once the executable, hiding ODR
violations. As now it's linked twice within the same binary, some
functions had to be made inline.
* not is not a valid C++ operator, replaced all occurences with !
Linux is not synonymous with glibc. Alpine linux (among others) uses
libmusl as the standard C library. Alpine/libmusl doesn't have
backtrace, dladdr1, execinfo.h or error.h. It does have libunwind
and program_invocation_name and libdwarf and libelf are available as
packages.
This patch makes backward-cpp work on Alpine linux (and hopefully
others that rely on libmusl).
This patch makes dladdr1 dependent on the __GLIBC__ pp-symbol
(rather than __ANDROID__).
It uses __has_include (protected by a defined()) rather than __APPLE__
to decide whether to include <error.h> in _test_main.cpp.
* functional mac port
* combine common parts of Linux and Darwin implementations
* add unwind support for apple
* insure BACKWARD_HAS_BACKTRACE_SYMBOL is set for BACKWARD_SYSTEM_DARWIN
* fix indentation
* use pthread_self and pthread_main_np