-
-
Notifications
You must be signed in to change notification settings - Fork 5
Add CMake presets with strict compiler warnings #4
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is good style to provide CMake presets with a CMake project. We replace the KDECompilerSettings with these presets. The removal of the exception flag means that consumers are more free in selecting the right behavior for them. At the moment exceptions are required though. The CI is adapted in that we need to set a preset for having sensible warnings being set. As we now enable more warnings than KDECompilerSettings did, this means the CI pipeline will produce also more warnings.
The arguments are not needed anymore since we set everything through the presets now.
The include comes with a lot of instructions. We don't need most of them, so just do the little we rely on ourselves in a separate include.
Test building with gcc too.
Otherwise the composited string might be optimized away on release builds what leads to a crash on nullptr.
Silences a deprecation warning.
Silences a deprecation warning.
Silences a deprecation warning.
Silences a deprecation warning.
Silences a deprecation warning.
In two particular cases it is necessary when including C files. In the test we don't require the keyword redefine actually.
Silences a warning.
Silences a warning.
This is undefined behavior. Silences a warning.
Silences a warning on the deprecated take function.
With wlroots and libwayland we have too many C casts like this. For now disable the cast-align warning again. Should we instead wrap the calls and disable the warnings with pragma more targeted?
The function with QWindow argument has been deprecated. Use the new one instead, that just omits the argument.
To improve robustness now compile with clang with warnings as errors. We only make two exceptions: - Wdeprecated-declarations because this can change often depending on upstream and using deprecated functionality is non-criticial - Wunused-lambda-capture because there seems to be a bug in clang producing many false-positives in our code [1] [1] llvm/llvm-project#81243
This can be used to simply build the libraries without any tests and warnings. We build in the CI this preset as well and use it for our weekly rebuilds. The preset actually sets the build type to "RelWithDebInfo" to produce better backtraces.
For increased robustness ensure that the gcc preset compiles with warnings as errors. We make the following exceptions: - Wcast-align is not warned, because it produces a lot of noise on structs we only want to partly initialize. - Wunknown-pragmas is not warned as error, because it will false-positive on clang pragmas. - Wdeprecated-declarations is not warned as error, for same reason as with clang, because it's non-critical and we might want to keep deprecated code for some time. - Wmissing-include-dirs provides false-positives on Qt code generation.
Add the information on the presets. At the same time the separate chapter about development is not necessary in the README.md. It should be clear that this part is described in the CONTRIBUTING.md document.
aae80ea to
58cada5
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We add multiple CMake presets which we use in our CI and can be used by consumers.
Additionally we now compile with a lot more compiler warnings enabled and warnings as errors. On our CI we do this for clang and gcc now.