You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compile the unit tests for the Trompeloeil mock object library.
Expected result: The unit tests compile without warnings or errors.
Actual result: The compilation completes with this warning message,
test/compiling_tests_11.cpp:245:24:
warning: empty expression statement has no effect;
remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
INFO("msg=" << msg);
^
63 warnings of this kind total.
Other combinations of C++ Standard Library implementation
also generate the warning. So too does previous versions of Catch
e.g. version 2.2.3.
Steps to reproduce
Minimal program to reproduce issue:
#include<catch.hpp>TEST_CASE("Foo")
{
INFO("Test case start");
}
Compile with Clang latest (i.e. with at least commit 0d4609da69d513b7737d2f932e3db6e57f7b11c3).
The issue is with Catch2: WARN and CAPTURE macros expect a semicolon
to terminate them (see INTERNAL_CATCH_MSG, INTERNAL_CATCH_CAPTURE). INFO forwards to INTERNAL_CATCH_INFO which has a trailing semicolon.
The examples in the Catch documentation are also inconsistent, with semicolon
terminating INFO in some examples and no semicolon terminating INFO in
other examples.
Suggested fix
Remove the trailing semicolon from INTERNAL_CATCH_INFO.
Update the documentation to consistently have a semicolon
at the end of each use of the INFO macro.
Advise Catch users that their code may no longer compile if they
leave the trailing semicolon off their INFO macros.
The text was updated successfully, but these errors were encountered:
Description
Compile the unit tests for the Trompeloeil mock object library.
Expected result: The unit tests compile without warnings or errors.
Actual result: The compilation completes with this warning message,
63 warnings of this kind total.
Other combinations of C++ Standard Library implementation
also generate the warning. So too does previous versions of Catch
e.g. version 2.2.3.
Steps to reproduce
Minimal program to reproduce issue:
Compile with Clang latest (i.e. with at least commit
0d4609da69d513b7737d2f932e3db6e57f7b11c3
).Command line contains either
or
Godbolt: https://godbolt.org/z/Y9wR08
Extra information
Operating system: Ubuntu 18.10 (Cosmic Cuttlefish)
Compiler:
clang++-latest
(compiled from trunk)Standard C++ Library:
libstdc++-v3
(e.g. from G++ 8.2.0)Catch version: v2.4.2 (other versions also exhibit issue)
See also: rollbear/trompeloeil#107.
Supposed cause
Clang latest began generating this warning with this commit
The issue is with Catch2:
WARN
andCAPTURE
macros expect a semicolonto terminate them (see
INTERNAL_CATCH_MSG
,INTERNAL_CATCH_CAPTURE
).INFO
forwards toINTERNAL_CATCH_INFO
which has a trailing semicolon.The examples in the Catch documentation are also inconsistent, with semicolon
terminating
INFO
in some examples and no semicolon terminatingINFO
inother examples.
Suggested fix
Remove the trailing semicolon from
INTERNAL_CATCH_INFO
.Update the documentation to consistently have a semicolon
at the end of each use of the
INFO
macro.Advise Catch users that their code may no longer compile if they
leave the trailing semicolon off their
INFO
macros.The text was updated successfully, but these errors were encountered: