Commits

Matt Oswald  committed 6122a7c

fixing release builds, g++ warnings

  • Participants
  • Parent commits 71243b7

Comments (0)

Files changed (10)

File .build/build.sconscript

     SConscript('msvc.sconscript', exports = 'env')
 else:
     env['CXX'] = 'g++-4.7'
-    #env.Append(CCFLAGS = [ '-Wall', '-Wextra', '-pedantic', '-fpermissive', '-std=c++11' ])
-    env.Append(CCFLAGS = [ '-pthread', '-fPIC', '-fpermissive', '-w', '-std=c++11' ])
+    env.Append(CCFLAGS = [ '-pthread', '-fPIC', '-Wall', '-Wextra', '-pedantic', '-std=c++11' ])
+    env.Append(CCFLAGS = [ '-Wno-comment' ])

File .build/output.sconscript

 Import("env")
 
-debugTag = ""
+debugTag = ''
 
 debug = env['debug']
 
 if debug == True:
-    debugTag = ".Debug"
+    debugTag = '.Debug$SHLIBSUFFIX'
 
-outputDir = "#bin/"
-intDir = "#int/"
+outputDir = '#bin/'
+intDir = '#int/'
 
 def getTargetFile(projectName):
     return outputDir + projectName + '/' + projectName + debugTag
 
     rel = SConscript('.build/release.sconscript', exports = 'env')
     buildProjects(rel)
+

File Tests/BareTests/sconscript

 local.VariantDir(intDir, './', duplicate = 0)
 local.Append(CPPPATH = ['../../xUnit++'])
 
-target = local.SharedLibrary(targetFile + '$SHLIBSUFFIX', Glob(intDir + '*.cpp'), LIBS = env['xUnit'])
+target = local.SharedLibrary(targetFile, Glob(intDir + '*.cpp'), LIBS = env['xUnit'])
 
 Return('target')

File Tests/UnitTests/Assert.Null.cpp

 FACT(NullForRawPointerAssertsOnFailure)
 {
     int x;
-    Assert.Throws<xUnitAssert>([=]() { Assert.Null(&x); });
+    Assert.Throws<xUnitAssert>([&]() { Assert.Null(&x); });
 }
 
 FACT(NullForSmartPointerAssertsOnFailure)
 FACT(NullAppendsUserMessage)
 {
     static const std::string msg = "xUnit++";
-    int x;
-    auto assert = Assert.Throws<xUnitAssert>([=]() { Assert.Null(&x) << msg; });
+    auto x = std::make_shared<int>(0);
+    auto assert = Assert.Throws<xUnitAssert>([&]() { Assert.Null(x) << msg; });
 
     Assert.Contains(assert.what(), msg.c_str());
 }

File Tests/UnitTests/sconscript

 sources = Glob(intDir + '*.cpp')
 sources = sources + Glob(intDir + '/Helpers/*.cpp')
 
-target = local.SharedLibrary(targetFile + '$SHLIBSUFFIX', sources, LIBS = env['xUnit'])
+target = local.SharedLibrary(targetFile, sources, LIBS = env['xUnit'])
 
 Return('target')

File xUnit++.console/TestAssembly.cpp

 #else
         if ((module = dlopen(tempFile.c_str(), RTLD_LAZY)) != nullptr)
         {
-            EnumerateTestDetails = (xUnitpp::EnumerateTestDetails)dlsym(module, "EnumerateTestDetails");
-            FilteredTestsRunner = (xUnitpp::FilteredTestsRunner)dlsym(module, "FilteredTestsRunner");
+            // so silly. ISO C++ forbids casting void * to a pointer-to-function
+            // but POSIX says "sure, go right ahead"
+            // this weird syntax works around that
+            *(void **)(&EnumerateTestDetails) = dlsym(module, "EnumerateTestDetails");
+            *(void **)(&FilteredTestsRunner) = dlsym(module, "FilteredTestsRunner");
         }
 #endif
     }

File xUnit++/sconscript

 local.VariantDir(intDir, 'src/', duplicate = 0)
 local.Append(CPPPATH = ['xUnit++'])
 
-# bug in scons? this will fail when doing release builds
-if env['debug'] == True:
-    targetFile = targetFile + '$LIBSUFFIX'
-
 target = local.StaticLibrary(targetFile, Glob(intDir + '*.cpp'))
 
 Return('target')

File xUnit++/xUnit++/xUnitAssert.h

         return *this;
     }
 
-    const LineInfo &LineInfo() const;
+    const xUnitpp::LineInfo &LineInfo() const;
 
     static const xUnitAssert &None();
 

File xUnit++/xUnit++/xUnitTest.h

         const AttributeCollection &attributes, Time::Duration timeLimit,
         const std::string &filename, int line, std::shared_ptr<Check> check);
 
-    const TestDetails &TestDetails() const;
+    const xUnitpp::TestDetails &TestDetails() const;
 
     void Run();