Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-latest now generates -Wextra-semi-stmt in unit tests #107

Closed
AndrewPaxie opened this issue Nov 21, 2018 · 3 comments
Closed

clang-latest now generates -Wextra-semi-stmt in unit tests #107

AndrewPaxie opened this issue Nov 21, 2018 · 3 comments

Comments

@AndrewPaxie
Copy link
Collaborator

Daily compile of Trompeloeil unit tests with clang-latest shows this warning generated:

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 total.

Using Catch version 2.2.3.
Same errors occur with Catch 2.4.2, released 26 October 2018.

Warning was 'refined' in this Clang/LLVM commit

commit 0d4609da69d513b7737d2f932e3db6e57f7b11c3
Author: Roman Lebedev <lebedev.ri@gmail.com>
Date:   Tue Nov 20 18:59:05 2018 +0000

:::

    Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=39111 | PR39111 ]]
    
:::

What to do

Some options:

  • Remove the semicolon in Trompeloeil test cases.
  • Raise an issue with Catch team asking for a fancier INFO macro.
  • Disable the warning in the build.
@AndrewPaxie
Copy link
Collaborator Author

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. All examples require a semicolon.

Will raise an issue with the Catch project, if one doesn't already exist.

@AndrewPaxie
Copy link
Collaborator Author

AndrewPaxie commented Nov 25, 2018

Raised issue in Catch project: catchorg/Catch2#1456.

@rollbear
Copy link
Owner

Added -Wno-extra-semi-stmt to self_test target, for clang compilers that supports it, so that we can build clean with clang-8. It's a pity, but not a big issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants