diff --git a/CMakeLists.txt b/CMakeLists.txt
index be12d516c4..c42a3e2a19 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()
project(Catch2
- VERSION 3.1.0 # CML version placeholder, don't delete
+ VERSION 3.1.1 # CML version placeholder, don't delete
LANGUAGES CXX
# HOMEPAGE_URL is not supported until CMake version 3.12, which
# we do not target yet.
diff --git a/docs/release-notes.md b/docs/release-notes.md
index da2c598ceb..0b52941ca2 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -2,6 +2,7 @@
# Release notes
**Contents**
+[3.1.1](#311)
[3.1.0](#310)
[3.0.1](#301)
[2.13.7](#2137)
@@ -50,6 +51,39 @@
[Even Older versions](#even-older-versions)
+
+## 3.1.1
+
+### Improvements
+* Added `Catch::getSeed` function that user code can call to retrieve current rng-seed
+* Better detection of compiler support for `-ffile-prefix-map` (#2517)
+* Catch2's shared libraries now have `SOVERSION` set (#2516)
+* `catch2/catch_all.hpp` convenience header no longer transitively includes `windows.h` (#2432, #2526)
+
+
+### Fixes
+* Fixed compilation on Universal Windows Platform
+* Fixed compilation on VxWorks (#2515)
+* Fixed compilation on Cygwin (#2540)
+* Remove unused variable in reporter registration (#2538)
+* Fixed some symbol visibility issues with dynamic library on Windows (#2527)
+* Suppressed `-Wuseless-cast` warnings in `REQUIRE_THROWS*` macros (#2520, #2521)
+ * This was triggered when the potentially throwing expression evaluates to `void`
+* Fixed "warning: storage class is not first" with `nvc++` (#2533)
+* Fixed handling of `DL_PATHS` argument to `catch_discover_tests` on MacOS (#2483)
+* Suppressed `*-avoid-c-arrays` clang-tidy warning in `TEMPLATE_TEST_CASE` (#2095, #2536)
+
+
+### Miscellaneous
+* Fixed CMake install step for Catch2 build as dynamic library (#2485)
+* Raised minimum CMake version to 3.10 (#2523)
+ * Expect the minimum CMake version to increase once more in next few releases.
+* Whole bunch of doc updates and fixes
+ * #1444, #2497, #2547, #2549, and more
+* Added support for building Catch2 with Meson (#2530, #2539)
+
+
+
## 3.1.0
### Improvements
diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp
index ecda2301b3..1f5527a437 100644
--- a/extras/catch_amalgamated.cpp
+++ b/extras/catch_amalgamated.cpp
@@ -5,8 +5,8 @@
// SPDX-License-Identifier: BSL-1.0
-// Catch v3.1.0
-// Generated: 2022-07-17 20:14:05.885021
+// Catch v3.1.1
+// Generated: 2022-10-17 18:47:22.400176
// ----------------------------------------------------------
// This file is an amalgamation of multiple different files.
// You probably shouldn't edit it directly.
@@ -15,6 +15,28 @@
#include "catch_amalgamated.hpp"
+#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
+#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
+
+
+#if defined(CATCH_PLATFORM_WINDOWS)
+
+// We might end up with the define made globally through the compiler,
+// and we don't want to trigger warnings for this
+#if !defined(NOMINMAX)
+# define NOMINMAX
+#endif
+#if !defined(WIN32_LEAN_AND_MEAN)
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#include
+
+#endif // defined(CATCH_PLATFORM_WINDOWS)
+
+#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
+
+
namespace Catch {
@@ -488,8 +510,11 @@ namespace Catch {
namespace {
bool provideBazelReporterOutput() {
-#ifdef CATCH_CONFIG_BAZEL_SUPPORT
+#if defined(CATCH_CONFIG_BAZEL_SUPPORT)
return true;
+#elif defined(CATCH_PLATFORM_WINDOWS_UWP)
+ // UWP does not support environment variables
+ return false;
#else
# if defined( _MSC_VER )
@@ -554,6 +579,7 @@ namespace Catch {
} );
}
+#if !defined(CATCH_PLATFORM_WINDOWS_UWP)
if(provideBazelReporterOutput()){
// Register a JUnit reporter for Bazel. Bazel sets an environment
// variable with the path to XML output. If this file is written to
@@ -575,7 +601,7 @@ namespace Catch {
{ "junit", std::string( bazelOutputFilePtr ), {}, {} } );
}
}
-
+#endif
// We now fixup the reporter specs to handle default output spec,
// default colour spec, etc
@@ -659,6 +685,16 @@ namespace Catch {
+
+
+namespace Catch {
+ std::uint32_t getSeed() {
+ return getCurrentContext().getConfig()->rngSeed();
+ }
+}
+
+
+
#include
#include
@@ -882,7 +918,6 @@ namespace Catch {
multi->addListener(listener->create(config));
}
- std::size_t reporterIdx = 0;
for ( auto const& reporterSpec : config->getProcessedReporterSpecs() ) {
multi->addReporter( createReporter(
reporterSpec.name,
@@ -890,7 +925,6 @@ namespace Catch {
makeStream( reporterSpec.outputFilename ),
reporterSpec.colourMode,
reporterSpec.customOptions ) ) );
- reporterIdx++;
}
return multi;
@@ -1890,7 +1924,7 @@ namespace Catch {
}
Version const& libraryVersion() {
- static Version version( 3, 1, 0, "", 0 );
+ static Version version( 3, 1, 1, "", 0 );
return version;
}
@@ -3957,6 +3991,7 @@ namespace Detail {
FileStream( std::string const& filename ) {
m_ofs.open( filename.c_str() );
CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' );
+ m_ofs << std::unitbuf;
}
~FileStream() override = default;
public: // IStream
@@ -7878,7 +7913,7 @@ class AssertionPrinter {
<< serializeFilters( m_config->getTestsOrTags() )
<< '\n';
}
- m_stream << "RNG seed: " << m_config->rngSeed() << '\n';
+ m_stream << "RNG seed: " << getSeed() << '\n';
}
void CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {
@@ -8399,7 +8434,7 @@ void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) {
m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: "
<< serializeFilters( m_config->getTestsOrTags() ) << '\n';
}
- m_stream << "Randomness seeded to: " << m_config->rngSeed() << '\n';
+ m_stream << "Randomness seeded to: " << getSeed() << '\n';
}
void ConsoleReporter::lazyPrint() {
diff --git a/extras/catch_amalgamated.hpp b/extras/catch_amalgamated.hpp
index 757e10c5ac..cff2cedfaa 100644
--- a/extras/catch_amalgamated.hpp
+++ b/extras/catch_amalgamated.hpp
@@ -5,8 +5,8 @@
// SPDX-License-Identifier: BSL-1.0
-// Catch v3.1.0
-// Generated: 2022-07-17 20:14:04.055157
+// Catch v3.1.1
+// Generated: 2022-10-17 18:47:20.510385
// ----------------------------------------------------------
// This file is an amalgamation of multiple different files.
// You probably shouldn't edit it directly.
@@ -326,6 +326,10 @@ namespace Catch {
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
# define CATCH_PLATFORM_WINDOWS
+
+# if defined( WINAPI_FAMILY ) && ( WINAPI_FAMILY == WINAPI_FAMILY_APP )
+# define CATCH_PLATFORM_WINDOWS_UWP
+# endif
#endif
#endif // CATCH_PLATFORM_HPP_INCLUDED
@@ -356,6 +360,9 @@ namespace Catch {
# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
_Pragma( "GCC diagnostic ignored \"-Wunused-variable\"" )
+# define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \
+ _Pragma( "GCC diagnostic ignored \"-Wuseless-cast\"" )
+
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__)
#endif
@@ -477,7 +484,7 @@ namespace Catch {
// Universal Windows platform does not support SEH
// Or console colours (or console at all...)
-# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+# if defined(CATCH_PLATFORM_WINDOWS_UWP)
# define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32
# else
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
@@ -638,6 +645,9 @@ namespace Catch {
#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS
#endif
+#if !defined(CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS)
+# define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS
+#endif
#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS
#endif
@@ -679,6 +689,16 @@ namespace Catch {
# define CATCH_CONFIG_COLOUR_WIN32
#endif
+#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \
+ !defined( CATCH_CONFIG_STATIC )
+# ifdef Catch2_EXPORTS
+# define CATCH_EXPORT //__declspec( dllexport ) // not needed
+# else
+# define CATCH_EXPORT __declspec( dllimport )
+# endif
+#else
+# define CATCH_EXPORT
+#endif
#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
@@ -686,6 +706,7 @@ namespace Catch {
#ifndef CATCH_CONTEXT_HPP_INCLUDED
#define CATCH_CONTEXT_HPP_INCLUDED
+
namespace Catch {
class IResultCapture;
@@ -706,7 +727,7 @@ namespace Catch {
virtual void setConfig( IConfig const* config ) = 0;
private:
- static IMutableContext *currentContext;
+ CATCH_EXPORT static IMutableContext* currentContext;
friend IMutableContext& getCurrentMutableContext();
friend void cleanUpContext();
static void createContext();
@@ -1716,9 +1737,9 @@ namespace Catch {
template struct true_given : std::true_type {};
struct is_callable_tester {
template
- true_given()(std::declval()...))> static test(int);
+ static true_given()(std::declval()...))> test(int);
template
- std::false_type static test(...);
+ static std::false_type test(...);
};
template
@@ -2737,14 +2758,18 @@ namespace Catch {
template
void destruct_on_exit(std::enable_if_t* = nullptr) { }
- T& stored_object() {
- return *static_cast(static_cast(data));
- }
+#if defined( __GNUC__ ) && __GNUC__ <= 6
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif
+ T& stored_object() { return *reinterpret_cast( data ); }
T const& stored_object() const {
- return *static_cast(static_cast(data));
+ return *reinterpret_cast( data );
}
-
+#if defined( __GNUC__ ) && __GNUC__ <= 6
+# pragma GCC diagnostic pop
+#endif
alignas( T ) unsigned char data[sizeof( T )]{};
};
@@ -2776,7 +2801,6 @@ namespace Catch {
#include
#include
#include
-#include
@@ -2939,6 +2963,13 @@ namespace Catch {
namespace Detail {
+ inline std::size_t catch_strnlen(const char *str, std::size_t n) {
+ auto ret = std::char_traits::find(str, n, '\0');
+ if (ret != nullptr) {
+ return static_cast(ret - str);
+ }
+ return n;
+ }
constexpr StringRef unprintableString = "{?}"_sr;
@@ -3106,28 +3137,24 @@ namespace Catch {
template
struct StringMaker {
static std::string convert(char const* str) {
- // Note that `strnlen` is not actually part of standard C++,
- // but both POSIX and Windows cstdlib provide it.
return Detail::convertIntoString(
- StringRef( str, strnlen( str, SZ ) ) );
+ StringRef( str, Detail::catch_strnlen( str, SZ ) ) );
}
};
template
struct StringMaker {
static std::string convert(signed char const* str) {
- // See the plain `char const*` overload
auto reinterpreted = reinterpret_cast(str);
return Detail::convertIntoString(
- StringRef(reinterpreted, strnlen(reinterpreted, SZ)));
+ StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));
}
};
template
struct StringMaker {
static std::string convert(unsigned char const* str) {
- // See the plain `char const*` overload
auto reinterpreted = reinterpret_cast(str);
return Detail::convertIntoString(
- StringRef(reinterpreted, strnlen(reinterpreted, SZ)));
+ StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));
}
};
@@ -3194,13 +3221,13 @@ namespace Catch {
template<>
struct StringMaker {
static std::string convert(float value);
- static int precision;
+ CATCH_EXPORT static int precision;
};
template<>
struct StringMaker {
static std::string convert(double value);
- static int precision;
+ CATCH_EXPORT static int precision;
};
template
@@ -4271,6 +4298,19 @@ namespace Catch {
#endif // CATCH_CONFIG_HPP_INCLUDED
+#ifndef CATCH_GET_RANDOM_SEED_HPP_INCLUDED
+#define CATCH_GET_RANDOM_SEED_HPP_INCLUDED
+
+#include
+
+namespace Catch {
+ //! Returns Catch2's current RNG seed.
+ std::uint32_t getSeed();
+}
+
+#endif // CATCH_GET_RANDOM_SEED_HPP_INCLUDED
+
+
#ifndef CATCH_MESSAGE_HPP_INCLUDED
#define CATCH_MESSAGE_HPP_INCLUDED
@@ -5642,7 +5682,10 @@ namespace Catch {
do { \
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
try { \
+ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
+ CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \
static_cast(__VA_ARGS__); \
+ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
catchAssertionHandler.handleExceptionNotThrownAsExpected(); \
} \
catch( ... ) { \
@@ -5657,7 +5700,10 @@ namespace Catch {
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
if( catchAssertionHandler.allowThrows() ) \
try { \
+ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
+ CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \
static_cast(__VA_ARGS__); \
+ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
} \
catch( ... ) { \
@@ -5674,7 +5720,10 @@ namespace Catch {
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
if( catchAssertionHandler.allowThrows() ) \
try { \
+ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
+ CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \
static_cast(expr); \
+ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
} \
catch( exceptionType const& ) { \
@@ -5697,7 +5746,10 @@ namespace Catch {
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
if( catchAssertionHandler.allowThrows() ) \
try { \
+ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
+ CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \
static_cast(__VA_ARGS__); \
+ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
} \
catch( ... ) { \
@@ -6447,12 +6499,12 @@ struct AutoReg : Detail::NonCopyable {
struct TestName{\
TestName(){\
size_t index = 0; \
- constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
- using expander = size_t[];\
+ constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\
+ using expander = size_t[]; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\
(void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \
}\
};\
- static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
+ static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
TestName();\
return 0;\
}();\
@@ -7063,7 +7115,7 @@ namespace Catch {
#define CATCH_VERSION_MAJOR 3
#define CATCH_VERSION_MINOR 1
-#define CATCH_VERSION_PATCH 0
+#define CATCH_VERSION_PATCH 1
#endif // CATCH_VERSION_MACROS_HPP_INCLUDED
@@ -9122,6 +9174,7 @@ namespace Catch {
#include
+#include
namespace Catch {
@@ -9673,32 +9726,6 @@ namespace Catch {
#endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
-#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
-#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
-
-
-#if defined(CATCH_PLATFORM_WINDOWS)
-
-// We might end up with the define made globally through the compiler,
-// and we don't want to trigger warnings for this
-#if !defined(NOMINMAX)
-# define NOMINMAX
-#endif
-#if !defined(WIN32_LEAN_AND_MEAN)
-# define WIN32_LEAN_AND_MEAN
-#endif
-
-#ifdef __AFXDLL
-#include
-#else
-#include
-#endif
-
-#endif // defined(CATCH_PLATFORM_WINDOWS)
-
-#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
-
-
#ifndef CATCH_XMLWRITER_HPP_INCLUDED
#define CATCH_XMLWRITER_HPP_INCLUDED
diff --git a/meson.build b/meson.build
index 5b9b75c11f..9655616fd0 100644
--- a/meson.build
+++ b/meson.build
@@ -8,7 +8,7 @@
project(
'catch2',
'cpp',
- version: '3.1.0', # CML version placeholder, don't delete
+ version: '3.1.1', # CML version placeholder, don't delete
license: 'BSL-1.0',
meson_version: '>=0.49.0',
)
diff --git a/src/catch2/catch_version.cpp b/src/catch2/catch_version.cpp
index a7075f3006..371dc9f68c 100644
--- a/src/catch2/catch_version.cpp
+++ b/src/catch2/catch_version.cpp
@@ -36,7 +36,7 @@ namespace Catch {
}
Version const& libraryVersion() {
- static Version version( 3, 1, 0, "", 0 );
+ static Version version( 3, 1, 1, "", 0 );
return version;
}
diff --git a/src/catch2/catch_version_macros.hpp b/src/catch2/catch_version_macros.hpp
index c7212e3a6a..5598497584 100644
--- a/src/catch2/catch_version_macros.hpp
+++ b/src/catch2/catch_version_macros.hpp
@@ -10,6 +10,6 @@
#define CATCH_VERSION_MAJOR 3
#define CATCH_VERSION_MINOR 1
-#define CATCH_VERSION_PATCH 0
+#define CATCH_VERSION_PATCH 1
#endif // CATCH_VERSION_MACROS_HPP_INCLUDED