Commit Graph

33 Commits

Author SHA1 Message Date
Martin Hořeňovský 849f2848bd
Rework how warning suppression in macros is done
Previously, each warning suppression was self-contained, with its
own pair of `SUPPRESS_X_WARNING` and `UNSUPPRESS_X_WARNING` macros.
This had the obvious advantage of being self-containing, but it
also meant that if we needed to suppress more than one warning
in a single place, then we would manipulate the compiler's warning
state multiple times, even though logically we would only need one
layer.

The new way of suppressing warnings in macros is to push compiler's
warning state with `CATCH_INTERNAL_START_WARNINGS_SUPPRESSION` macro,
then disable whatever macros we need with the
`CATCH_INTERNAL_SUPPRESS_X_WARNINGS` macro, and then return to the
previous state using `CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION`.
2019-10-27 21:07:21 +01:00
Martin Hořeňovský 7d0b205564
Prevent warning suppression from leaking when registering a listener 2019-10-22 00:10:01 +02:00
Axel Huebl 5347ff9e5f
Refactor: override implies virtual
If not used with `final`, override implies `virtual`.
Detected via CodeFactor score.

Another reference on SO:
  https://stackoverflow.com/questions/43466863/isnt-virtual-keyword-redundant-when-override-or-final-specifiers-are-used
2018-07-12 14:27:06 +02:00
Phil Nash 3035120dc7 Some bits of tidy up 2017-12-07 00:02:32 +00:00
Martin Hořeňovský 9aa96712ae Sweep out some extra warnings
Swept:
`-Wpadded` in some places (where it caused extra size, instead of just
saying "hey, we padded struct at the end to align, just as standard says")
`-Wweak-vtables` everywhere (Clang)
`-Wexit-time-destructors` everywhere (Clang)
`-Wmissing-noreturn` everywhere (Clang)

The last three are enabled for Clang compilation going forward.

Also enabled `-Wunreachable-code` for Clang and GCC
2017-09-07 17:25:15 +02:00
Martin Hořeňovský 05b6f03f3e Disable reporter/listener registration with CATCH_CONFIG_DISABLE 2017-08-29 09:48:52 +02:00
Martin Hořeňovský 24af32f378 Add define that pulls in reporter and listeners interfaces
This allows users to define reporters and listeners in files different
from the main file.

Related to #991, #986
2017-08-17 20:23:30 +02:00
Martin Hořeňovský f99f511155 Removed *_REGISTER_REPORTER from main path
Also simplified them to single macro: CATCH_REGISTER_REPORTER
2017-08-17 20:03:16 +02:00
Martin Hořeňovský 9a18ba042f Remove deprecated listener registration macro 2017-08-17 20:03:16 +02:00
Martin Hořeňovský 1e59ccee41 Addressed Resharper-C++ warnings
See #958
2017-07-25 17:16:28 +02:00
Phil Nash 687437fcd1 converted IStreamingReporter to unique_ptr 2017-05-05 15:43:31 +01:00
Phil Nash 0844d6e867 Migrated IStreamingReporter from Ptr to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash dd78824697 Migrated IReporterFactory to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash 602b62f037 Removed legacy reporter support 2017-04-25 21:56:14 +01:00
Phil Nash e4a25ad5ff Added CATCH_REGISTER_LISTENER without the INTERNAL_ prefix 2017-03-10 19:15:03 +00:00
Martin Hořeňovský 3b98a0166f Various small string usage performance improvements.
* Empty strings are now direct constructed as `std::string()`, not as empty string literals.
* `startsWith` and `endsWith` no longer construct new a string. This should be an improvement
for libstdc++ when using older standards, as it doesn't use SSO but COW and thus even short
strings are expensive to first create.
* Various places now use char literal instead of string literals containing single char.
** `startsWith` and `endsWith` now also have overload that takes single char.

Generally the performance improvements under VS2015 are small, as going from short string
to char is mostly meaningless because of SSO (Catch doesn't push string handling that hard)
and previous commit removed most string handling if tests pass, which is the expect case.
2017-01-15 10:05:01 +01:00
Phil Nash e91738103c Stripped trailing whitespace from all source code lines
(replaces need for PRs #310 and #504)
2015-11-04 18:04:15 +00:00
Phil Nash 368714e7aa Added Listeners (programatically provided extra reporters) 2015-08-07 08:20:56 +01:00
Phil Nash 358b7b29e1 Eliminate a warning in the latest clang with Xcode 2013-09-24 07:41:18 +01:00
Phil Nash 3faa412855 Removed basic reporter 2013-08-15 19:09:07 +01:00
Phil Nash f3d1f08c3b Removed all trailing whitespace
- addresses #105
2013-07-03 19:14:59 +01:00
Phil Nash e1459955f1 Refactoring towards interface based config 2013-05-28 18:39:32 +01:00
Phil Nash 2a9d8d9e36 Changed "const X ref"s to "X const ref"s
- Brought older code up to current convention (with the help of a Python script)
2013-04-23 18:58:56 +01:00
Phil Nash 7af7451f78 LegacyReporterAdapter unbundles INFO messages from assertion to mimic legacy behaviour
- Moved LegacyReporterAdapter out into its own file(s)
2013-04-08 11:44:03 +01:00
Phil Nash 8255acf88f IStreamingReporter is now the default. Use REGISTER_LEGACY_REPORTER to register… you guessed it: legacy reporters
The built-in reporters are still legacy at the moment.
2012-11-30 19:29:03 +00:00
Phil Nash 4e12e12c1f Streaming reporter interface is now used natively.
Legacy reporters are adapted by their factories.
2012-11-30 19:15:23 +00:00
Phil Nash da0ae952fc Renamed static registries -> registry hub 2012-08-07 07:58:34 +01:00
Phil Nash 1091ca81e6 First cut of StaticRegistries - separate from Context 2012-08-06 20:16:53 +01:00
Phil Nash d2553cdc64 Made ReportConfig a value type 2012-07-20 19:07:42 +01:00
Phil Nash 371db8b42f Context methods are non-static - accessed via interface
This is a move towards allowing multiple contexts - with the concept of a (possibly thread local) "current" context
2012-05-21 18:52:09 +01:00
Phil Nash 6cd2ac7544 More reformatting 2012-05-16 08:02:20 +01:00
Phil Nash 5ec53b2788 renamed hub -> context
(also did some reformatting)
2012-05-10 07:58:48 +01:00
Phil Nash 823ea3efd4 Re-org 2011-04-26 08:32:40 +01:00