Commit Graph

3294 Commits

Author SHA1 Message Date
Amin Yahyaabadi bac7d6bd4e
fix: use standard main function on MinGW
Fixes #2437
2022-06-01 16:58:45 -07:00
Martin Hořeňovský e33de8fc05
Update FetchContent docs to use 2.13.9 2022-05-31 12:31:02 +02:00
Martin Hořeňovský 1127d847a1
Use better instruction for CATCH_TRAP on ARM Macs
The old instruction would cause the debugger to be stuck at the
triggering source line forever, while the new one should have the
expected semantics, where the debugger can then single-step,
continue. or generally do things, afterwards.

Closes #2422
2022-05-15 23:20:32 +02:00
Marc Mutz ca455815fd ObjectStorage: port away from std::aligned_storage
It's deprecated in C++23. Just use alignas on a char array, wrapped in
a struct to avoid decaying to char*, which is the canonical
implementation of aligned_storage:
https://en.cppreference.com/w/cpp/types/aligned_storage#Possible_implementation

Fixes #2419

Catch3 is not affected.
2022-05-10 00:06:45 +02:00
Martin Hořeňovský d71b4617e9
Disable Werror for unknown pragmas in tests
Closes #2375
2022-04-17 21:12:38 +02:00
Martin Hořeňovský 62fd660583
v2.13.9 2022-04-12 22:38:17 +02:00
Martin Mekota 0aa4dbae2e Fix filename as tag bug
When a test file isn't provided with "/" in the path,
the filename isn't registered as a tag.
Fixing by providing a conditon for this edge case.

Closes #2328
2022-03-18 22:32:54 +01:00
John Beard ff151d2833
Fix: CAPTURE not variadic when disabled (#2378)
Closes: #2316
2022-03-04 15:29:22 +01:00
Mikhail Matrosov 958944d27a
Allow to specify CATCH_CONFIG_DEFAULT_REPORTER for static library with main() (#2346) 2022-01-25 21:54:19 +01:00
Martin Hořeňovský 216713a406
v2.13.8 2022-01-03 21:21:39 +01:00
Bernhard Manfred Gruber e9e4117016 Remove double-underscores in macros
Such identifiers are reserved by the C++ standard.
Fixes part of #578.
2021-12-16 14:34:04 +01:00
Dan Raviv 8a06a6dce8 Fix typo 2021-12-10 16:01:55 +01:00
Xo Wang 33794a204c Fix clang analyzer warning about FilterGenerator
Refactor FilterGenerator to remove ctor call to overridden method next()
in order to address clang static analyzer diagnostic:

catch2-src/single_include/catch2/catch.hpp:4166:42: note: Call to virtual method 'FilterGenerator::next' during construction bypasses virtual dispatch
                auto has_initial_value = next();
                                         ^~~~~~
2021-11-24 11:30:03 +01:00
Martin Hořeňovský f45dac8fc1 Add broken test 2021-11-24 11:30:03 +01:00
Martin Hořeňovský f2f0dcc511
Add VS2015 + char literals in GENERATE issue to known-limitations
Closes #2207
2021-11-15 23:27:17 +01:00
Alecto Irene Perez dba29b60d6
Fixed #2272: Compilation failure with C++20 (#2297)
* Suppressed warning for comma-in-indexing-operator in tests that check
  that specific behaviour.
* Made deprecated (and removed) allocator usings conditional on the tests
  being compiled with old version of MSVC that still requires them.

Fixes #2272
2021-10-04 21:11:03 +02:00
Rupert Nash 3d01f3ae32 Backport changes from 7bea1e2ac36ac54b648ae5c9d381a59bc69db912 to fix #2273 for 2.x 2021-09-18 21:24:03 +02:00
Biswapriyo Nath 85c9544fa4 pkgconfig: Add missing entries
This adds prefix, exec_prefix and libdir fields
2021-09-10 20:08:03 +02:00
Jørgen P. Tjernø 4b9780201b Fix warning suppressions leaking under clang.exe
When running clang.exe under Windows, catch.hpp leaks warning
suppressions because it uses `#pragma warning(push)` & `#pragma
warning(pop)` around warning suppressions like `#pragma clang diagnostic
ignore "-Wunused-variable"`, instead of using `#pragma clang diagnostic
push` and `#pragma clang diagnostic pop`.

This fixes that by only defining
`CATCH_INTERNAL_START_WARNINGS_SUPPRESSION` and
`CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION` to be the cl.exe variants if
`defined(_MSC_VER) && !defined(__clang__)`.
2021-08-30 23:26:51 +02:00
Martin Hořeňovský c4e3767e26
v2.13.7 2021-07-28 20:30:51 +02:00
Martin Hořeňovský eea3e9a5b5
Mark !mayfail tests as skipped in the JUnit reporter
Should fix #2116
2021-07-27 23:16:01 +02:00
Martin Hořeňovský 7727c15290
Remove Conan builds from travis-CI 2021-06-07 20:02:30 +02:00
Dimitrij Mijoski 531a149ae7 Fix compiling v2.x with C++17 + Clang 5 + libstdc++ v5
This basically tests the combination where the compiler supports most
of C++17 but the library does not.
2021-05-25 23:50:45 +02:00
Martin Hořeňovský 9683570be7
Tiny optimization in JUnit reporter 2021-05-23 11:31:33 +02:00
Martin Hořeňovský 581c46249a
JUnit reporter uses only 3 decimal places when reporting durations
We used to use whatever precision we ended up having from C++'s
stdlib. However, some relatively popular tools, like Jenkins,
use Maven SureFire XML schema to validate JUnit test reports, and
Maven SureFire schema requires the duration to have at most 3
decimal places.

For compatibility, the JUnit reporter will now respect this
limitation.

Closes #2221
2021-05-22 23:45:43 +02:00
Evgeny Proydakov b15b862d86 Fixed noexcept benchmark build for gcc. 2021-05-21 20:49:16 +02:00
Martin Hořeňovský 6971476563
Ensure that <iterator> is included before back_inserter is used
Closes #2231
2021-05-21 20:20:00 +02:00
Martin Hořeňovský 5c88067bd3
v2.13.6 2021-04-16 20:14:58 +02:00
Georg Schwab 86a4d704bc fixed inconsistent semicolon expansion in catch_discover_tests (Bug #2214) 2021-04-16 17:26:08 +02:00
Matteo Beniamino 469a717395 Fixed [dis]engage_platform declarations mismatch 2021-04-13 19:50:32 +02:00
Martin Hořeňovský 42e368dd0a
v2.13.5 2021-04-10 23:48:32 +02:00
Clare Macrae 1ff1f2741d Prevent Catch2 v2 tests running if loaded as a sub-project
See #2202
2021-04-09 23:54:13 +02:00
Julien Brianceau 269f96e2bc Fix typos in the code base
Note that only documentation and comments are impacted by this change.
2021-04-08 18:06:36 +02:00
Martin Hořeňovský cec35630fb
Don't build Catch2WithMain target by default for v2
The `Catch2WithMain` target was added experimentally for v2.13.4
to provide potentially better compilation (and link) times to users.
However, having it compiled by default causes worse experience for
people who do not use it, and for the v2 versions the single include
distribution is still the main one.

Closes #2142
2021-04-05 18:04:31 +02:00
Martin Hořeňovský b8b03da534
Mangle doccoments to avoid breaking single include stitching 2021-04-04 18:09:29 +02:00
Martin Hořeňovský 8f277a54c0
Significantly refactor fatal error handling
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
2021-04-04 18:09:26 +02:00
Pavel Kamenov 4cb3220a8a Add lcc to the list of unwanted compilers that mimic gcc 2021-04-04 14:05:39 +02:00
Scott Hutchinson b025a007b9 Wrap all std::min and std::max calls in parentheses 2021-02-20 23:28:20 +01:00
Rob Boehne 68975e3ff3
[Issue 2154] Correct error when building with IBM's latest XLC (#2155)
* [Issue 2154] Correct error when building with IBM's latest XLC compiler with xlclang++ front-end.

On AIX, the XLC 16.1.0.1 compiler considers the call to `std::abs` ambigious, so it needs help with a static_cast to the type of the template argument.

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2021-01-21 22:50:49 +01:00
Martin Hořeňovský bcb9ea8cb5
Merge pull request #2157 from tdegeus/patch
Making target detection on Mac more robust
2021-01-21 15:35:23 +01:00
Tom de Geus d4c9494eb5
Making target detection on Mac more robust 2021-01-20 21:12:18 +01:00
Mathieu Mirmont bed285af07 Make the build reproducible with g++-8 and clang-10
Make the build reproducible by removing references to the source
directory from the Catch2WithMain static library.
2021-01-13 18:09:24 +01:00
Martin Hořeňovský de6fe184a9
v2.13.4 2020-12-29 15:03:40 +01:00
Martin Hořeňovský fe3dddcc6d
Fix updateVersionPlaceholder when the placeholder starts the line 2020-12-29 15:02:25 +01:00
Reinhold Gschweicher 18ab353e55 Add deprecation warning in ParseAndCatchTests
Parsing C++ with regex in CMake is error prone and regularly leads to silently
dropped (not run) test cases.

Going forward the function `catch_discover_tests` from `contrib/CMake.cmake`
should be used.

For more information see https://github.com/catchorg/Catch2/issues/2092#issuecomment-747342765
2020-12-21 13:15:36 +01:00
Reinhold Gschweicher 2375a7f5b7 Fix Catch.cmake helper by setting variable globally
Set `_CATCH_DISCOVER_TESTS_SCRIPT` helper variable globally. Otherwise in a
scoped call (like `add_subdirectory()`) the variable gets lost. This lost
variable results in a post build error with not much information to lead to the
root of the problem.

This enables the usage of the helper script with the following example structure

- CMakeLists.txt (project root with `add_subdirectory(external/catch2)`
- external/catch2
  - CMakeLists.txt (contents listed below)
  - contrib/Catch.cmake
  - contrib/CatchAddTests.cmake
  - catch2/catch.hpp
- tests
  - CMakeLists.txt (add tests with `catch_discover_tests(${PROJECT_NAME})`)

contents of project specific helper `external/catch2/CMakeLists.txt`
```cmake
cmake_minimum_required (VERSION 3.1...${CMAKE_VERSION})
project(Catch2 LANGUAGES CXX VERSION 2.13.3)
add_library(Catch2 INTERFACE)
target_include_directories(Catch2
  INTERFACE
    $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
)
 # provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
add_library(Catch2::Catch2 ALIAS Catch2)
include(contrib/Catch.cmake)
```
2020-12-17 18:50:04 +01:00
Martin Hořeňovský fac517d571
Fix conan package build 2020-11-26 15:05:58 +01:00
Florian Berchtold 578f8b8006
Add bazel support 2020-11-18 21:37:12 +01:00
Deniz Evrenci 92f8b01dfa
Add the static library Catch2WithMain
It should provide a shared impl for all targets that need to link
against Catch2's implementation. However, due to limitations of
C++ linking and Catch2's v2 implementation, this is only experimental
and might not work under some circumstances.
2020-11-18 21:37:10 +01:00
Martin Hořeňovský dc7e705672
Small cleanups for the reworked test case order hashing 2020-11-17 21:08:33 +01:00