Skip to content

Conversation

@firewave
Copy link
Collaborator

clang-tidy will also report compiler warnings which we were currently suppressing since we treat all warnings as errors.

We should make sure our code is free of warnings. So we should fail the build in the CI (not by default) if one is encountered.

Leveraging the existing clang-tidy step saves us an additional explicit step in the CI for a clang build.

@firewave firewave changed the title also fail clang-tidy in case of a compiler warning / fixed Clang warnings also fail clang-tidy in case of a compiler warning / fixed Clang warnings / cleanups Apr 21, 2022
{
std::set<std::string> found;
// NOLINTNEXTLINE(performance-unnecessary-copy-initialization)
const std::list<std::string> copyIn(in);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danmar Why do you need to copy this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to allow that includePaths is passed as in parameter

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait...what? That took me quite a while to understand... We should not do that but let's tackle that at a later date.

@firewave firewave changed the title also fail clang-tidy in case of a compiler warning / fixed Clang warnings / cleanups fail run-clang-tidy in case of compiler warnings / fixed Clang warnings / cleanups Apr 21, 2022
if (RUN_CLANG_TIDY)
# disable all compiler warnings since we are just interested in the tidy ones
add_custom_target(run-clang-tidy ${RUN_CLANG_TIDY} -checks=-performance-unnecessary-copy-initialization -p=${CMAKE_BINARY_DIR} -j ${NPROC} -extra-arg=-w -quiet)
add_custom_target(run-clang-tidy ${RUN_CLANG_TIDY} -p=${CMAKE_BINARY_DIR} -j ${NPROC} -extra-arg=-w -quiet)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danmar This would have affect all source files.
Interestingly this is also something we check for so the self-check should have detected this as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also possible the -checks option might override the existing .clang-tidy configuration - which would be a bad thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also possible the -checks option might override the existing .clang-tidy configuration - which would be a bad thing.

Actually it is appended:

--checks=<string>              -
[...]
                                   This option's value is appended to the
                                   value of the 'Checks' option in .clang-tidy
                                   file, if any.

@firewave firewave force-pushed the tidy-warn branch 4 times, most recently from f546e8a to 345e5b5 Compare April 21, 2022 17:01
@firewave
Copy link
Collaborator Author

I created llvm/llvm-project#55018 for the -Wmissing-prototypes warning in the fuzzer.

@firewave firewave marked this pull request as draft April 21, 2022 17:03
@firewave firewave marked this pull request as ready for review April 21, 2022 17:13
@firewave firewave marked this pull request as draft April 22, 2022 08:16
@firewave
Copy link
Collaborator Author

This is ready for review.

@firewave firewave marked this pull request as ready for review April 29, 2022 20:33
Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are changed ts files. please revert those changes.

@firewave
Copy link
Collaborator Author

there are changed ts files. please revert those changes.

Those are changed since I changed GUI source files.

@danmar
Copy link
Owner

danmar commented Apr 30, 2022

I do not feel I can review this PR properly since there are so many changed ts files. please revert. I suggest separate update of ts files. I think the CI needs to be less strict if it cant handle this.

@firewave
Copy link
Collaborator Author

I do not feel I can review this PR properly since there are so many changed ts files. please revert.

Please review by looking at the separate commits instead of the changed files. It's all very small changes which are very easy to review. The translation changes are always a separate commit to make it easier to review (even though they should be combined with the actual source changes but since we squash anyways there's no point in that).

I suggest separate update of ts files. I think the CI needs to be less strict if it cant handle this.

There's an option to remove the line numbers but we need to test what the effects of this is since it is not clearly documented (apparently it is necessary if you use the QtLinguist UI for exiting them). I would prefer to do this at the beginning of a release.

@danmar
Copy link
Owner

danmar commented Apr 30, 2022

It seems better that we leave the ts files unchanged for some periods. no need to update them in every PR.
I used to update the ts files during each release I think that is better.

@firewave
Copy link
Collaborator Author

firewave commented Apr 30, 2022

It seems better that we leave the ts files unchanged for some periods. no need to update them in every PR.
I used to update the ts files during each release I think that is better.

Okay - so I will no longer commit them in my upcoming changes.

The problem of them being outdated is only felt in the non-CMake builds (i.e. qmake) since those are not updating them implicitly like out CMake build does.

The changes to them in this PR are much smaller than many of the recent one so I think it should be fine to still change them this once since the CI is already green.

firewave referenced this pull request May 6, 2022
* Fix #11041 FN constVariable with array of pointers [regression]

* Use std::vector for deterministic order of results, use helper variables
@danmar
Copy link
Owner

danmar commented May 8, 2022

The changes to them in this PR are much smaller than many of the recent one so I think it should be fine to still change them this once since the CI is already green.

I don't understand why you don't revert the changes now. There is a release quite soon and they will be updated then.

@firewave
Copy link
Collaborator Author

firewave commented May 8, 2022

I don't understand why you don't revert the changes now. There is a release quite soon and they will be updated then.

I dropped it.

@firewave
Copy link
Collaborator Author

firewave commented May 9, 2022

This is fine now and ready to be reviewed again.

@danmar danmar merged commit 14421ae into danmar:main May 15, 2022
@firewave firewave deleted the tidy-warn branch May 15, 2022 12:04
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

Successfully merging this pull request may close these issues.

2 participants