<feed xmlns='http://www.w3.org/2005/Atom'>
<title>catch3/src/catch2/internal/catch_test_macro_impl.hpp, branch v3.3.0</title>
<subtitle>Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.</subtitle>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/'/>
<entry>
<title>Remove unused StringRef argument from MatchExpr</title>
<updated>2022-11-10T14:25:51+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2022-11-10T11:43:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=6e77e16ea83b928ff7a1e251df2fe8eab38963a9'/>
<id>6e77e16ea83b928ff7a1e251df2fe8eab38963a9</id>
<content type='text'>
Apart from cleaning up the code, this change also improves the
compilation time of `UsageTests/Matchers.tests.cpp` by about 2%.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Apart from cleaning up the code, this change also improves the
compilation time of `UsageTests/Matchers.tests.cpp` by about 2%.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix references to license file</title>
<updated>2022-10-28T09:30:15+00:00</updated>
<author>
<name>Lars Toenning</name>
</author>
<published>2022-10-28T09:22:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=f1084fb30990fe40c8f5b70034970c7eb4e1da72'/>
<id>f1084fb30990fe40c8f5b70034970c7eb4e1da72</id>
<content type='text'>
The license file was renamed with 6a502cc2f5fedd59b3495b58708f0d6d987ed9e1
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The license file was renamed with 6a502cc2f5fedd59b3495b58708f0d6d987ed9e1
</pre>
</div>
</content>
</entry>
<entry>
<title>Suppress -Wuseless-cast Warning</title>
<updated>2022-09-22T19:00:05+00:00</updated>
<author>
<name>Björn Schäpers</name>
</author>
<published>2022-09-14T08:25:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=0de60d8e7ead1ddd5ba8c46b901c122eac20bf94'/>
<id>0de60d8e7ead1ddd5ba8c46b901c122eac20bf94</id>
<content type='text'>
Fixes #2520.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #2520.
</pre>
</div>
</content>
</entry>
<entry>
<title>Leak full Wparentheses suppression for GCC 9</title>
<updated>2022-05-31T21:57:09+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2022-05-31T21:57:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=cca59235023fa30339086be845d9cd7214ecff91'/>
<id>cca59235023fa30339086be845d9cd7214ecff91</id>
<content type='text'>
Reported as an issue on Discord. I thought that by GCC 9, the
C++ frontend was fixed enough to support `_Pragma`-based
suppression correctly, but apparently I was wrong.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reported as an issue on Discord. I thought that by GCC 9, the
C++ frontend was fixed enough to support `_Pragma`-based
suppression correctly, but apparently I was wrong.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add some missing configuration includes</title>
<updated>2022-02-20T18:32:25+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2022-02-19T20:27:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=4396a9119fa32abf966f189c6f6d9c54698d89c8'/>
<id>4396a9119fa32abf966f189c6f6d9c54698d89c8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Disable false positive from clang-tidy</title>
<updated>2021-10-21T20:45:19+00:00</updated>
<author>
<name>Anders Schau Knatten</name>
</author>
<published>2021-09-29T13:34:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=22750cde0e0d2c02ab447e2500422f2711356053'/>
<id>22750cde0e0d2c02ab447e2500422f2711356053</id>
<content type='text'>
Clang-tidy is smart enough to understand that the conditional is never
updated in the loop body. It will let you get away with it if it can
prove that the conditional is always false, but that is not always
possible.

Here is an example where it's not able to prove it, and thus gives a
false positive. This is a minimal reproduction of an actual case I hit
in production, where `function` is picking the function based on some
`constexpr` logic related to which type argument is currently being
tested.

```
int f();

TEMPLATE_TEST_CASE("reproduction", "", int) {
    const auto function = []() {
        return f;
    }();
    const int error = function();
    REQUIRE(error == 0); // clang-tidy complains: bugprone-infinite-loop
}
```

I did not choose to add this test to the test suite, since we're not
running `clang-tidy` in CI afaik. To run it manually, simply add the
snippet above somewhere and run clang-tidy with
`--checks=bugprone-infinite-loop`. Or see an example at
https://godbolt.org/z/4v8b8WexP.

The reason we get the infinite loop warning in the first place is the
conditional at the end of this `do`-loop. Ideally, this conditional
would just be `while(false)`, but the actual content of the
`REQUIRE`-statement has been included here too in order to not loose
warnings from signed/unsigned comparisons. In short, if you do
`REQUIRE(i &lt; j)`, where `i` is a negative signed integer and `j` is an
unsigned integer, you're supposed to get a warning from
`-Wsign-compare`. Due to the decomposition in Catch2, you lose this
warning, which is why the content of the `REQUIRE` statement has been
added to the conditional to force the compiler to evaluate the actual
comparison as well.

This was discussed on Discord today, and an alternative approach (which
I don't have time to implement) would be to in the decomposition replace
the comparison operators with `cmp_less` and friends. These are C++20
though, and would have to be implemented manually. I am also not sure
it's a good idea to "magically" change the semantics of `&lt;` when it's
used inside a `REQUIRE` macro.

Another alternative approach would be to trigger this warning in a
different way, by including the content of the `REQUIRE` macro in a
different way which doesn't affect the for loop. But I don't have enough
of an overview here to know where would be a good place and how to test
that I didn't break anything.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clang-tidy is smart enough to understand that the conditional is never
updated in the loop body. It will let you get away with it if it can
prove that the conditional is always false, but that is not always
possible.

Here is an example where it's not able to prove it, and thus gives a
false positive. This is a minimal reproduction of an actual case I hit
in production, where `function` is picking the function based on some
`constexpr` logic related to which type argument is currently being
tested.

```
int f();

TEMPLATE_TEST_CASE("reproduction", "", int) {
    const auto function = []() {
        return f;
    }();
    const int error = function();
    REQUIRE(error == 0); // clang-tidy complains: bugprone-infinite-loop
}
```

I did not choose to add this test to the test suite, since we're not
running `clang-tidy` in CI afaik. To run it manually, simply add the
snippet above somewhere and run clang-tidy with
`--checks=bugprone-infinite-loop`. Or see an example at
https://godbolt.org/z/4v8b8WexP.

The reason we get the infinite loop warning in the first place is the
conditional at the end of this `do`-loop. Ideally, this conditional
would just be `while(false)`, but the actual content of the
`REQUIRE`-statement has been included here too in order to not loose
warnings from signed/unsigned comparisons. In short, if you do
`REQUIRE(i &lt; j)`, where `i` is a negative signed integer and `j` is an
unsigned integer, you're supposed to get a warning from
`-Wsign-compare`. Due to the decomposition in Catch2, you lose this
warning, which is why the content of the `REQUIRE` statement has been
added to the conditional to force the compiler to evaluate the actual
comparison as well.

This was discussed on Discord today, and an alternative approach (which
I don't have time to implement) would be to in the decomposition replace
the comparison operators with `cmp_less` and friends. These are C++20
though, and would have to be implemented manually. I am also not sure
it's a good idea to "magically" change the semantics of `&lt;` when it's
used inside a `REQUIRE` macro.

Another alternative approach would be to trigger this warning in a
different way, by including the content of the `REQUIRE` macro in a
different way which doesn't affect the for loop. But I don't have enough
of an overview here to know where would be a good place and how to test
that I didn't break anything.
</pre>
</div>
</content>
</entry>
<entry>
<title>Bring back useful comment</title>
<updated>2021-09-29T16:19:31+00:00</updated>
<author>
<name>Anders Schau Knatten</name>
</author>
<published>2021-09-29T11:54:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=eb452e9b356de09bdb96273c035c40a8f4cb2ad3'/>
<id>eb452e9b356de09bdb96273c035c40a8f4cb2ad3</id>
<content type='text'>
In b7b346c3e56030 this conditional was simplified to just
`while( false)` rather than the current one. Then in 3a33315ff8e04, that
change was reverted. I found it hard to understand this
complicated conditional, but after some digging in history I found this
comment which used to be here. It was removed in b7b346c3e56030, but not
restored together with the revert in 3a33315ff8e04. Let's revive it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In b7b346c3e56030 this conditional was simplified to just
`while( false)` rather than the current one. Then in 3a33315ff8e04, that
change was reverted. I found it hard to understand this
complicated conditional, but after some digging in history I found this
comment which used to be here. It was removed in b7b346c3e56030, but not
restored together with the revert in 3a33315ff8e04. Let's revive it.
</pre>
</div>
</content>
</entry>
<entry>
<title>Split out INTERNAL_CATCH_UNIQUE_NAME into its own header</title>
<updated>2021-02-24T22:14:18+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2021-02-24T22:13:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=551946c45bb27b78c85971d32e2a8bccbfa0d3f8'/>
<id>551946c45bb27b78c85971d32e2a8bccbfa0d3f8</id>
<content type='text'>
Also small cleanup of includes of related headers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also small cleanup of includes of related headers.
</pre>
</div>
</content>
</entry>
<entry>
<title>Silence -Wuseless-cast warning with GCC10</title>
<updated>2020-11-02T15:01:17+00:00</updated>
<author>
<name>Morwenn</name>
</author>
<published>2020-10-29T14:04:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=dd5652933ae181226eac0177e1b6ab0d988bdec6'/>
<id>dd5652933ae181226eac0177e1b6ab0d988bdec6</id>
<content type='text'>
With GCC 10, the `static_cast&lt;bool&gt;` triggers the -Wuseless-cast warning. This commit changes the cast into `static_cast&lt;const bool&amp;&gt;`: it achieves the same thing but doesn't trigger the warning thanks to the "gratuitous" type conversion to `const bool&amp;`. As per references rules, `const bool&amp;` should bind to anything, be it `const` or not, an rvalue or an lvalue, so I doubt that this change is breaking anything.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With GCC 10, the `static_cast&lt;bool&gt;` triggers the -Wuseless-cast warning. This commit changes the cast into `static_cast&lt;const bool&amp;&gt;`: it achieves the same thing but doesn't trigger the warning thanks to the "gratuitous" type conversion to `const bool&amp;`. As per references rules, `const bool&amp;` should bind to anything, be it `const` or not, an rvalue or an lvalue, so I doubt that this change is breaking anything.</pre>
</div>
</content>
</entry>
<entry>
<title>Add standardized copyright notice + SPDX identifier to source files</title>
<updated>2020-08-30T13:43:45+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2020-08-30T13:43:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=90aeffb97d6942d16f75a56b11e10fc0b010995a'/>
<id>90aeffb97d6942d16f75a56b11e10fc0b010995a</id>
<content type='text'>
This should also be done for test files, but that has lower priority.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This should also be done for test files, but that has lower priority.
</pre>
</div>
</content>
</entry>
</feed>
