From d7bd757862916cca0c4888070c9c929a8a9bd089 Mon Sep 17 00:00:00 2001 From: timdave13 Date: Thu, 2 Feb 2017 17:14:27 -0500 Subject: [PATCH 1/3] fix clang warning fix clang warning: 'X' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables] --- UnitTest++/TestMacros.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index d6bc204..8ff87f8 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -49,10 +49,12 @@ explicit Fixture ## Name ## Helper(UnitTest::TestDetails const& details) : m_details(details) {} \ void RunImpl(); \ UnitTest::TestDetails const& m_details; \ + virtual ~Fixture ## Name ## Helper(); \ private: \ Fixture ## Name ## Helper(Fixture ## Name ## Helper const&); \ Fixture ## Name ## Helper& operator =(Fixture ## Name ## Helper const&); \ }; \ + Fixture ## Name ## Helper::~Fixture ## Name ## Helper(){}; \ \ class Test ## Fixture ## Name : public UnitTest::Test \ { \ @@ -60,9 +62,9 @@ Test ## Fixture ## Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \ private: \ virtual void RunImpl() const; \ - } test ## Fixture ## Name ## Instance; \ + } static test ## Fixture ## Name ## Instance; \ \ - UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ + static UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ \ void Test ## Fixture ## Name::RunImpl() const \ { \ From 0a6857e3883175a5682bc2a7df9e7b53f73f53a9 Mon Sep 17 00:00:00 2001 From: Tim Bochenek Date: Thu, 2 Feb 2017 18:03:59 -0500 Subject: [PATCH 2/3] fix clang warning fix clang warning 'extra ';' outside function is c++11 extension --- UnitTest++/TestMacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index 8ff87f8..dbe3430 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -54,7 +54,7 @@ Fixture ## Name ## Helper(Fixture ## Name ## Helper const&); \ Fixture ## Name ## Helper& operator =(Fixture ## Name ## Helper const&); \ }; \ - Fixture ## Name ## Helper::~Fixture ## Name ## Helper(){}; \ + Fixture ## Name ## Helper::~Fixture ## Name ## Helper(){} \ \ class Test ## Fixture ## Name : public UnitTest::Test \ { \ From 07d4872076b3b7d824149186a230f54ef5cd04df Mon Sep 17 00:00:00 2001 From: Tim Bochenek Date: Fri, 3 Feb 2017 08:19:17 -0500 Subject: [PATCH 3/3] fix clang warnings fix clang warning warning: no previous extern declaration for non-static variable 'X' [-Wmissing-variable-declarations] --- UnitTest++/TestMacros.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index dbe3430..0c8e903 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -25,16 +25,16 @@ } \ namespace Suite ## Name -#define UNITTEST_IMPL_TEST(Name, List) \ +#define UNITTEST_IMPL_TEST(Name, List) \ class Test ## Name : public UnitTest::Test \ { \ public: \ Test ## Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \ private: \ virtual void RunImpl() const; \ - } test ## Name ## Instance; \ + } static test ## Name ## Instance; \ \ - UnitTest::ListAdder adder ## Name (List, &test ## Name ## Instance); \ + static UnitTest::ListAdder adder ## Name (List, &test ## Name ## Instance); \ \ void Test ## Name::RunImpl() const @@ -62,9 +62,9 @@ Test ## Fixture ## Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \ private: \ virtual void RunImpl() const; \ - } static test ## Fixture ## Name ## Instance; \ + } static test ## Fixture ## Name ## Instance; \ \ - static UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ + static UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ \ void Test ## Fixture ## Name::RunImpl() const \ { \