kcoreaddons: Fix many clang warnings

Review Request #127131 - Created Feb. 21, 2016 and submitted

David Faure
(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.


  • 0
  • 1
  • 0
  • 1
Description From Last Updated
David Edmundson
Michael Pyne
David Faure
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 12eb1ab1224bb7a10df3520d9a2617b5032fe31c by David Faure to branch master.
Michael Pyne

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?

  1. Thanks for the heads up. I added a return statement after the switch, should keep both compilers happy.