From d10b9bd02e098476670f5eb0527d2c7281476e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 28 Dec 2019 21:24:04 +0100 Subject: [PATCH] v2.11.1 --- CMakeLists.txt | 2 +- README.md | 4 +- docs/release-notes.md | 12 +++ include/catch.hpp | 2 +- include/internal/catch_version.cpp | 2 +- single_include/catch2/catch.hpp | 148 ++++++++++++++++------------- 6 files changed, 100 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6115cba..d5fcb7d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) endif() -project(Catch2 LANGUAGES CXX VERSION 2.11.0) +project(Catch2 LANGUAGES CXX VERSION 2.11.1) # Provide path for scripts list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") diff --git a/README.md b/README.md index cc28acc0..a2adb83f 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ [![Build Status](https://travis-ci.org/catchorg/Catch2.svg?branch=master)](https://travis-ci.org/catchorg/Catch2) [![Build status](https://ci.appveyor.com/api/projects/status/github/catchorg/Catch2?svg=true)](https://ci.appveyor.com/project/catchorg/catch2) [![codecov](https://codecov.io/gh/catchorg/Catch2/branch/master/graph/badge.svg)](https://codecov.io/gh/catchorg/Catch2) -[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/HU1MkiBgFetFQJU4) +[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/Fj98nizVNqgaWH3i) [![Join the chat in Discord: https://discord.gg/4CWS9zD](https://img.shields.io/badge/Discord-Chat!-brightgreen.svg)](https://discord.gg/4CWS9zD) -The latest version of the single header can be downloaded directly using this link +The latest version of the single header can be downloaded directly using this link ## Catch2 is released! diff --git a/docs/release-notes.md b/docs/release-notes.md index 21617d3d..80ee3287 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -31,6 +31,18 @@ [Older versions](#older-versions)
[Even Older versions](#even-older-versions)
+## 2.11.1 + +### Improvements +* Breaking into debugger is supported on iOS (#1817) +* `google-build-using-namespace` clang-tidy warning is suppressed (#1799) + +### Fixes +* Clang on Windows is no longer assumed to implement MSVC's traditional preprocessor (#1806) +* `ObjectStorage` now behaves properly in `const` contexts (#1820) +* `GENERATE_COPY(a, b)` now compiles properly (#1809, #1815) +* Some more cleanups in the benchmarking support + ## 2.11.0 diff --git a/include/catch.hpp b/include/catch.hpp index b1dd90f8..d2f1a8e7 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -11,7 +11,7 @@ #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 11 -#define CATCH_VERSION_PATCH 0 +#define CATCH_VERSION_PATCH 1 #ifdef __clang__ # pragma clang system_header diff --git a/include/internal/catch_version.cpp b/include/internal/catch_version.cpp index 09e0a84f..ca59d6db 100644 --- a/include/internal/catch_version.cpp +++ b/include/internal/catch_version.cpp @@ -37,7 +37,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 2, 11, 0, "", 0 ); + static Version version( 2, 11, 1, "", 0 ); return version; } diff --git a/single_include/catch2/catch.hpp b/single_include/catch2/catch.hpp index b4eccfc1..6c1756a6 100644 --- a/single_include/catch2/catch.hpp +++ b/single_include/catch2/catch.hpp @@ -1,6 +1,6 @@ /* - * Catch v2.11.0 - * Generated: 2019-11-15 15:01:56.628356 + * Catch v2.11.1 + * Generated: 2019-12-28 21:22:11.930976 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved. @@ -15,7 +15,7 @@ #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 11 -#define CATCH_VERSION_PATCH 0 +#define CATCH_VERSION_PATCH 1 #ifdef __clang__ # pragma clang system_header @@ -241,9 +241,12 @@ namespace Catch { // MSVC traditional preprocessor needs some workaround for __VA_ARGS__ // _MSVC_TRADITIONAL == 0 means new conformant preprocessor // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif +# if !defined(__clang__) // Handle Clang masquerading for msvc +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif // MSVC_TRADITIONAL +# endif // __clang__ + #endif // _MSC_VER #if defined(_REENTRANT) || defined(_MSC_VER) @@ -3907,7 +3910,6 @@ namespace Generators { class SingleValueGenerator final : public IGenerator { T m_value; public: - SingleValueGenerator(T const& value) : m_value( value ) {} SingleValueGenerator(T&& value) : m_value(std::move(value)) {} T const& get() const override { @@ -3970,21 +3972,21 @@ namespace Generators { m_generators.emplace_back(std::move(generator)); } void populate(T&& val) { - m_generators.emplace_back(value(std::move(val))); + m_generators.emplace_back(value(std::forward(val))); } template void populate(U&& val) { - populate(T(std::move(val))); + populate(T(std::forward(val))); } template - void populate(U&& valueOrGenerator, Gs... moreGenerators) { + void populate(U&& valueOrGenerator, Gs &&... moreGenerators) { populate(std::forward(valueOrGenerator)); populate(std::forward(moreGenerators)...); } public: template - Generators(Gs... moreGenerators) { + Generators(Gs &&... moreGenerators) { m_generators.reserve(sizeof...(Gs)); populate(std::forward(moreGenerators)...); } @@ -4015,7 +4017,7 @@ namespace Generators { struct as {}; template - auto makeGenerators( GeneratorWrapper&& generator, Gs... moreGenerators ) -> Generators { + auto makeGenerators( GeneratorWrapper&& generator, Gs &&... moreGenerators ) -> Generators { return Generators(std::move(generator), std::forward(moreGenerators)...); } template @@ -4023,11 +4025,11 @@ namespace Generators { return Generators(std::move(generator)); } template - auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators { + auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators { return makeGenerators( value( std::forward( val ) ), std::forward( moreGenerators )... ); } template - auto makeGenerators( as, U&& val, Gs... moreGenerators ) -> Generators { + auto makeGenerators( as, U&& val, Gs &&... moreGenerators ) -> Generators { return makeGenerators( value( T( std::forward( val ) ) ), std::forward( moreGenerators )... ); } @@ -4053,11 +4055,11 @@ namespace Generators { } // namespace Catch #define GENERATE( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_COPY( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_REF( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) // end catch_generators.hpp // start catch_generators_generic.hpp @@ -7320,60 +7322,65 @@ namespace Catch { #include namespace Catch { - namespace Detail { - template - struct ObjectStorage - { - using TStorage = typename std::aligned_storage::value>::type; - - ObjectStorage() : data() {} - - ObjectStorage(const ObjectStorage& other) + namespace Benchmark { + namespace Detail { + template + struct ObjectStorage { - new(&data) T(other.stored_object()); - } + using TStorage = typename std::aligned_storage::value>::type; - ObjectStorage(ObjectStorage&& other) - { - new(&data) T(std::move(other.stored_object())); - } + ObjectStorage() : data() {} - ~ObjectStorage() { destruct_on_exit(); } + ObjectStorage(const ObjectStorage& other) + { + new(&data) T(other.stored_object()); + } - template - void construct(Args&&... args) - { - new (&data) T(std::forward(args)...); - } + ObjectStorage(ObjectStorage&& other) + { + new(&data) T(std::move(other.stored_object())); + } - template - typename std::enable_if::type destruct() - { - stored_object().~T(); - } + ~ObjectStorage() { destruct_on_exit(); } - private: - // If this is a constructor benchmark, destruct the underlying object - template - void destruct_on_exit(typename std::enable_if::type* = 0) { destruct(); } - // Otherwise, don't - template - void destruct_on_exit(typename std::enable_if::type* = 0) { } + template + void construct(Args&&... args) + { + new (&data) T(std::forward(args)...); + } - T& stored_object() - { - return *static_cast(static_cast(&data)); - } + template + typename std::enable_if::type destruct() + { + stored_object().~T(); + } - TStorage data; - }; + private: + // If this is a constructor benchmark, destruct the underlying object + template + void destruct_on_exit(typename std::enable_if::type* = 0) { destruct(); } + // Otherwise, don't + template + void destruct_on_exit(typename std::enable_if::type* = 0) { } + + T& stored_object() { + return *static_cast(static_cast(&data)); + } + + T const& stored_object() const { + return *static_cast(static_cast(&data)); + } + + TStorage data; + }; + } + + template + using storage_for = Detail::ObjectStorage; + + template + using destructable_object = Detail::ObjectStorage; } - - template - using storage_for = Detail::ObjectStorage; - - template - using destructable_object = Detail::ObjectStorage; } // end catch_constructor.hpp @@ -7854,6 +7861,17 @@ namespace Catch { #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ +#elif defined(CATCH_PLATFORM_IPHONE) + + // use inline assembler + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3") + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #elif defined(__arm__) + #define CATCH_TRAP() __asm__(".inst 0xe7f001f0") + #endif + #elif defined(CATCH_PLATFORM_LINUX) // If we can use inline assembler, do it because this allows us to break // directly at the location of the failing check instead of breaking inside @@ -10094,7 +10112,7 @@ namespace { bool useColourOnPlatform() { return -#ifdef CATCH_PLATFORM_MAC +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) !isDebuggerActive() && #endif #if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) @@ -10271,7 +10289,7 @@ namespace Catch { // end catch_debug_console.cpp // start catch_debugger.cpp -#ifdef CATCH_PLATFORM_MAC +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) # include # include @@ -15050,7 +15068,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 2, 11, 0, "", 0 ); + static Version version( 2, 11, 1, "", 0 ); return version; }