From 771586854b84f6824112f10f854488979e960094 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 20 Oct 2013 12:58:20 +0200 Subject: [PATCH] Make build information readonly and clean up debug output. --- src/Include/config_cmake.h.in | 5 +++-- src/Main/fg_commands.cxx | 18 ++++++------------ src/Main/fg_io.cxx | 4 ++-- src/Main/main.cxx | 6 ------ src/Main/options.cxx | 27 +++++++++++++-------------- src/Scripting/NasalModelData.cxx | 3 +-- 6 files changed, 25 insertions(+), 38 deletions(-) diff --git a/src/Include/config_cmake.h.in b/src/Include/config_cmake.h.in index 599a3c41d..7f3ee6a04 100644 --- a/src/Include/config_cmake.h.in +++ b/src/Include/config_cmake.h.in @@ -32,8 +32,9 @@ #define PKGLIBDIR "@FG_DATA_DIR@" #define WEB_BROWSER "@WEB_BROWSER@" -#cmakedefine FG_HAVE_HLA -#cmakedefine FG_HAVE_GPERFTOOLS +// Ensure FG_HAVE_xxx always have a value +#define FG_HAVE_HLA (@FG_HAVE_HLA@ + 0) +#define FG_HAVE_GPERFTOOLS (@FG_HAVE_GPERFTOOLS@ + 0) #cmakedefine FG_JPEG_SERVER #cmakedefine SYSTEM_SQLITE diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 2a93954c6..3849b5061 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -52,7 +52,7 @@ #include -#ifdef FG_HAVE_GPERFTOOLS +#if FG_HAVE_GPERFTOOLS # include #endif @@ -1528,7 +1528,7 @@ do_release_cockpit_button (const SGPropertyNode *arg) // Optional profiling commands using gperftools: // http://code.google.com/p/gperftools/ -#ifndef FG_HAVE_GPERFTOOLS +#if !FG_HAVE_GPERFTOOLS static void no_profiling_support() { @@ -1544,7 +1544,7 @@ no_profiling_support() static bool do_profiler_start(const SGPropertyNode *arg) { -#ifdef FG_HAVE_GPERFTOOLS +#if FG_HAVE_GPERFTOOLS const char *filename = arg->getStringValue("filename", "fgfs.profile"); ProfilerStart(filename); return true; @@ -1557,7 +1557,7 @@ do_profiler_start(const SGPropertyNode *arg) static bool do_profiler_stop(const SGPropertyNode *arg) { -#ifdef FG_HAVE_GPERFTOOLS +#if FG_HAVE_GPERFTOOLS ProfilerStop(); return true; #else @@ -1667,14 +1667,8 @@ fgInitCommands () fgTie( "/command/view/next", dummy(0), do_view_next ); fgTie( "/command/view/prev", dummy(0), do_view_prev ); - SGPropertyNode* profiler_available = - globals->get_props()->getNode("/sim/debug/profiler-available", true); -#ifdef FG_HAVE_GPERFTOOLS - profiler_available->setBoolValue(true); -#else - profiler_available->setBoolValue(false); -#endif - profiler_available->setAttributes(SGPropertyNode::READ); + globals->get_props()->setValueReadOnly( "/sim/debug/profiler-available", + bool(FG_HAVE_GPERFTOOLS) ); } // end of fg_commands.cxx diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index 0aa1fa377..45d6a1e61 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -67,7 +67,7 @@ #include #include -#ifdef FG_HAVE_HLA +#if FG_HAVE_HLA #include #endif @@ -228,7 +228,7 @@ FGIO::parse_port_config( const string& config ) return NULL; } -#ifdef FG_HAVE_HLA +#if FG_HAVE_HLA else if ( protocol == "hla" ) { return new FGHLA(tokens); } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 47817c6f1..12d55fdd1 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -328,12 +328,6 @@ int fgMainInit( int argc, char **argv ) { SG_LOG( SG_GENERAL, SG_INFO, "FlightGear: Version " << version ); SG_LOG( SG_GENERAL, SG_INFO, "Built with " << SG_COMPILER_STR << std::endl ); - SG_LOG( SG_GL, - SG_INFO, - "osg::Referenced thread safe reference counting is " - << (osg::Referenced::getThreadSafeReferenceCounting() ? "enabled" - : "disabled") - ); // Allocate global data structures. This needs to happen before // we parse command line options diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 261343b13..9be906cba 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -225,19 +225,18 @@ fgSetDefaults () fgSetInt("/sim/multiplay/rxport", 0); fgSetInt("/sim/multiplay/txport", 0); - fgSetString("/sim/version/flightgear", FLIGHTGEAR_VERSION); - fgSetString("/sim/version/simgear", SG_STRINGIZE(SIMGEAR_VERSION)); - fgSetString("/sim/version/openscenegraph", osgGetVersion()); - fgSetString("/sim/version/revision", REVISION); - fgSetInt("/sim/version/build-number", HUDSON_BUILD_NUMBER); - fgSetString("/sim/version/build-id", HUDSON_BUILD_ID); -#ifdef FG_HAVE_HLA // -DENABLE_RTI=ON - fgSetBool("/sim/version/hla-support", true); -#else // -DENABLE_RTI=OFF - fgSetBool("/sim/version/hla-support", false); -#endif - - char* envp = ::getenv( "http_proxy" ); + SGPropertyNode* v = globals->get_props()->getNode("/sim/version", true); + v->setValueReadOnly("flightgear", FLIGHTGEAR_VERSION); + v->setValueReadOnly("simgear", SG_STRINGIZE(SIMGEAR_VERSION)); + v->setValueReadOnly("openscenegraph", osgGetVersion()); + v->setValueReadOnly("openscenegraph-thread-safe-reference-counting", + osg::Referenced::getThreadSafeReferenceCounting()); + v->setValueReadOnly("revision", REVISION); + v->setValueReadOnly("build-number", HUDSON_BUILD_NUMBER); + v->setValueReadOnly("build-id", HUDSON_BUILD_ID); + v->setValueReadOnly("hla-support", bool(FG_HAVE_HLA)); + + char* envp = ::getenv( "http_proxy" ); if( envp != NULL ) fgSetupProxy( envp ); } @@ -1461,7 +1460,7 @@ struct OptionDesc { {"proxy", true, OPTION_FUNC, "", false, "", fgSetupProxy }, {"callsign", true, OPTION_FUNC, "", false, "", fgOptCallSign}, {"multiplay", true, OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 }, -#ifdef FG_HAVE_HLA +#if FG_HAVE_HLA {"hla", true, OPTION_CHANNEL, "", false, "", 0 }, {"hla-local", true, OPTION_CHANNEL, "", false, "", 0 }, #endif diff --git a/src/Scripting/NasalModelData.cxx b/src/Scripting/NasalModelData.cxx index 2bf3d03d2..4d0bda95c 100644 --- a/src/Scripting/NasalModelData.cxx +++ b/src/Scripting/NasalModelData.cxx @@ -87,8 +87,7 @@ FGNasalModelData::FGNasalModelData( SGPropertyNode *root, SG_INFO, "New model with attached script(s) " "(branch = " << branch << "," - " path = " << simgear::getNodePathString(branch) << - " thread-safe = " << branch->getThreadSafeRefUnref() << ")" + " path = " << simgear::getNodePathString(branch) << ")" ); } -- 2.39.5