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

Fix clang tidy warnings #23

Merged
merged 27 commits into from
Jul 31, 2024
Merged

Fix clang tidy warnings #23

merged 27 commits into from
Jul 31, 2024

Conversation

MiKom
Copy link
Member

@MiKom MiKom commented Jul 18, 2024

This is a giant PR but it's comprised of (mostly) small atomic commits. So best reviewed commit by commit.

Not everything is fixed yet. Few more complicated ones are left out. Also, fixing warnings in tests will be done separately.

@MiKom MiKom requested review from mkrus, lemirep and seanharmer July 18, 2024 08:06
@MiKom MiKom force-pushed the fix-clang-tidy-warnings branch 4 times, most recently from 7ea61e0 to aec72eb Compare July 23, 2024 15:28
MiKom added 23 commits July 23, 2024 17:36
So it shows up in VSCode.
It warned about unused variable as the SPDLOG_LOGGER_DEBUG is compiled
out in release builds.
std::ignore used in cases where we don't need to store the connection.
I think it's more descriptive than (void).

Technically, using std::ignore is UB until Peppe's P2968 is ratified in
C++26 but every implementation we target does the right thing so I don't
care. Sue me.
LinuxWaylandPlatformWindow::scaleByFactor converted to template so it
can work both for signed and unsigned types without warning.
Setting SYSTEM on FetchContent_Declare for fmt is not good as it
requires CMake 3.25 (we want to support older ones) and doesn't work as
clang-tidy is still invoked.
For better readability, in xcb-facing code I retained C arrays.

While we're at it, replaced one KD_UNUSED with
std::ignore.
Some got NOLINT treatment because they are used as wayland callbacks and
it's easier to have them this way.
This fixes some issues with exceptions in constructors.
@MiKom MiKom force-pushed the fix-clang-tidy-warnings branch from aec72eb to 7bacedc Compare July 23, 2024 15:37
Copy link
Member

@mkrus mkrus left a comment

Choose a reason for hiding this comment

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

wonder if exception handling should be a configuration option?

@MiKom MiKom force-pushed the fix-clang-tidy-warnings branch from 1e0c1c8 to cd9cdbb Compare July 24, 2024 12:27
@MiKom MiKom requested a review from mkrus July 24, 2024 14:03
@MiKom
Copy link
Member Author

MiKom commented Jul 24, 2024

wonder if exception handling should be a configuration option?

We throw exceptions in multiple places, particularly in initializing Wayland and XCB. Plus, KDBindings may throw as well and doesn't have any support for turning exceptions on and off. I suggest we create an issue for it and start working on it once the concrete need arises. What do you think @mkrus ?

Copy link
Member

@mkrus mkrus left a comment

Choose a reason for hiding this comment

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

don't mind either way regarding KD_UNUSED vs commented out names, just saw KD_UNUSED used (sic) in some places

@MiKom MiKom merged commit 6480c99 into KDAB:main Jul 31, 2024
21 checks passed
@MiKom MiKom deleted the fix-clang-tidy-warnings branch July 31, 2024 09:37
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