Using the latest Catch master (and clang-tidy bundled with CLion EAP 2017.2), a simplest example yield clang-tidy warning:
TEST_CASE("whatever") {
REQUIRE(1 + 2 == 3);
}
clang-tidy lint:
Initialization of 'autoRegistrar1' with static storage duration may throw an exception that cannot be caught.
This can happen because TEST_CASE's tags are checked for validity and if not, exception is thrown. This is not particularly great when the error happens in statically registered test cases (ie standard usage), but the alternative is to just exit, which is quite a lot worse for users that supply their own main and register test cases dynamically.
There is no proper way to fix it in C++98, but since the next major version drops C++98 support, it is fixed* in the dev-modernize branch.
I've added some judicious /* NOLINT */s to the appropriate places in the source (for this and another one about use of inline assembler on every assertion!). That seems to fix it all.
That's not in the single include yet but I think we'll do a release quite soon to get this fix out.
@philsquared Thanks! Hopefully those pesky warnings in CLion will go away.
Most helpful comment
I've added some judicious
/* NOLINT */s to the appropriate places in the source (for this and another one about use of inline assembler on every assertion!). That seems to fix it all.That's not in the single include yet but I think we'll do a release quite soon to get this fix out.