-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
chore: fix compiler warnings #618
Conversation
Thanks, I will have a look into it. |
G'day, apologies for the failed formatting; I didn't notice the script.. Is there a way I can run the CI tasks locally prior to sending a PR? I did also try to trigger them via GitHub after I created the PR but couldn't figure out how. |
You can run the unittests by entering the build folder and execute You can use the format script to format the code and then comitting it |
Sure, but the CI does more such as performing builds for a variety of platforms and creating the Flatpak etc. Hmm, formatting is still failing? But I ran clang-format locally and committed all the requested changes and re-running it does not show up any new deviations. EDIT: What's more, it's complaining about |
This is because of the clang-format version which is 13, it makes problems with clang-format 14 ... |
Right, well, your Finally, added a configuration to run clang-format v13 as a pre-commit hook. "Works For Me" but might require additional testing on a variety of build environments. It's optional to use in either case. |
989ef27
to
1d73792
Compare
So after looking into it a it more, I must say I'm not keen on the As far as I see it, there are basically 2 situations:
So I've changed the switch to Please let me know if some/all of your patch should be applied after all and I'll go through it again. I've also briefly enabled Finally, I rebased back on |
Hi @mwerle sorry that I did not apply my patch my self, but I was not able to do from the codespace for some reason. |
No worries re the patch. I'm sorry, I didn't go through it in detail, but mostly it seemed to be about adding a If you'd still like me to apply it, I'll of course do so. And apologies for taking up so much of your time on a "useless" refactor.. hoping to contribute some more useful changes in the future :) |
fac4e01
to
e11976a
Compare
* add default to switch statements throwing an exception on unhandled case. This removes `control reaches end of non-void function` in many functions. * fix QT5.14 deprecations, which will also make it easier to move to QT6 - fix QSet initialization - rename `endl` -> `Qt::endl` - rename `QString::SkipEmptyParts` -> `Qt::SkipEmptyParts` - and more... * Scintilla editor - add missing `override` - replace deprecated functions * Settings - fix deprecated QDir assignment - code-style: replace assignment with initializers (to match QDir in this file)
The refactor to remove deprecated symbols also broke compatibility with versions of QT prior to QT5.14. This commit adds back support for earlier versions of QT. Mostly this is via the new "qtsupport.h" header file, but for supporting the changed `QSet` constructor we had to put the changes into each source file. This is, of course, not optimal.
We used v14 of clang-format in commit 2dfb5a4 which introduced unwanted changes. Revert to the formatting enforced by v13 of clang-format.
Adding a configuration to invoke clang-format v13 on all modified files as part of the commit process, and a new script file `setup-env.sh` to manage installing the pre-commit hook. The hook is installed using a local python venv to ensure the correct version of clang-format is used. This approach also enables the hook to be installed on any platform which supports python although the setup script is limited to platforms which support bash.
Added a note to the `Contributing` section to invoke `cl-format.sh` and to run the tests prior to creating any PR.
… fix remaining issues. Moved the `throw` statements introduced in an earlier commit to after the `switch` statement and removed the `default` which could mask an unhandled case. Changed some situations where every enum item was listed, but fell through to a default action by replacing the explicitly enumerated items with a `default`. This was primarily where the enum was defined in an external library.
Temporarily enabled `-Wall` and fixed more warnings, but there are several uninitialized variables usages which may require review by the code author in order to ensure the refactor is correct so we leave these additional warnings disabled for now. Fixed: * removed unused lambda captures * removed unused variables * fixed sign comparisons between variables
The lambda captures `model`, but in the code, `mModel` is used. Either the capture is superfluous, or the usage is incorrect.
e11976a
to
fb9a799
Compare
This variable is actually required for Flatpak builds, so revert removing it. But to avoid compiler warnings, guard it with a precompiler check.
ab2192d
to
6cf922f
Compare
Hmm.... for some reason my git pre-commit hook isn't being invoked; at least, not when using |
No problem, you can fix it in another MR. I will merge it as soon as the CI is finished. Thank you! |
This PR fixes all warnings (mostly deprecations) in the codebase when building against QT5.15 using both
clang
andgcc
.It also ensures the codebase can still be compiled with versions of QT prior to 5.14 via a new compatibility header file
qtsupport.h
and, where that was not possible, via alternate code compilation paths via a #if..else..endif. The latter approach was required for theQSet
initializer.Out-of-scope:
Changes:
control reaches end of non-void function
in many functions.endl
->Qt::endl
QString::SkipEmptyParts
->Qt::SkipEmptyParts
override
NOTE: did not fix the deprecated usage of QProcess, as that requires a bit more throught as to how we should handle the list of configured commands and their arguments.
Testing: