From 20d413b8b6803c6d456874935d7014fe684e9426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 6 Jun 2022 01:04:07 +0200 Subject: [PATCH 1/8] Fix comma-subscript warning suppression to only target GCC 10.1+ Fixes #2416 --- projects/SelfTest/UsageTests/Message.tests.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/SelfTest/UsageTests/Message.tests.cpp b/projects/SelfTest/UsageTests/Message.tests.cpp index d151b2ba..e2bd486f 100644 --- a/projects/SelfTest/UsageTests/Message.tests.cpp +++ b/projects/SelfTest/UsageTests/Message.tests.cpp @@ -241,17 +241,19 @@ std::ostream& operator<<(std::ostream& out, helper_1436 const& helper) { return out; } +// clang can handle GCC's diagnostic pragma +#if defined( __GNUG__ ) || defined(__clang__) +# pragma GCC diagnostic push +#endif // Clang and gcc have different names for this warning, and clang also // warns about an unused value -#if defined(__GNUG__) && !defined(__clang__) -#pragma GCC diagnostic push +#if defined( __GNUG__ ) && !defined( __clang__ ) && \ + ( __GNUG__ > 10 || ( __GNUG__ == 10 && __GNUC_MINOR__ >= 1 ) ) #pragma GCC diagnostic ignored "-Wcomma-subscript" #elif defined(__clang__) -#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-comma-subscript" #pragma clang diagnostic ignored "-Wunused-value" #endif - TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messages][capture]") { CAPTURE(std::vector{1, 2, 3}[0, 1, 2], std::vector{1, 2, 3}[(0, 1)], @@ -261,9 +263,8 @@ TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messag CAPTURE( (1, 2), (2, 3) ); SUCCEED(); } - -#ifdef __GNUG__ -#pragma GCC diagnostic pop +#if defined( __GNUG__ ) || defined(__clang__) +# pragma GCC diagnostic pop #endif TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]") { From 14bc25be00881a0f85229d62dfeb32ce1e9cbe03 Mon Sep 17 00:00:00 2001 From: David Matson Date: Sat, 6 Aug 2022 12:15:53 -0700 Subject: [PATCH 2/8] Explicitly specify __cdecl on main/wmain for MSVC (#2487) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #2486 Co-authored-by: Martin Hořeňovský --- include/internal/catch_default_main.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_default_main.hpp b/include/internal/catch_default_main.hpp index aab5cba3..4d113d02 100644 --- a/include/internal/catch_default_main.hpp +++ b/include/internal/catch_default_main.hpp @@ -13,12 +13,20 @@ #ifndef __OBJC__ +#ifndef CATCH_INTERNAL_CDECL +#ifdef _MSC_VER +#define CATCH_INTERNAL_CDECL __cdecl +#else +#define CATCH_INTERNAL_CDECL +#endif +#endif + #if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) // Standard C/C++ Win32 Unicode wmain entry point -extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +extern "C" int CATCH_INTERNAL_CDECL wmain (int argc, wchar_t * argv[], wchar_t * []) { #else // Standard C/C++ main entry point -int main (int argc, char * argv[]) { +int CATCH_INTERNAL_CDECL main (int argc, char * argv[]) { #endif return Catch::Session().run( argc, argv ); From 02123776f208502aecd374a324472720e5e3352f Mon Sep 17 00:00:00 2001 From: Thomas Gamper Date: Sun, 21 Aug 2022 17:44:03 +0200 Subject: [PATCH 3/8] fixes catchorg/Catch2#2401 --- include/internal/catch_session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/catch_session.cpp b/include/internal/catch_session.cpp index 6254c584..6247fa7d 100644 --- a/include/internal/catch_session.cpp +++ b/include/internal/catch_session.cpp @@ -293,7 +293,7 @@ namespace Catch { // Handle list request if( Option listed = list( m_config ) ) - return static_cast( *listed ); + return (std::min) (MaxExitCode, static_cast(*listed)); TestGroup tests { m_config }; auto const totals = tests.execute(); From 182c910b4b63ff587a3440e08f84f70497e49a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 16 Oct 2022 11:02:17 +0200 Subject: [PATCH 4/8] v2.13.10 --- CMakeLists.txt | 2 +- README.md | 2 +- docs/release-notes.md | 10 ++++++++++ include/catch.hpp | 2 +- include/internal/catch_version.cpp | 2 +- single_include/catch2/catch.hpp | 28 +++++++++++++++++----------- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6f1d463..56ab7a44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) endif() -project(Catch2 LANGUAGES CXX VERSION 2.13.9) +project(Catch2 LANGUAGES CXX VERSION 2.13.10) # Provide path for scripts list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") diff --git a/README.md b/README.md index 26ac2bb3..3754d3c2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![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 b88acc89..9c4a1d2d 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,7 @@ # Release notes **Contents**
+[2.13.10](#21310)
[2.13.9](#2139)
[2.13.8](#2138)
[2.13.7](#2137)
@@ -50,6 +51,15 @@ [Even Older versions](#even-older-versions)
+## 2.13.10 + +### Fixes +* Fixed issue with `catch_discover_tests` when there is multiple of 256 tests (#2401, #2503) +* Catch2-provided `main` and `wmain` are explicitly marked as `__cdecl` when compiled with MSVC (#2486, #2487) +* Improved break-into-debugger behaviour for ARM Macs. It should now be possible to step execution after the break (#2422) +* Replaced deprecated `std::aligned_storage` (#2419, #2420) + + ## 2.13.9 ### Fixes diff --git a/include/catch.hpp b/include/catch.hpp index cfa894ac..39a30171 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -11,7 +11,7 @@ #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 13 -#define CATCH_VERSION_PATCH 9 +#define CATCH_VERSION_PATCH 10 #ifdef __clang__ # pragma clang system_header diff --git a/include/internal/catch_version.cpp b/include/internal/catch_version.cpp index bc9aaf9f..e1744727 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, 13, 9, "", 0 ); + static Version version( 2, 13, 10, "", 0 ); return version; } diff --git a/single_include/catch2/catch.hpp b/single_include/catch2/catch.hpp index d2a12427..9b309bdd 100644 --- a/single_include/catch2/catch.hpp +++ b/single_include/catch2/catch.hpp @@ -1,6 +1,6 @@ /* - * Catch v2.13.9 - * Generated: 2022-04-12 22:37:23.260201 + * Catch v2.13.10 + * Generated: 2022-10-16 11:01:23.452308 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2022 Two Blue Cubes Ltd. All rights reserved. @@ -15,7 +15,7 @@ #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 13 -#define CATCH_VERSION_PATCH 9 +#define CATCH_VERSION_PATCH 10 #ifdef __clang__ # pragma clang system_header @@ -7395,8 +7395,6 @@ namespace Catch { template struct ObjectStorage { - using TStorage = typename std::aligned_storage::value>::type; - ObjectStorage() : data() {} ObjectStorage(const ObjectStorage& other) @@ -7439,7 +7437,7 @@ namespace Catch { return *static_cast(static_cast(&data)); } - TStorage data; + struct { alignas(T) unsigned char data[sizeof(T)]; } data; }; } @@ -7949,7 +7947,7 @@ namespace Catch { #if defined(__i386__) || defined(__x86_64__) #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ #elif defined(__aarch64__) - #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #define CATCH_TRAP() __asm__(".inst 0xd43e0000") #endif #elif defined(CATCH_PLATFORM_IPHONE) @@ -13558,7 +13556,7 @@ namespace Catch { // Handle list request if( Option listed = list( m_config ) ) - return static_cast( *listed ); + return (std::min) (MaxExitCode, static_cast(*listed)); TestGroup tests { m_config }; auto const totals = tests.execute(); @@ -15391,7 +15389,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 2, 13, 9, "", 0 ); + static Version version( 2, 13, 10, "", 0 ); return version; } @@ -17526,12 +17524,20 @@ namespace Catch { #ifndef __OBJC__ +#ifndef CATCH_INTERNAL_CDECL +#ifdef _MSC_VER +#define CATCH_INTERNAL_CDECL __cdecl +#else +#define CATCH_INTERNAL_CDECL +#endif +#endif + #if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) // Standard C/C++ Win32 Unicode wmain entry point -extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +extern "C" int CATCH_INTERNAL_CDECL wmain (int argc, wchar_t * argv[], wchar_t * []) { #else // Standard C/C++ main entry point -int main (int argc, char * argv[]) { +int CATCH_INTERNAL_CDECL main (int argc, char * argv[]) { #endif return Catch::Session().run( argc, argv ); From 20ace5503422a8511036aa9d486435041127e0cf Mon Sep 17 00:00:00 2001 From: alvinhochun Date: Wed, 19 Oct 2022 00:07:18 +0800 Subject: [PATCH 5/8] Allow ANSI colour to be compiled on Windows This enables building with `CATCH_CONFIG_COLOUR_ANSI` on Windows. The changes are taken from v3 commit 0e176c318bf309aaa4acd8686a82517fda7b859a. --- include/internal/catch_console_colour.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp index de0fff43..0d2fde0e 100644 --- a/include/internal/catch_console_colour.cpp +++ b/include/internal/catch_console_colour.cpp @@ -121,7 +121,10 @@ namespace { #elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// -#include +#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC ) +# define CATCH_INTERNAL_HAS_ISATTY +# include +#endif namespace Catch { namespace { @@ -170,7 +173,8 @@ namespace { #if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) !isDebuggerActive() && #endif -#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) +#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \ + !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) ) isatty(STDOUT_FILENO) #else false From c359076e8ad5d8be45a56dee013f414a5485050b Mon Sep 17 00:00:00 2001 From: Martin Sternevald Date: Sat, 10 Dec 2022 12:44:09 +0100 Subject: [PATCH 6/8] Fix missing include causing compiler error catch_registry_hub.cpp:65:17: error: use of undeclared identifier 'CATCH_INTERNAL_ERROR' CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); --- include/internal/catch_registry_hub.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/internal/catch_registry_hub.cpp b/include/internal/catch_registry_hub.cpp index 852b34e0..0b344e2a 100644 --- a/include/internal/catch_registry_hub.cpp +++ b/include/internal/catch_registry_hub.cpp @@ -9,6 +9,7 @@ #include "catch_interfaces_registry_hub.h" #include "catch_context.h" +#include "catch_enforce.h" #include "catch_test_case_registry_impl.h" #include "catch_reporter_registry.h" #include "catch_exception_translator_registry.h" From d4b0b34561a0ffe71216894caa35694e1aabdd5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 13 Jul 2023 14:02:15 +0200 Subject: [PATCH 7/8] Fix lowercase namespace in own-main example Fixes #2715 --- docs/own-main.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/own-main.md b/docs/own-main.md index 06ea243d..14d1be41 100644 --- a/docs/own-main.md +++ b/docs/own-main.md @@ -87,7 +87,7 @@ int main( int argc, char* argv[] ) int height = 0; // Some user variable you want to be able to set // Build a new parser on top of Catch's - using namespace Catch::clara; + using namespace Catch::Clara; auto cli = session.cli() // Get Catch's composite command line parser | Opt( height, "height" ) // bind variable to a new option, with a hint string From a7782d1d7ca84b9cc4c0f3fc4abdec0951d722b2 Mon Sep 17 00:00:00 2001 From: morinmorin Date: Wed, 13 Mar 2024 03:35:34 +0900 Subject: [PATCH 8/8] Add workaround for unguarded use of __has_extension (for v2.x) --- include/internal/catch_platform.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/internal/catch_platform.h b/include/internal/catch_platform.h index 82c5e144..630ea55d 100644 --- a/include/internal/catch_platform.h +++ b/include/internal/catch_platform.h @@ -12,6 +12,9 @@ // See e.g.: // https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html #ifdef __APPLE__ +# ifndef __has_extension +# define __has_extension(x) 0 +# endif # include # if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1)