From 0d394e269d299f214576e768f8f15c3da74657e7 Mon Sep 17 00:00:00 2001 From: "Ben \"root\" Anderson" Date: Wed, 28 Jan 2015 16:45:19 -0600 Subject: [PATCH] Declare version_* in only one place. Define them in ver.cpp (at least on autotools). --- src/CommandLineActions.cpp | 10 ++++------ src/Makefile.am | 6 +++--- src/NetworkSyncManager.cpp | 5 +++-- src/PrefsManager.cpp | 8 ++++---- src/StepMania.cpp | 9 ++++----- src/archutils/Unix/CrashHandlerChild.cpp | 4 +--- src/archutils/Win32/CrashHandlerChild.cpp | 5 ++--- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/CommandLineActions.cpp b/src/CommandLineActions.cpp index 91b20f7897..3e69058303 100644 --- a/src/CommandLineActions.cpp +++ b/src/CommandLineActions.cpp @@ -18,6 +18,10 @@ #include "JsonUtil.h" #include "ScreenInstallOverlay.h" +#if defined(HAVE_VERSION_INFO) +#include "ver.h" +#endif + // only used for Version() #if defined(_WINDOWS) #include @@ -77,12 +81,6 @@ static void LuaInformation() delete pNode; } -#if defined(HAVE_VERSION_INFO) -extern unsigned long version_num; -extern const char *const version_date; -extern const char *const version_time; -#endif - /** * @brief Print out version information. * diff --git a/src/Makefile.am b/src/Makefile.am index 99fe9ba226..bd1d0a172d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,9 +37,9 @@ increment_version: else \ build=0; \ fi; \ - echo "extern const unsigned long version_num = $$build;" > ver.cpp; \ - echo "extern const char *const version_time = \"`date +"%X %Z (UTC%:z)"`\";" >> ver.cpp; - echo "extern const char *const version_date = \"`date +"%Y%m%d"`\";" >> ver.cpp; + echo "const unsigned long version_num = $$build;" > ver.cpp; \ + echo "const char *const version_time = \"`date +"%X %Z (UTC%:z)"`\";" >> ver.cpp; + echo "const char *const version_date = \"`date +"%Y%m%d"`\";" >> ver.cpp; ver.cpp: increment_version diff --git a/src/NetworkSyncManager.cpp b/src/NetworkSyncManager.cpp index 7fed108439..ae232d52eb 100644 --- a/src/NetworkSyncManager.cpp +++ b/src/NetworkSyncManager.cpp @@ -6,9 +6,10 @@ NetworkSyncManager *NSMAN; -// Aldo: used by GetCurrentSMVersion() +// Aldo: version_num used by GetCurrentSMVersion() +// XXX: That's probably not what you want... --root #if defined(HAVE_VERSION_INFO) -extern unsigned long version_num; +#include "ver.h" #endif #if defined(WITHOUT_NETWORKING) diff --git a/src/PrefsManager.cpp b/src/PrefsManager.cpp index 9931f3a027..91f31fe22a 100644 --- a/src/PrefsManager.cpp +++ b/src/PrefsManager.cpp @@ -11,6 +11,10 @@ #include "RageLog.h" #include "SpecialFiles.h" +#if !defined(WITHOUT_NETWORKING) && defined(HAVE_VERSION_INFO) +#include "ver.h" +#endif + //DEFAULTS_INI_PATH = "Data/Defaults.ini"; // these can be overridden //PREFERENCES_INI_PATH // overlay on Defaults.ini, contains the user's choices //STATIC_INI_PATH = "Data/Static.ini"; // overlay on the 2 above, can't be overridden @@ -143,10 +147,6 @@ bool g_bAutoRestart = false; # define TRUE_IF_DEBUG false #endif -#if !defined(WITHOUT_NETWORKING) && defined(HAVE_VERSION_INFO) -extern unsigned long version_num; -#endif - void ValidateDisplayAspectRatio( float &val ) { if( val < 0 ) diff --git a/src/StepMania.cpp b/src/StepMania.cpp index 98dbf12cde..bc117771cc 100644 --- a/src/StepMania.cpp +++ b/src/StepMania.cpp @@ -69,6 +69,10 @@ #include "Profile.h" #include "ActorUtil.h" +#ifdef HAVE_VERSION_INFO +#include "ver.h" +#endif + #if defined(WIN32) #include #endif @@ -907,11 +911,6 @@ static void MountTreeOfZips( const RString &dir ) } } -#if defined(HAVE_VERSION_INFO) -extern unsigned long version_num; -extern const char *const version_date; -extern const char *const version_time; -#endif static void WriteLogHeader() { diff --git a/src/archutils/Unix/CrashHandlerChild.cpp b/src/archutils/Unix/CrashHandlerChild.cpp index 518ad0c7f6..c923522369 100644 --- a/src/archutils/Unix/CrashHandlerChild.cpp +++ b/src/archutils/Unix/CrashHandlerChild.cpp @@ -23,9 +23,7 @@ #endif #if defined(HAVE_VERSION_INFO) -extern const unsigned long version_num; -extern const char *const version_date; -extern const char *const version_time; +#include "ver.h" #endif bool child_read( int fd, void *p, int size ); diff --git a/src/archutils/Win32/CrashHandlerChild.cpp b/src/archutils/Win32/CrashHandlerChild.cpp index 7e377017df..5dd70744b9 100644 --- a/src/archutils/Win32/CrashHandlerChild.cpp +++ b/src/archutils/Win32/CrashHandlerChild.cpp @@ -30,9 +30,8 @@ #pragma comment(lib, "archutils/Win32/ddk/dbghelp.lib") #endif -extern unsigned long version_num; -extern const char *const version_date; -extern const char *const version_time; +// XXX: What happens when we *don't* have version info? Does that ever actually happen? +#include "ver.h" // VDI symbol lookup: namespace VDDebugInfo