kcoreaddons: Fix many clang warnings
Review Request #127131 - Created Feb. 21, 2016 and submitted
(C casts, global functions without static, unused default statements...) This detected a small bug in kdirwatch, where fall-through was unintended (I know, because I wrote that code).
Compiled with clang; ran autotests.
Looked good to me (so marking as +1) though I do have a suggested improvement.
Since you're here anyways, probably best to redo the right-hand side to something like
100.0 * processedAmount / totalAmount.
The cast to float is incomplete since the compiler still has to upcast to double (for 100.0, which should be 100.0f to be treated as a float), and moving the 100.0 to the beginning will force the rest of the expression to be treated as a double anyways.
Status: Closed (submitted)
Submitted with commit 12eb1ab1224bb7a10df3520d9a2617b5032fe31c by David Faure to branch master.
Jenkins has reported a build failure (https://build.kde.org/job/kcoreaddons%20master%20kf5-qt5/PLATFORM=Linux,compiler=gcc/117/console), looks like we might have dueling compiler errors:18:07:28 /home/jenkins/builds/kcoreaddons/kf5-qt5/src/lib/io/kdirwatch.cpp:137:1: error: control reaches end of non-void function [-Werror=return-type]
Seems that the GCC used on CI doesn't recognize that every possible error case is handled in the switch (or alternately, it assumes that someone might try to shoehorn an out-of-range enumeration value into the function). GCC 5.3 works fine, which is what I'd used for testing. But it might be easier to revert the switch/case portions of the patch, perhaps add warning suppressions instead?