From 5c8861adf485728a2bdf50a07683a6d8bd482149 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Fri, 7 Aug 2009 17:22:05 +0000 Subject: [PATCH] Remove redundant -L linker arguments on non-Windows. Fix some compiler warnings. Fix missing non-PCH headers. This was SVN commit r7083. --- build/premake/extern_libs.lua | 4 ++-- source/lib/debug.cpp | 5 +++-- source/lib/file/common/trace.cpp | 2 ++ source/lib/file/file_system_util.cpp | 1 + source/lib/file/vfs/vfs_tree.cpp | 6 ++++-- source/lib/lib_errors.cpp | 5 +++-- source/lib/res/graphics/cursor.cpp | 3 ++- source/lib/res/graphics/ogl_tex.cpp | 2 ++ source/lib/res/sound/snd_mgr.cpp | 3 ++- source/lib/sysdep/compiler.h | 2 +- source/lib/sysdep/os/unix/udbg.cpp | 2 ++ source/mocks/mocks_real.cpp | 9 ++++++++- source/mocks/mocks_test.cpp | 9 ++++++++- source/ps/Pyrogenesis.cpp | 2 ++ source/ps/tests/test_CLogger.h | 16 ++++++++-------- .../atlas/GameInterface/MessagePasserImpl.cpp | 4 +++- 16 files changed, 53 insertions(+), 22 deletions(-) diff --git a/build/premake/extern_libs.lua b/build/premake/extern_libs.lua index 5a4404a0b0..33536d411d 100644 --- a/build/premake/extern_libs.lua +++ b/build/premake/extern_libs.lua @@ -15,10 +15,10 @@ local function add_extern_lib_paths(extern_lib) -- Often, the headers in libraries/ are windows-specific (always, except -- for cxxtest and fcollada). So don't add the include dir unless on -- windows or processing one of those libs. - if OS == "windows" or extern_lib == 'cxxtest' or extern_lib == 'fcollada' or extern_lib == 'valgrind' then + if OS == "windows" or extern_lib == "cxxtest" or extern_lib == "fcollada" or extern_lib == "valgrind" then tinsert(package.includepaths, libraries_dir .. extern_lib .. "/include") + tinsert(package.libpaths, libraries_dir .. extern_lib .. "/lib") end - tinsert(package.libpaths, libraries_dir .. extern_lib .. "/lib") end diff --git a/source/lib/debug.cpp b/source/lib/debug.cpp index 1fbcf7ea4e..27f62e8f4f 100644 --- a/source/lib/debug.cpp +++ b/source/lib/debug.cpp @@ -22,8 +22,9 @@ #include "precompiled.h" #include "debug.h" -#include -#include +#include +#include +#include #include "app_hooks.h" #include "os_path.h" diff --git a/source/lib/file/common/trace.cpp b/source/lib/file/common/trace.cpp index ac694e4c4f..2d94d6c518 100644 --- a/source/lib/file/common/trace.cpp +++ b/source/lib/file/common/trace.cpp @@ -22,6 +22,8 @@ #include "precompiled.h" #include "trace.h" +#include + #include "lib/allocators/pool.h" #include "lib/timer.h" // timer_Time diff --git a/source/lib/file/file_system_util.cpp b/source/lib/file/file_system_util.cpp index a3bf40b5ab..cd6340c1a2 100644 --- a/source/lib/file/file_system_util.cpp +++ b/source/lib/file/file_system_util.cpp @@ -24,6 +24,7 @@ #include #include +#include #include "lib/path_util.h" #include "lib/regex.h" diff --git a/source/lib/file/vfs/vfs_tree.cpp b/source/lib/file/vfs/vfs_tree.cpp index 1504360588..e083342a58 100644 --- a/source/lib/file/vfs/vfs_tree.cpp +++ b/source/lib/file/vfs/vfs_tree.cpp @@ -22,6 +22,8 @@ #include "precompiled.h" #include "vfs_tree.h" +#include + #include "lib/file/common/file_stats.h" #include "lib/sysdep/cpu.h" @@ -166,7 +168,7 @@ void VfsDirectory::DisplayR(size_t depth) const file.GenerateDescription(description, ARRAY_SIZE(description)); for(size_t i = 0; i < depth+1; i++) - printf(indent); + printf("%s", indent); printf(fmt, name.c_str(), description); } @@ -176,7 +178,7 @@ void VfsDirectory::DisplayR(size_t depth) const const VfsDirectory& directory = it->second; for(size_t i = 0; i < depth+1; i++) - printf(indent); + printf("%s", indent); printf("[%s/]\n", name.c_str()); directory.DisplayR(depth+1); diff --git a/source/lib/lib_errors.cpp b/source/lib/lib_errors.cpp index a521a51485..e94535d43d 100644 --- a/source/lib/lib_errors.cpp +++ b/source/lib/lib_errors.cpp @@ -27,8 +27,9 @@ #include "precompiled.h" #include "lib_errors.h" -#include -#include // abs +#include +#include // abs +#include #include #include "lib/posix/posix_errno.h" diff --git a/source/lib/res/graphics/cursor.cpp b/source/lib/res/graphics/cursor.cpp index b287924a68..0e28a29f82 100644 --- a/source/lib/res/graphics/cursor.cpp +++ b/source/lib/res/graphics/cursor.cpp @@ -22,7 +22,8 @@ #include "precompiled.h" #include "cursor.h" -#include +#include +#include #include #include "lib/ogl.h" diff --git a/source/lib/res/graphics/ogl_tex.cpp b/source/lib/res/graphics/ogl_tex.cpp index 0ff0dc6fcc..bb34d74529 100644 --- a/source/lib/res/graphics/ogl_tex.cpp +++ b/source/lib/res/graphics/ogl_tex.cpp @@ -23,6 +23,8 @@ #include "precompiled.h" #include "ogl_tex.h" +#include + #include "lib/app_hooks.h" #include "lib/ogl.h" #include "lib/bits.h" diff --git a/source/lib/res/sound/snd_mgr.cpp b/source/lib/res/sound/snd_mgr.cpp index 9d6b26460f..9802ce754b 100644 --- a/source/lib/res/sound/snd_mgr.cpp +++ b/source/lib/res/sound/snd_mgr.cpp @@ -28,7 +28,8 @@ #include #include #include -#include +#include +#include #include "lib/path_util.h" #include "../h_mgr.h" diff --git a/source/lib/sysdep/compiler.h b/source/lib/sysdep/compiler.h index d0123602ef..2ebaf6e10a 100644 --- a/source/lib/sysdep/compiler.h +++ b/source/lib/sysdep/compiler.h @@ -69,7 +69,7 @@ // are PreCompiled Headers supported? #if MSC_VERSION -# define HAVE_PCH 1 +# define HAVE_PCH 1 #elif defined(USING_PCH) # define HAVE_PCH 1 #else diff --git a/source/lib/sysdep/os/unix/udbg.cpp b/source/lib/sysdep/os/unix/udbg.cpp index 318ba3eb1b..e17bfe7c2e 100644 --- a/source/lib/sysdep/os/unix/udbg.cpp +++ b/source/lib/sysdep/os/unix/udbg.cpp @@ -24,6 +24,8 @@ symbol lookups and backtraces) #include "precompiled.h" +#include + #include "lib/timer.h" #include "lib/sysdep/sysdep.h" #include "lib/debug.h" diff --git a/source/mocks/mocks_real.cpp b/source/mocks/mocks_real.cpp index 61b0f8d835..ed18bf52c1 100644 --- a/source/mocks/mocks_real.cpp +++ b/source/mocks/mocks_real.cpp @@ -1,5 +1,12 @@ #define CXXTEST_MOCK_REAL_SOURCE_FILE -#include "lib/sysdep/os.h" + +// Pull in the common config headers from precompiled.h, +// but disable the actual precompiling (since we've only got +// one source file) +#ifdef USING_PCH +# undef USING_PCH +#endif +#include "lib/precompiled.h" #include "mocks/boost_filesystem.h" diff --git a/source/mocks/mocks_test.cpp b/source/mocks/mocks_test.cpp index bf08c075b9..7e038fcf9f 100644 --- a/source/mocks/mocks_test.cpp +++ b/source/mocks/mocks_test.cpp @@ -1,5 +1,12 @@ #define CXXTEST_MOCK_TEST_SOURCE_FILE -#include "lib/sysdep/os.h" + +// Pull in the common config headers from precompiled.h, +// but disable the actual precompiling (since we've only got +// one source file) +#ifdef USING_PCH +# undef USING_PCH +#endif +#include "lib/precompiled.h" // Cause calls to be redirected to the real function by default #define DEFAULT(name) static T::Real_##name real_##name diff --git a/source/ps/Pyrogenesis.cpp b/source/ps/Pyrogenesis.cpp index e533a91dfd..d98146e150 100644 --- a/source/ps/Pyrogenesis.cpp +++ b/source/ps/Pyrogenesis.cpp @@ -17,6 +17,8 @@ #include "precompiled.h" +#include + #include "Pyrogenesis.h" #include "ps/i18n.h" diff --git a/source/ps/tests/test_CLogger.h b/source/ps/tests/test_CLogger.h index 9fa7857d5e..9d8d8a4734 100644 --- a/source/ps/tests/test_CLogger.h +++ b/source/ps/tests/test_CLogger.h @@ -46,15 +46,15 @@ public: std::string clipped (buflen-4, '*'); clipped += "..."; - logger->Log(CLogger::Normal, "", msg0.c_str()); - logger->Log(CLogger::Normal, "", msg1.c_str()); - logger->Log(CLogger::Normal, "", msg2.c_str()); - logger->Log(CLogger::Normal, "", msg3.c_str()); + logger->Log(CLogger::Normal, "", "%s", msg0.c_str()); + logger->Log(CLogger::Normal, "", "%s", msg1.c_str()); + logger->Log(CLogger::Normal, "", "%s", msg2.c_str()); + logger->Log(CLogger::Normal, "", "%s", msg3.c_str()); - logger->LogOnce(CLogger::Normal, "", msg0.c_str()); - logger->LogOnce(CLogger::Normal, "", msg1.c_str()); - logger->LogOnce(CLogger::Normal, "", msg2.c_str()); - logger->LogOnce(CLogger::Normal, "", msg3.c_str()); + logger->LogOnce(CLogger::Normal, "", "%s", msg0.c_str()); + logger->LogOnce(CLogger::Normal, "", "%s", msg1.c_str()); + logger->LogOnce(CLogger::Normal, "", "%s", msg2.c_str()); + logger->LogOnce(CLogger::Normal, "", "%s", msg3.c_str()); ParseOutput(); diff --git a/source/tools/atlas/GameInterface/MessagePasserImpl.cpp b/source/tools/atlas/GameInterface/MessagePasserImpl.cpp index 53ab2201f0..08de769f8d 100644 --- a/source/tools/atlas/GameInterface/MessagePasserImpl.cpp +++ b/source/tools/atlas/GameInterface/MessagePasserImpl.cpp @@ -17,6 +17,8 @@ #include "precompiled.h" +#include + #include "MessagePasserImpl.h" #include "Messages.h" @@ -32,7 +34,7 @@ MessagePasserImpl::MessagePasserImpl() int tries = 0; while (tries++ < 16) // some arbitrary cut-off point to avoid infinite loops { - static char name[1024]; + static char name[64]; sprintf(name, "/wfg-atlas-msgpass-%d-%d", (int)rand(1, 1000), (int)(time(0)%1000)); sem_t* sem = sem_open(name, O_CREAT | O_EXCL, 0700, 0);