Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Addressed Resharper-C++ warnings

See #958
Commit
1e59ccee41f269440310979a0b6ab7e4dbb1e453
Author
Martin Hořeňovský ·
Parents
b6f62af7d1a9

Files · Download .tar.gz

Changes

 include/catch_session.hpp                          |  2 +-
 include/internal/catch_commandline.cpp             |  2 +-
 include/internal/catch_common.h                    |  2 +-
 include/internal/catch_console_colour.cpp          | 15 ++++++----
 include/internal/catch_console_colour.hpp          |  4 +--
 include/internal/catch_context.cpp                 | 14 ++++-----
 include/internal/catch_evaluate.hpp                |  2 +-
 .../internal/catch_exception_translator_registry.h |  2 +-
 include/internal/catch_notimplemented_exception.h  |  2 +-
 include/internal/catch_reporter_registrars.hpp     |  8 ++---
 include/internal/catch_run_context.hpp             | 25 +++++++---------
 include/internal/catch_stream.hpp                  |  6 ++--
 include/internal/catch_string.cpp                  |  2 +-
 include/internal/catch_string.h                    |  2 +-
 include/internal/catch_stringref.cpp               |  2 +-
 include/internal/catch_test_case_tracker.cpp       |  4 +--
 include/internal/catch_test_case_tracker.hpp       |  2 +-
 include/internal/catch_test_spec.hpp               |  6 ++--
 include/internal/catch_xmlwriter.cpp               |  4 +--
 include/internal/catch_xmlwriter.hpp               |  4 +--
 include/reporters/catch_reporter_bases.cpp         |  6 ++++
 include/reporters/catch_reporter_bases.hpp         |  8 +----
 include/reporters/catch_reporter_compact.cpp       | 35 ++++++++++++----------
 include/reporters/catch_reporter_console.cpp       | 29 ++++++++++--------
 include/reporters/catch_reporter_teamcity.hpp      |  2 +-
 25 files changed, 97 insertions(+), 93 deletions(-)

diff --git a/include/catch_session.hpp b/include/catch_session.hpp
index e9a4aade..f95de1c5 100644
--- a/include/catch_session.hpp
+++ b/include/catch_session.hpp
@@ -110,7 +110,7 @@ namespace Catch {
             Catch::cleanUp();
         }
 
-        void showHelp() {
+        void showHelp() const {
             Catch::cout()
                     << "\nCatch v" << libraryVersion() << "\n"
                     << m_cli << std::endl
diff --git a/include/internal/catch_commandline.cpp b/include/internal/catch_commandline.cpp
index d5f2ab4e..087aa276 100644
--- a/include/internal/catch_commandline.cpp
+++ b/include/internal/catch_commandline.cpp
@@ -55,7 +55,7 @@ namespace Catch {
         auto const setRngSeed = [&]( std::string const& seed ) {
                 if( seed != "time" )
                     return clara::detail::convertInto( seed, config.rngSeed );
-                config.rngSeed = static_cast<unsigned int>( std::time(0) );
+                config.rngSeed = static_cast<unsigned int>( std::time(nullptr) );
                 return ParserResult::ok( ParseResultType::Matched );
             };
         auto const setColourUsage = [&]( std::string const& useColour ) {
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
index bc9a0aba..3ef325e0 100644
--- a/include/internal/catch_common.h
+++ b/include/internal/catch_common.h
@@ -98,7 +98,7 @@ namespace Catch {
     // as well as
     //    >> stuff +StreamEndStop
     struct StreamEndStop {
-        std::string operator+() {
+        std::string operator+() const {
             return std::string();
         }
     };
diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp
index fc6c76f2..1f382030 100644
--- a/include/internal/catch_console_colour.cpp
+++ b/include/internal/catch_console_colour.cpp
@@ -59,7 +59,7 @@ namespace {
             originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
         }
 
-        virtual void use( Colour::Code _colourCode ) {
+        virtual void use( Colour::Code _colourCode ) override {
             switch( _colourCode ) {
                 case Colour::None:      return setTextAttribute( originalForegroundAttributes );
                 case Colour::White:     return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
@@ -118,7 +118,7 @@ namespace {
     // https://github.com/philsquared/Catch/pull/131
     class PosixColourImpl : public IColourImpl {
     public:
-        virtual void use( Colour::Code _colourCode ) {
+        virtual void use( Colour::Code _colourCode ) override {
             switch( _colourCode ) {
                 case Colour::None:
                 case Colour::White:     return setColour( "[0m" );
@@ -179,10 +179,13 @@ namespace Catch {
 namespace Catch {
 
     Colour::Colour( Code _colourCode ) { use( _colourCode ); }
-    Colour::Colour( Colour&& _other ) { const_cast<Colour&>( _other ).m_moved = true; }
-    Colour& Colour::operator=( Colour&& _other ) {
-        m_moved = false;
-        const_cast<Colour&>( _other ).m_moved = true;
+    Colour::Colour( Colour&& rhs ) noexcept { 
+        m_moved = rhs.m_moved;
+        rhs.m_moved = true;
+    }
+    Colour& Colour::operator=( Colour&& rhs ) noexcept {
+        m_moved = rhs.m_moved;
+        rhs.m_moved  = true;
         return *this;
     }
     
diff --git a/include/internal/catch_console_colour.hpp b/include/internal/catch_console_colour.hpp
index 6b5b8fa6..d1e68f87 100644
--- a/include/internal/catch_console_colour.hpp
+++ b/include/internal/catch_console_colour.hpp
@@ -50,8 +50,8 @@ namespace Catch {
 
         // Use constructed object for RAII guard
         Colour( Code _colourCode );
-        Colour( Colour&& other );
-        Colour& operator=( Colour&& other );
+        Colour( Colour&& other ) noexcept;
+        Colour& operator=( Colour&& other ) noexcept;
         ~Colour();
 
         // Use static method for one-shot changes
diff --git a/include/internal/catch_context.cpp b/include/internal/catch_context.cpp
index 48b4f4a9..7a4518bf 100644
--- a/include/internal/catch_context.cpp
+++ b/include/internal/catch_context.cpp
@@ -16,32 +16,30 @@ namespace Catch {
     class Context : public IMutableContext, NonCopyable {
 
     public: // IContext
-        virtual IResultCapture* getResultCapture() {
+        virtual IResultCapture* getResultCapture() override {
             return m_resultCapture;
         }
-        virtual IRunner* getRunner() {
+        virtual IRunner* getRunner() override {
             return m_runner;
         }
 
-        virtual IConfigPtr getConfig() const {
+        virtual IConfigPtr getConfig() const override {
             return m_config;
         }
 
     public: // IMutableContext
-        virtual void setResultCapture( IResultCapture* resultCapture ) {
+        virtual void setResultCapture( IResultCapture* resultCapture ) override {
             m_resultCapture = resultCapture;
         }
-        virtual void setRunner( IRunner* runner ) {
+        virtual void setRunner( IRunner* runner ) override {
             m_runner = runner;
         }
-        virtual void setConfig( IConfigPtr const& config ) {
+        virtual void setConfig( IConfigPtr const& config ) override {
             m_config = config;
         }
 
         friend IMutableContext& getCurrentMutableContext();
 
-    private:
-
     private:
         IConfigPtr m_config;
         IRunner* m_runner = nullptr;
diff --git a/include/internal/catch_evaluate.hpp b/include/internal/catch_evaluate.hpp
index 31be0dcf..1ee53d74 100644
--- a/include/internal/catch_evaluate.hpp
+++ b/include/internal/catch_evaluate.hpp
@@ -46,7 +46,7 @@ namespace Internal {
     // So the compare overloads can be operator agnostic we convey the operator as a template
     // enum, which is used to specialise an Evaluator for doing the comparison.
     template<typename T1, typename T2, Operator Op>
-    class Evaluator{};
+    struct Evaluator{};
 
     template<typename T1, typename T2>
     struct Evaluator<T1, T2, IsEqualTo> {
diff --git a/include/internal/catch_exception_translator_registry.h b/include/internal/catch_exception_translator_registry.h
index d3059f48..da2f4f12 100644
--- a/include/internal/catch_exception_translator_registry.h
+++ b/include/internal/catch_exception_translator_registry.h
@@ -19,7 +19,7 @@ namespace Catch {
     public:
         ~ExceptionTranslatorRegistry();
         virtual void registerTranslator( const IExceptionTranslator* translator );
-        virtual std::string translateActiveException() const;
+        virtual std::string translateActiveException() const override;
         std::string tryTranslators() const;
 
     private:
diff --git a/include/internal/catch_notimplemented_exception.h b/include/internal/catch_notimplemented_exception.h
index e728c363..640cc167 100644
--- a/include/internal/catch_notimplemented_exception.h
+++ b/include/internal/catch_notimplemented_exception.h
@@ -19,7 +19,7 @@ namespace Catch {
 
         virtual ~NotImplementedException() noexcept = default;
 
-        virtual const char* what() const noexcept;
+        virtual const char* what() const noexcept override;
 
     private:
         std::string m_what;
diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp
index 06c16cb5..f10c493c 100644
--- a/include/internal/catch_reporter_registrars.hpp
+++ b/include/internal/catch_reporter_registrars.hpp
@@ -17,11 +17,11 @@ namespace Catch {
 
         class ReporterFactory : public IReporterFactory {
 
-            virtual IStreamingReporterPtr create( ReporterConfig const& config ) const {
+            virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
                 return std::unique_ptr<T>( new T( config ) );
             }
 
-            virtual std::string getDescription() const {
+            virtual std::string getDescription() const override {
                 return T::getDescription();
             }
         };
@@ -38,10 +38,10 @@ namespace Catch {
 
         class ListenerFactory : public IReporterFactory {
 
-            virtual IStreamingReporterPtr create( ReporterConfig const& config ) const {
+            virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
                 return std::make_shared<T>( config );
             }
-            virtual std::string getDescription() const {
+            virtual std::string getDescription() const override {
                 return std::string();
             }
         };
diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp
index abe8c1fe..c513788b 100644
--- a/include/internal/catch_run_context.hpp
+++ b/include/internal/catch_run_context.hpp
@@ -63,33 +63,30 @@ namespace Catch {
     private: // IResultCapture
 
 
-        virtual void assertionEnded(AssertionResult const& result);
+        virtual void assertionEnded(AssertionResult const& result) override;
 
-        virtual bool sectionStarted(
-            SectionInfo const& sectionInfo,
-            Counts& assertions
-        );
+        virtual bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
         bool testForMissingAssertions(Counts& assertions);
 
-        virtual void sectionEnded(SectionEndInfo const& endInfo);
+        virtual void sectionEnded(SectionEndInfo const& endInfo) override;
 
-        virtual void sectionEndedEarly(SectionEndInfo const& endInfo);
+        virtual void sectionEndedEarly(SectionEndInfo const& endInfo) override;
 
-        virtual void pushScopedMessage(MessageInfo const& message);
+        virtual void pushScopedMessage(MessageInfo const& message) override;
 
-        virtual void popScopedMessage(MessageInfo const& message);
+        virtual void popScopedMessage(MessageInfo const& message) override;
 
-        virtual std::string getCurrentTestName() const;
+        virtual std::string getCurrentTestName() const override;
 
-        virtual const AssertionResult* getLastResult() const;
+        virtual const AssertionResult* getLastResult() const override;
 
-        virtual void exceptionEarlyReported();
+        virtual void exceptionEarlyReported() override;
 
-        virtual void handleFatalErrorCondition(std::string const& message);
+        virtual void handleFatalErrorCondition(std::string const& message) override;
 
     public:
         // !TBD We need to do this another way!
-        bool aborting() const;
+        bool aborting() const override;
 
     private:
 
diff --git a/include/internal/catch_stream.hpp b/include/internal/catch_stream.hpp
index b0998e3f..89f6cdea 100644
--- a/include/internal/catch_stream.hpp
+++ b/include/internal/catch_stream.hpp
@@ -30,11 +30,11 @@ namespace Catch {
         }
 
         ~StreamBufImpl() noexcept {
-            sync();
+            StreamBufImpl::sync();
         }
 
     private:
-        int overflow( int c ) {
+        int overflow( int c ) override {
             sync();
 
             if( c != EOF ) {
@@ -46,7 +46,7 @@ namespace Catch {
             return 0;
         }
 
-        int sync() {
+        int sync() override {
             if( pbase() != pptr() ) {
                 m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) );
                 setp( pbase(), epptr() );
diff --git a/include/internal/catch_string.cpp b/include/internal/catch_string.cpp
index f7cc53a5..b18f5d1b 100644
--- a/include/internal/catch_string.cpp
+++ b/include/internal/catch_string.cpp
@@ -32,7 +32,7 @@ namespace Catch {
     {
         m_data->addRef();
     }
-    String::String( String&& other )
+    String::String( String&& other ) noexcept
     : m_data( other.m_data )
     {
         other.m_data = StringData::getEmpty();
diff --git a/include/internal/catch_string.h b/include/internal/catch_string.h
index b9d310c9..5fb477a4 100644
--- a/include/internal/catch_string.h
+++ b/include/internal/catch_string.h
@@ -28,7 +28,7 @@ namespace Catch {
         String( StringRef const& stringRef );
         String( char const* rawString );
         String( String const& other );
-        String( String&& other );
+        String( String&& other ) noexcept;
         String( StringBuilder&& stringBuf );
         
         ~String() noexcept;
diff --git a/include/internal/catch_stringref.cpp b/include/internal/catch_stringref.cpp
index 3c4e292d..7cf75a75 100644
--- a/include/internal/catch_stringref.cpp
+++ b/include/internal/catch_stringref.cpp
@@ -55,7 +55,7 @@ namespace Catch {
     {
         size_type rawSize = rawChars == nullptr ? 0 : static_cast<size_type>( std::strlen( rawChars ) );
         if( rawSize < size )
-            size = rawSize;
+            m_size = rawSize;
     }
     
     StringRef::StringRef( String const& other ) noexcept
diff --git a/include/internal/catch_test_case_tracker.cpp b/include/internal/catch_test_case_tracker.cpp
index 7efb470c..2616afe4 100644
--- a/include/internal/catch_test_case_tracker.cpp
+++ b/include/internal/catch_test_case_tracker.cpp
@@ -63,7 +63,7 @@ namespace TestCaseTracking {
 
 
     TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {}
-    bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) {
+    bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const {
         return
             tracker->nameAndLocation().name == m_nameAndLocation.name &&
             tracker->nameAndLocation().location == m_nameAndLocation.location;
@@ -133,7 +133,7 @@ namespace TestCaseTracking {
 
         switch( m_runState ) {
             case NeedsAnotherRun:
-                break;;
+                break;
 
             case Executing:
                 m_runState = CompletedSuccessfully;
diff --git a/include/internal/catch_test_case_tracker.hpp b/include/internal/catch_test_case_tracker.hpp
index 39509300..df176084 100644
--- a/include/internal/catch_test_case_tracker.hpp
+++ b/include/internal/catch_test_case_tracker.hpp
@@ -101,7 +101,7 @@ namespace TestCaseTracking {
             NameAndLocation m_nameAndLocation;
         public:
             TrackerHasName( NameAndLocation const& nameAndLocation );
-            bool operator ()( ITrackerPtr const& tracker );
+            bool operator ()( ITrackerPtr const& tracker ) const;
         };
 
         typedef std::vector<ITrackerPtr> Children;
diff --git a/include/internal/catch_test_spec.hpp b/include/internal/catch_test_spec.hpp
index 48788fd7..8967c5a9 100644
--- a/include/internal/catch_test_spec.hpp
+++ b/include/internal/catch_test_spec.hpp
@@ -33,7 +33,7 @@ namespace Catch {
         public:
             NamePattern( std::string const& name );
             virtual ~NamePattern() = default;
-            virtual bool matches( TestCaseInfo const& testCase ) const;
+            virtual bool matches( TestCaseInfo const& testCase ) const override;
         private:
             WildcardPattern m_wildcardPattern;
         };
@@ -42,7 +42,7 @@ namespace Catch {
         public:
             TagPattern( std::string const& tag );
             virtual ~TagPattern() = default;
-            virtual bool matches( TestCaseInfo const& testCase ) const;
+            virtual bool matches( TestCaseInfo const& testCase ) const override;
         private:
             std::string m_tag;
         };
@@ -51,7 +51,7 @@ namespace Catch {
         public:
             ExcludedPattern( PatternPtr const& underlyingPattern );
             virtual ~ExcludedPattern() = default;
-            virtual bool matches( TestCaseInfo const& testCase ) const;
+            virtual bool matches( TestCaseInfo const& testCase ) const override;
         private:
             PatternPtr m_underlyingPattern;
         };
diff --git a/include/internal/catch_xmlwriter.cpp b/include/internal/catch_xmlwriter.cpp
index edc1be2a..acd9b282 100644
--- a/include/internal/catch_xmlwriter.cpp
+++ b/include/internal/catch_xmlwriter.cpp
@@ -65,11 +65,11 @@ namespace Catch {
     :   m_writer( writer )
     {}
 
-    XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other )
+    XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept
     :   m_writer( other.m_writer ){
         other.m_writer = nullptr;
     }
-    XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) {
+    XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {
         if ( m_writer ) {
             m_writer->endElement();
         }
diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp
index 4c9f5ca8..2570ec12 100644
--- a/include/internal/catch_xmlwriter.hpp
+++ b/include/internal/catch_xmlwriter.hpp
@@ -38,8 +38,8 @@ namespace Catch {
         public:
             ScopedElement( XmlWriter* writer );
 
-            ScopedElement( ScopedElement&& other );
-            ScopedElement& operator=( ScopedElement&& other );
+            ScopedElement( ScopedElement&& other ) noexcept;
+            ScopedElement& operator=( ScopedElement&& other ) noexcept;
 
             ~ScopedElement();
 
diff --git a/include/reporters/catch_reporter_bases.cpp b/include/reporters/catch_reporter_bases.cpp
index 530092cd..6457af35 100644
--- a/include/reporters/catch_reporter_bases.cpp
+++ b/include/reporters/catch_reporter_bases.cpp
@@ -17,6 +17,12 @@
 #include <memory>
 
 namespace Catch {
+    void prepareExpandedExpression(AssertionResult& result) {
+        if (result.isOk())
+            result.discardDecomposedExpression();
+        else
+            result.expandDecomposedExpression();
+    }
 
     // Because formatting using c++ streams is stateful, drop down to C is required
     // Alternatively we could use stringstream, but its performance is... not good.
diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp
index 45f8bb57..ce1834d5 100644
--- a/include/reporters/catch_reporter_bases.hpp
+++ b/include/reporters/catch_reporter_bases.hpp
@@ -17,6 +17,7 @@
 #include <memory>
 
 namespace Catch {
+    void prepareExpandedExpression(AssertionResult& result);
 
     // Returns double formatted as %.3f (format expected on output)
     std::string getFormattedDuration( double duration );
@@ -230,13 +231,6 @@ namespace Catch {
 
         void skipTest(TestCaseInfo const&) override {}
 
-        void prepareExpandedExpression(AssertionResult& result) const {
-            if (result.isOk())
-                result.discardDecomposedExpression();
-            else
-                result.expandDecomposedExpression();
-        }
-
         IConfigPtr m_config;
         std::ostream& stream;
         std::vector<AssertionStats> m_assertions;
diff --git a/include/reporters/catch_reporter_compact.cpp b/include/reporters/catch_reporter_compact.cpp
index 1c4b9d56..a1bb108f 100644
--- a/include/reporters/catch_reporter_compact.cpp
+++ b/include/reporters/catch_reporter_compact.cpp
@@ -11,6 +11,25 @@
 #include "../internal/catch_reporter_registrars.hpp"
 #include "../internal/catch_console_colour.hpp"
 
+namespace {
+
+#ifdef CATCH_PLATFORM_MAC
+    const char* failedString() { return "FAILED"; }
+    const char* passedString() { return "PASSED"; }
+#else
+    const char* failedString() { return "failed"; }
+    const char* passedString() { return "passed"; }
+#endif
+
+    // Colour::LightGrey
+    Catch::Colour::Code dimColour() { return Catch::Colour::FileName; }
+
+    std::string bothOrAll( std::size_t count ) {
+        return count == 1 ? std::string() :
+               count == 2 ? "both " : "all " ;
+    }
+}
+
 namespace Catch {
 
     struct CompactReporter : StreamingReporterBase<CompactReporter> {
@@ -148,18 +167,6 @@ namespace Catch {
             }
 
         private:
-            // Colour::LightGrey
-
-            static Colour::Code dimColour() { return Colour::FileName; }
-
-#ifdef CATCH_PLATFORM_MAC
-            static const char* failedString() { return "FAILED"; }
-            static const char* passedString() { return "PASSED"; }
-#else
-            static const char* failedString() { return "failed"; }
-            static const char* passedString() { return "passed"; }
-#endif
-
             void printSourceInfo() const {
                 Colour colourGuard( Colour::FileName );
                 stream << result.getSourceInfo() << ':';
@@ -253,10 +260,6 @@ namespace Catch {
         // -   red: Failed N tests cases, failed M assertions.
         // - green: Passed [both/all] N tests cases with M assertions.
 
-        std::string bothOrAll( std::size_t count ) const {
-            return count == 1 ? std::string() : count == 2 ? "both " : "all " ;
-        }
-
         void printTotals( const Totals& totals ) const {
             if( totals.testCases.total() == 0 ) {
                 stream << "No tests ran.";
diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp
index e6f7adc8..3b08d353 100644
--- a/include/reporters/catch_reporter_console.cpp
+++ b/include/reporters/catch_reporter_console.cpp
@@ -16,6 +16,22 @@
 #include <cfloat>
 #include <cstdio>
 
+namespace {
+    std::size_t makeRatio( std::size_t number, std::size_t total ) {
+        std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number/ total : 0;
+        return ( ratio == 0 && number > 0 ) ? 1 : ratio;
+    }
+
+    std::size_t& findMax( std::size_t& i, std::size_t& j, std::size_t& k ) {
+        if( i > j && i > k )
+            return i;
+        else if( j > k )
+            return j;
+        else
+            return k;
+    }
+}
+
 namespace Catch {
 
     struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {
@@ -390,19 +406,6 @@ namespace Catch {
             stream << '\n';
         }
 
-        static std::size_t makeRatio( std::size_t number, std::size_t total ) {
-            std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number/ total : 0;
-            return ( ratio == 0 && number > 0 ) ? 1 : ratio;
-        }
-        static std::size_t& findMax( std::size_t& i, std::size_t& j, std::size_t& k ) {
-            if( i > j && i > k )
-                return i;
-            else if( j > k )
-                return j;
-            else
-                return k;
-        }
-
         void printTotalsDivider( Totals const& totals ) {
             if( totals.testCases.total() > 0 ) {
                 std::size_t failedRatio = makeRatio( totals.testCases.failed, totals.testCases.total() );
diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp
index cb043022..15cfc016 100644
--- a/include/reporters/catch_reporter_teamcity.hpp
+++ b/include/reporters/catch_reporter_teamcity.hpp
@@ -187,7 +187,7 @@ namespace Catch {
 
         // if string has a : in first line will set indent to follow it on
         // subsequent lines
-        void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {
+        static void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {
             std::size_t i = _string.find( ": " );
             if( i != std::string::npos )
                 i+=2;