- Rename fatalMessageBox() to fatalMessageBoxWithoutExit(). This should
prevent the kind of bug that prompted this set of changes: someone
calling fatalMessageBox(), assuming the program would stop at that
point, whereas in reality it did not.
- Add new function fatalMessageBoxThenExit(). This is not vital of
course, but allows one to spare one line here and there and to apply
the DRY principle for such fatal exits.
- Replace every existing call to fatalMessageBox() with one or the other
of the two new functions. Improve formatting along the way. This
fixes a few bugs of the kind explained above.
This reverts commit 9e6a3ebc6b ("Make
fatalMessageBox() end with std::abort() and declare it [[noreturn]]").
After reflexion, it seems better to let fatalMessageBox() return,
because there is existing code that appears to be relying on this aspect
to do some work after having called fatalMessageBox() (cf. main() in
bootstrap.cxx). Also, the way of exiting from fatalMessageBox() after
commit 9e6a3ebc6b (std::abort()) was probably too brutal for a
controlled exit---as opposed to a terminate handler.
Also build the test code first, so tests can reside in source tree as
well as the test tree.
Finally, build local Sqlite with -fpic to give consistent linkage when
using either built-in or system sqlite.
If GPerfTools and/or the SYSTEM_SQLITE options are enabled, the test
suite fails to build (GPerfTools is not linked explicitly in CMakeLists.txt,
but becomes required by SimGear, so the linker failes with an "undefined
reference" error; the SQLite library the test suite links against is always
hardcoded to the FG-provided one).
This patch adds the GPerfTools library to the target link libraries
(if the profiler is enabled) and links to the system SQLite library
whenever SYSTEM_SQLITE is enabled.
Compile a useful subset of FG as a shared library, and add two basic
uses of this to exercise some Flightplan / RoutePath / navaid
functions.
The test framework can/will be expanded incrementally from here, this
is just a starting point.
Suggestion: It might be helpful to promote each of
the .c files to .cxx.
Rationale:
-- The configure/makefile system handles CFLAGS
differently from CXXFLAGS.
-- It is important for the *info programs to
compiled and run in exactly the same environment
as the main fgfs program. Some users depend on
compiler or linker flags such as rpath that
strongly affect the results of the *info programs.
-- There is no downside; you code compiles just
fine as-is under the c++ compiler.
second part of the original commit, for ehofman/sound
Suggestion: It might be helpful to promote each of
the .c files to .cxx.
Rationale:
-- The configure/makefile system handles CFLAGS
differently from CXXFLAGS.
-- It is important for the *info programs to
compiled and run in exactly the same environment
as the main fgfs program. Some users depend on
compiler or linker flags such as rpath that
strongly affect the results of the *info programs.
-- There is no downside; you code compiles just
fine as-is under the c++ compiler.
timoore split the original patch so that alcinfo.cxx can be commited to
the ehofman/sound branch seperately.
I believe these patches are really important for Mac users since they don't have to wait for my updating xcode project files.
these also saves up to 50% of build time since most of users don't have to make universal binaries.
* experimental clean-up / reduction on two of the FG headers:
(I'm going to await feedback on the developers list before doing more of
these, to avoiding going over files multiple times, but in principle it
seems pretty straightforward.)
* final fixes for SG_USING_STD removal
- this exposed a bizarre issue on Mac where dragging in <AGL/agl.h> in
extensions.hxx was pulling in all of Carbon to the global namespace
- very scary. As a result, I now need to explicitly include CoreFoundation
in fg_init.cxx.
- change SG_USING_STD(x) to using std::x
SimGear change. It changes all the SG_xxxx to be the 'real' includes, and gets
rid of many #ifdef SG_HAVE_STD_INCLUDES. As an added bonus, rather than
replacing 'SG_USING_NAMESPACE(std)' with 'using namespace std', I just fixed
the small number of places to use std:: explicitly. So we're no longer polluting
the global namespace with the entire contents of std, in many cases.
There is one more 'mechanical' change to come - getting rid of SG_USING_STD(X),
but I want to keep that separate from everything else. (There's another
mechnical change, replacing <math.h> with <cmath> and so on *everywhere*, but
one step at a time)