Skip to content

Commit

Permalink
v3.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Mar 1, 2024
1 parent b20b365 commit 8ac8190
Show file tree
Hide file tree
Showing 7 changed files with 259 additions and 100 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()

project(Catch2
VERSION 3.5.2 # CML version placeholder, don't delete
VERSION 3.5.3 # CML version placeholder, don't delete
LANGUAGES CXX
# HOMEPAGE_URL is not supported until CMake version 3.12, which
# we do not target yet.
Expand Down
26 changes: 26 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Release notes
**Contents**<br>
[3.5.3](#353)<br>
[3.5.2](#352)<br>
[3.5.1](#351)<br>
[3.5.0](#350)<br>
Expand Down Expand Up @@ -60,6 +61,31 @@
[Even Older versions](#even-older-versions)<br>


## 3.5.3

### Fixes
* Fixed OOB access when computing filename tag (from the `-#` flag) for file without extension (#2798)
* Fixed the linking against `log` on Android to be `PRIVATE` (#2815)
* Fixed `Wuseless-cast` in benchmarking internals (#2823)

### Improvements
* Restored compatibility with VS2017 (#2792, #2822)
* The baseline for Catch2 is still C++14 with some reasonable workarounds for specific compilers, so if VS2017 starts acting up again, the support will be dropped again.
* Suppressed clang-tidy's `bugprone-chained-comparison` in assertions (#2801)
* Improved the static analysis mode to evaluate arguments to `TEST_CASE` and `SECTION` (#2817)
* Clang-tidy should no longer warn about runtime arguments to these macros being unused in static analysis mode.
* Clang-tidy can warn on issues involved arguments to these macros.
* Added support for literal-zero detectors based on `consteval` constructors
* This is required for compiling `REQUIRE((a <=> b) == 0)` against MSVC's stdlib.
* Sadly, MSVC still cannot compile this assertion as it does not implement C++20 correctly.
* You can use `clang-cl` with MSVC's stdlib instead.
* If for some godforsaken reasons you want to understand this better, read the two relevant commits: [`dc51386b9fd61f99ea9c660d01867e6ad489b403`](https://github.com/catchorg/Catch2/commit/dc51386b9fd61f99ea9c660d01867e6ad489b403), and [`0787132fc82a75e3fb255aa9484ca1dc1eff2a30`](https://github.com/catchorg/Catch2/commit/0787132fc82a75e3fb255aa9484ca1dc1eff2a30).

### Miscellaneous
* Disabled tests for FP random generator reproducibility on non-SSE2 x86 targets (#2796)
* Modified the in-tree Conan recipe to support Conan 2 (#2805)


## 3.5.2

### Fixes
Expand Down
93 changes: 56 additions & 37 deletions extras/catch_amalgamated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// SPDX-License-Identifier: BSL-1.0

// Catch v3.5.2
// Generated: 2024-01-15 14:06:36.675713
// Catch v3.5.3
// Generated: 2024-03-01 22:05:56.038084
// ----------------------------------------------------------
// This file is an amalgamation of multiple different files.
// You probably shouldn't edit it directly.
Expand Down Expand Up @@ -101,8 +101,8 @@ namespace Catch {
FDuration mean = FDuration(0);
int i = 0;
for (auto it = first; it < last; ++it, ++i) {
samples.push_back(FDuration(*it));
mean += FDuration(*it);
samples.push_back(*it);
mean += *it;
}
mean /= i;

Expand Down Expand Up @@ -558,7 +558,7 @@ bool marginComparison(double lhs, double rhs, double margin) {
namespace Catch {

Approx::Approx ( double value )
: m_epsilon( std::numeric_limits<float>::epsilon()*100. ),
: m_epsilon( static_cast<double>(std::numeric_limits<float>::epsilon())*100. ),
m_margin( 0.0 ),
m_scale( 0.0 ),
m_value( value )
Expand Down Expand Up @@ -1038,6 +1038,7 @@ namespace Catch {
m_messages.back().message += " := ";
start = pos;
}
default:; // noop
}
}
assert(openings.empty() && "Mismatched openings");
Expand Down Expand Up @@ -1581,8 +1582,10 @@ namespace Catch {
while (lastDot > 0 && filename[lastDot - 1] != '.') {
--lastDot;
}
--lastDot;
// In theory we could have filename without any extension in it
if ( lastDot == 0 ) { return StringRef(); }

--lastDot;
size_t nameStart = lastDot;
while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') {
--nameStart;
Expand Down Expand Up @@ -1966,13 +1969,13 @@ namespace Detail {
}
} // end unnamed namespace

std::string convertIntoString(StringRef string, bool escape_invisibles) {
std::string convertIntoString(StringRef string, bool escapeInvisibles) {
std::string ret;
// This is enough for the "don't escape invisibles" case, and a good
// lower bound on the "escape invisibles" case.
ret.reserve(string.size() + 2);

if (!escape_invisibles) {
if (!escapeInvisibles) {
ret += '"';
ret += string;
ret += '"';
Expand Down Expand Up @@ -2050,7 +2053,7 @@ std::string StringMaker<char const*>::convert(char const* str) {
return{ "{null string}" };
}
}
std::string StringMaker<char*>::convert(char* str) {
std::string StringMaker<char*>::convert(char* str) { // NOLINT(readability-non-const-parameter)
if (str) {
return Detail::convertIntoString( str );
} else {
Expand Down Expand Up @@ -2147,8 +2150,8 @@ std::string StringMaker<signed char>::convert(signed char value) {
std::string StringMaker<char>::convert(char c) {
return ::Catch::Detail::stringify(static_cast<signed char>(c));
}
std::string StringMaker<unsigned char>::convert(unsigned char c) {
return ::Catch::Detail::stringify(static_cast<char>(c));
std::string StringMaker<unsigned char>::convert(unsigned char value) {
return ::Catch::Detail::stringify(static_cast<char>(value));
}

int StringMaker<float>::precision = 5;
Expand Down Expand Up @@ -2268,7 +2271,7 @@ namespace Catch {
}

Version const& libraryVersion() {
static Version version( 3, 5, 2, "", 0 );
static Version version( 3, 5, 3, "", 0 );
return version;
}

Expand Down Expand Up @@ -3092,7 +3095,7 @@ namespace Catch {
line = trim(line);
if( !line.empty() && !startsWith( line, '#' ) ) {
if( !startsWith( line, '"' ) )
line = '"' + line + '"';
line = '"' + CATCH_MOVE(line) + '"';
config.testsOrTags.push_back( line );
config.testsOrTags.emplace_back( "," );
}
Expand Down Expand Up @@ -3573,21 +3576,21 @@ namespace {

namespace Catch {

Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode implSelection,
Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode colourSelection,
IStream* stream ) {
#if defined( CATCH_CONFIG_COLOUR_WIN32 )
if ( implSelection == ColourMode::Win32 ) {
if ( colourSelection == ColourMode::Win32 ) {
return Detail::make_unique<Win32ColourImpl>( stream );
}
#endif
if ( implSelection == ColourMode::ANSI ) {
if ( colourSelection == ColourMode::ANSI ) {
return Detail::make_unique<ANSIColourImpl>( stream );
}
if ( implSelection == ColourMode::None ) {
if ( colourSelection == ColourMode::None ) {
return Detail::make_unique<NoColourImpl>( stream );
}

if ( implSelection == ColourMode::PlatformDefault) {
if ( colourSelection == ColourMode::PlatformDefault) {
#if defined( CATCH_CONFIG_COLOUR_WIN32 )
if ( Win32ColourImpl::useImplementationForStream( *stream ) ) {
return Detail::make_unique<Win32ColourImpl>( stream );
Expand All @@ -3599,7 +3602,7 @@ namespace Catch {
return Detail::make_unique<NoColourImpl>( stream );
}

CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(implSelection) );
CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(colourSelection) );
}

bool isColourImplAvailable( ColourMode colourSelection ) {
Expand Down Expand Up @@ -3807,7 +3810,12 @@ namespace Catch {

namespace Catch {

ITransientExpression::~ITransientExpression() = default;
void ITransientExpression::streamReconstructedExpression(
std::ostream& os ) const {
// We can't make this function pure virtual to keep ITransientExpression
// constexpr, so we write error message instead
os << "Some class derived from ITransientExpression without overriding streamReconstructedExpression";
}

void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
if( lhs.size() + rhs.size() < 40 &&
Expand Down Expand Up @@ -4473,7 +4481,7 @@ namespace Catch {
m_os{ os }, m_indent_level{ indent_level } {
m_os << '{';
}
JsonObjectWriter::JsonObjectWriter( JsonObjectWriter&& source ):
JsonObjectWriter::JsonObjectWriter( JsonObjectWriter&& source ) noexcept:
m_os{ source.m_os },
m_indent_level{ source.m_indent_level },
m_should_comma{ source.m_should_comma },
Expand Down Expand Up @@ -4504,7 +4512,7 @@ namespace Catch {
m_os{ os }, m_indent_level{ indent_level } {
m_os << '[';
}
JsonArrayWriter::JsonArrayWriter( JsonArrayWriter&& source ):
JsonArrayWriter::JsonArrayWriter( JsonArrayWriter&& source ) noexcept:
m_os{ source.m_os },
m_indent_level{ source.m_indent_level },
m_should_comma{ source.m_should_comma },
Expand Down Expand Up @@ -5283,7 +5291,7 @@ namespace Catch {
auto kv = splitKVPair( parts[i] );
auto key = kv.key, value = kv.value;

if ( key.empty() || value.empty() ) {
if ( key.empty() || value.empty() ) { // NOLINT(bugprone-branch-clone)
return {};
} else if ( key[0] == 'X' ) {
// This is a reporter-specific option, we don't check these
Expand Down Expand Up @@ -6297,17 +6305,29 @@ namespace Catch {
}

bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
bool replaced = false;
std::size_t i = str.find( replaceThis );
while( i != std::string::npos ) {
replaced = true;
str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
if( i < str.size()-withThis.size() )
i = str.find( replaceThis, i+withThis.size() );
if (i == std::string::npos) {
return false;
}
std::size_t copyBegin = 0;
std::string origStr = CATCH_MOVE(str);
str.clear();
// There is at least one replacement, so reserve with the best guess
// we can make without actually counting the number of occurences.
str.reserve(origStr.size() - replaceThis.size() + withThis.size());
do {
str.append(origStr, copyBegin, i-copyBegin );
str += withThis;
copyBegin = i + replaceThis.size();
if( copyBegin < origStr.size() )
i = origStr.find( replaceThis, copyBegin );
else
i = std::string::npos;
} while( i != std::string::npos );
if ( copyBegin < origStr.size() ) {
str.append(origStr, copyBegin, origStr.size() );
}
return replaced;
return true;
}

std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
Expand Down Expand Up @@ -9099,8 +9119,8 @@ void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
m_stream << '\n' << std::flush;
StreamingReporterBase::testRunEnded(_testRunStats);
}
void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) {
StreamingReporterBase::testRunStarting(_testInfo);
void ConsoleReporter::testRunStarting(TestRunInfo const& _testRunInfo) {
StreamingReporterBase::testRunStarting(_testRunInfo);
if ( m_config->testSpec().hasFilters() ) {
m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: "
<< m_config->testSpec() << '\n';
Expand Down Expand Up @@ -9253,8 +9273,7 @@ namespace Catch {
namespace {
struct BySectionInfo {
BySectionInfo( SectionInfo const& other ): m_other( other ) {}
BySectionInfo( BySectionInfo const& other ):
m_other( other.m_other ) {}
BySectionInfo( BySectionInfo const& other ) = default;
bool operator()(
Detail::unique_ptr<CumulativeReporterBase::SectionNode> const&
node ) const {
Expand Down Expand Up @@ -9879,8 +9898,8 @@ namespace Catch {
return "Outputs listings as JSON. Test listing is Work-in-Progress!";
}

void JsonReporter::testRunStarting( TestRunInfo const& testInfo ) {
StreamingReporterBase::testRunStarting( testInfo );
void JsonReporter::testRunStarting( TestRunInfo const& runInfo ) {
StreamingReporterBase::testRunStarting( runInfo );
endListing();

assert( isInside( Writer::Object ) );
Expand Down Expand Up @@ -10178,7 +10197,7 @@ namespace Catch {

static void normalizeNamespaceMarkers(std::string& str) {
std::size_t pos = str.find( "::" );
while ( pos != str.npos ) {
while ( pos != std::string::npos ) {
str.replace( pos, 2, "." );
pos += 1;
pos = str.find( "::", pos );
Expand Down
Loading

0 comments on commit 8ac8190

Please sign in to comment.