From 8da0d0473bde28328988b44efab1c4f996fa56cc Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 18 Sep 2017 17:13:17 +0100 Subject: [PATCH] qualified a load of size_ts with std:: namespace (all those not from Clara) --- include/internal/catch_benchmark.h | 4 ++-- include/internal/catch_debugger.cpp | 4 ++-- include/internal/catch_interfaces_reporter.cpp | 2 +- include/internal/catch_interfaces_reporter.h | 2 +- include/internal/catch_matchers_vector.h | 2 +- include/internal/catch_objc.hpp | 4 ++-- include/internal/catch_run_context.h | 2 +- include/internal/catch_stream.cpp | 2 +- include/internal/catch_stringref.h | 2 +- include/internal/catch_test_case_info.cpp | 2 +- .../internal/catch_test_case_registry_impl.h | 2 +- include/internal/catch_test_spec_parser.h | 2 +- include/internal/catch_timer.cpp | 2 +- include/reporters/catch_reporter_bases.cpp | 2 +- include/reporters/catch_reporter_console.cpp | 2 +- include/reporters/catch_reporter_junit.cpp | 2 +- include/reporters/catch_reporter_tap.hpp | 6 +++--- projects/Benchmark/StringificationBench.cpp | 18 +++++++++--------- projects/SelfTest/MiscTests.cpp | 4 ++-- 19 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/internal/catch_benchmark.h b/include/internal/catch_benchmark.h index 2e33c163..e546713c 100644 --- a/include/internal/catch_benchmark.h +++ b/include/internal/catch_benchmark.h @@ -19,8 +19,8 @@ namespace Catch { class BenchmarkLooper { std::string m_name; - size_t m_count = 0; - size_t m_iterationsToRun = 1; + std::size_t m_count = 0; + std::size_t m_iterationsToRun = 1; uint64_t m_resolution; Timer m_timer; diff --git a/include/internal/catch_debugger.cpp b/include/internal/catch_debugger.cpp index a467e9fd..c1ef340c 100644 --- a/include/internal/catch_debugger.cpp +++ b/include/internal/catch_debugger.cpp @@ -20,7 +20,7 @@ #include #include - namespace Catch{ + namespace Catch { // The following function is taken directly from the following technical note: // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html @@ -31,7 +31,7 @@ int mib[4]; struct kinfo_proc info; - size_t size; + std::size_t size; // Initialize the flags so that, if sysctl fails for some bizarre // reason, we get a predictable result. diff --git a/include/internal/catch_interfaces_reporter.cpp b/include/internal/catch_interfaces_reporter.cpp index 3859c546..129a5f4d 100644 --- a/include/internal/catch_interfaces_reporter.cpp +++ b/include/internal/catch_interfaces_reporter.cpp @@ -105,7 +105,7 @@ namespace Catch { TestRunStats::~TestRunStats() = default; - void IStreamingReporter::fatalErrorEncountered( StringRef name ) {} + void IStreamingReporter::fatalErrorEncountered( StringRef ) {} bool IStreamingReporter::isMulti() const { return false; } IReporterFactory::~IReporterFactory() = default; diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 318ce669..b620abb6 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -163,7 +163,7 @@ namespace Catch { }; struct BenchmarkStats { BenchmarkInfo info; - size_t iterations; + std::size_t iterations; uint64_t elapsedTimeInNanoseconds; }; diff --git a/include/internal/catch_matchers_vector.h b/include/internal/catch_matchers_vector.h index 85994fb0..ae2741b1 100644 --- a/include/internal/catch_matchers_vector.h +++ b/include/internal/catch_matchers_vector.h @@ -78,7 +78,7 @@ namespace Matchers { // - then just call that directly if (m_comparator.size() != v.size()) return false; - for (size_t i = 0; i < v.size(); ++i) + for (std::size_t i = 0; i < v.size(); ++i) if (m_comparator[i] != v[i]) return false; return true; diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp index 93fbfdfb..b43f3352 100644 --- a/include/internal/catch_objc.hpp +++ b/include/internal/catch_objc.hpp @@ -72,8 +72,8 @@ namespace Catch { } } - inline size_t registerTestMethods() { - size_t noTestMethods = 0; + inline std::size_t registerTestMethods() { + std::size_t noTestMethods = 0; int noClasses = objc_getClassList( nullptr, 0 ); Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); diff --git a/include/internal/catch_run_context.h b/include/internal/catch_run_context.h index 3f238171..56e03a7a 100644 --- a/include/internal/catch_run_context.h +++ b/include/internal/catch_run_context.h @@ -135,7 +135,7 @@ namespace Catch { std::vector m_unfinishedSections; std::vector m_activeSections; TrackerContext m_trackerContext; - size_t m_prevPassed = 0; + std::size_t m_prevPassed = 0; bool m_shouldReportUnexpected = true; }; diff --git a/include/internal/catch_stream.cpp b/include/internal/catch_stream.cpp index 14a89bac..73889ce8 100644 --- a/include/internal/catch_stream.cpp +++ b/include/internal/catch_stream.cpp @@ -18,7 +18,7 @@ namespace Catch { - template + template class StreamBufImpl : public StreamBufBase { char data[bufferSize]; WriterF m_writer; diff --git a/include/internal/catch_stringref.h b/include/internal/catch_stringref.h index 5870151c..b2aad29c 100644 --- a/include/internal/catch_stringref.h +++ b/include/internal/catch_stringref.h @@ -25,7 +25,7 @@ namespace Catch { class StringRef { friend struct StringRefTestAccess; - using size_type = size_t; + using size_type = std::size_t; char const* m_start; size_type m_size; diff --git a/include/internal/catch_test_case_info.cpp b/include/internal/catch_test_case_info.cpp index f21b6ef6..1f56dbf7 100644 --- a/include/internal/catch_test_case_info.cpp +++ b/include/internal/catch_test_case_info.cpp @@ -131,7 +131,7 @@ namespace Catch { std::string TestCaseInfo::tagsAsString() const { std::string ret; // '[' and ']' per tag - size_t full_size = 2 * tags.size(); + std::size_t full_size = 2 * tags.size(); for (const auto& tag : tags) { full_size += tag.size(); } diff --git a/include/internal/catch_test_case_registry_impl.h b/include/internal/catch_test_case_registry_impl.h index 77d4b9ee..ad45e5a0 100644 --- a/include/internal/catch_test_case_registry_impl.h +++ b/include/internal/catch_test_case_registry_impl.h @@ -43,7 +43,7 @@ namespace Catch { std::vector m_functions; mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder; mutable std::vector m_sortedFunctions; - size_t m_unnamedCount = 0; + std::size_t m_unnamedCount = 0; std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised }; diff --git a/include/internal/catch_test_spec_parser.h b/include/internal/catch_test_spec_parser.h index 87f7f31f..79ce8898 100644 --- a/include/internal/catch_test_spec_parser.h +++ b/include/internal/catch_test_spec_parser.h @@ -45,7 +45,7 @@ namespace Catch { template void addPattern() { std::string token = subString(); - for( size_t i = 0; i < m_escapeChars.size(); ++i ) + for( std::size_t i = 0; i < m_escapeChars.size(); ++i ) token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 ); m_escapeChars.clear(); if( startsWith( token, "exclude:" ) ) { diff --git a/include/internal/catch_timer.cpp b/include/internal/catch_timer.cpp index ec1d8bb5..a6f37e8e 100644 --- a/include/internal/catch_timer.cpp +++ b/include/internal/catch_timer.cpp @@ -20,7 +20,7 @@ namespace Catch { uint64_t sum = 0; static const uint64_t iterations = 1000000; - for( size_t i = 0; i < iterations; ++i ) { + for( std::size_t i = 0; i < iterations; ++i ) { uint64_t ticks; uint64_t baseTicks = getCurrentNanosecondsSinceEpoch(); diff --git a/include/reporters/catch_reporter_bases.cpp b/include/reporters/catch_reporter_bases.cpp index 1db7868c..c2059b5a 100644 --- a/include/reporters/catch_reporter_bases.cpp +++ b/include/reporters/catch_reporter_bases.cpp @@ -28,7 +28,7 @@ namespace Catch { // + 1 for decimal point // + 3 for the 3 decimal places // + 1 for null terminator - const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; char buffer[maxDoubleSize]; // Save previous errno, to prevent sprintf from overwriting it diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp index a3662d9c..12ba72ec 100644 --- a/include/reporters/catch_reporter_console.cpp +++ b/include/reporters/catch_reporter_console.cpp @@ -95,7 +95,7 @@ namespace { tp.m_currentColumn++; auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; - auto padding = ( strSize+2 < static_cast( colInfo.width ) ) + auto padding = ( strSize+2 < static_cast( colInfo.width ) ) ? std::string( colInfo.width-(strSize+2), ' ' ) : std::string(); if( colInfo.justification == ColumnInfo::Left ) diff --git a/include/reporters/catch_reporter_junit.cpp b/include/reporters/catch_reporter_junit.cpp index c0e2e3cf..bb7f6d9c 100644 --- a/include/reporters/catch_reporter_junit.cpp +++ b/include/reporters/catch_reporter_junit.cpp @@ -26,7 +26,7 @@ namespace Catch { // Also, UTC only, again because of backward compatibility (%z is C++11) time_t rawtime; std::time(&rawtime); - const size_t timeStampSize = sizeof("2017-01-16T17:06:45Z"); + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); #ifdef _MSC_VER std::tm timeInfo = {}; diff --git a/include/reporters/catch_reporter_tap.hpp b/include/reporters/catch_reporter_tap.hpp index dbcad5ee..edb75b5a 100644 --- a/include/reporters/catch_reporter_tap.hpp +++ b/include/reporters/catch_reporter_tap.hpp @@ -59,12 +59,12 @@ namespace Catch { } private: - size_t counter = 0; + std::size_t counter = 0; class AssertionPrinter { public: AssertionPrinter& operator= ( AssertionPrinter const& ) = delete; AssertionPrinter( AssertionPrinter const& ) = delete; - AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t _counter ) + AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter ) : stream( _stream ) , result( _stats.assertionResult ) , messages( _stats.infoMessages ) @@ -232,7 +232,7 @@ namespace Catch { std::vector messages; std::vector::const_iterator itMessage; bool printInfoMessages; - size_t counter; + std::size_t counter; }; void printTotals( const Totals& totals ) const { diff --git a/projects/Benchmark/StringificationBench.cpp b/projects/Benchmark/StringificationBench.cpp index 1c14939b..765b4e96 100644 --- a/projects/Benchmark/StringificationBench.cpp +++ b/projects/Benchmark/StringificationBench.cpp @@ -11,11 +11,11 @@ /////////////////////////////////////////////////////////////////////////////// TEST_CASE("Successful tests -- REQUIRE", "[Success]") { - const size_t sz = 1 * 1024 * 1024; + const std::size_t sz = 1 * 1024 * 1024; - std::vector vec; vec.reserve(sz); - for (size_t i = 0; i < sz; ++i){ + std::vector vec; vec.reserve(sz); + for (std::size_t i = 0; i < sz; ++i){ vec.push_back(i); REQUIRE(vec.back() == i); } @@ -23,11 +23,11 @@ TEST_CASE("Successful tests -- REQUIRE", "[Success]") { /////////////////////////////////////////////////////////////////////////////// TEST_CASE("Successful tests -- CHECK", "[Success]") { - const size_t sz = 1 * 1024 * 1024; + const std::size_t sz = 1 * 1024 * 1024; - std::vector vec; vec.reserve(sz); - for (size_t i = 0; i < sz; ++i){ + std::vector vec; vec.reserve(sz); + for (std::size_t i = 0; i < sz; ++i){ vec.push_back(i); CHECK(vec.back() == i); } @@ -35,11 +35,11 @@ TEST_CASE("Successful tests -- CHECK", "[Success]") { /////////////////////////////////////////////////////////////////////////////// TEST_CASE("Unsuccessful tests -- CHECK", "[Failure]") { - const size_t sz = 1024 * 1024; + const std::size_t sz = 1024 * 1024; - std::vector vec; vec.reserve(sz); - for (size_t i = 0; i < sz; ++i){ + std::vector vec; vec.reserve(sz); + for (std::size_t i = 0; i < sz; ++i){ vec.push_back(i); CHECK(vec.size() == i); } diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 2151d77c..ff9a0a10 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -96,7 +96,7 @@ TEST_CASE( "looped SECTION tests", "[.][failing][sections]" ) { TEST_CASE( "looped tests", "[.][failing]" ) { static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 }; - for( size_t i=0; i < sizeof(fib)/sizeof(int); ++i ) { + for( std::size_t i=0; i < sizeof(fib)/sizeof(int); ++i ) { INFO( "Testing if fib[" << i << "] (" << fib[i] << ") is even" ); CHECK( ( fib[i] % 2 ) == 0 ); } @@ -163,7 +163,7 @@ TEST_CASE( "send a single char to INFO", "[failing][.]" ) { } TEST_CASE( "atomic if", "[failing][0]") { - size_t x = 0; + std::size_t x = 0; if( x ) REQUIRE(x > 0);