RFC: When to use #warning ?
Friedrich W. H. Kossebau
kossebau at kde.org
Mon Jan 28 20:24:43 GMT 2013
Hi all and especially the Kexi developers :)
the last days I spent some time to do little commits to decrease the currently
quite high amount of warnings during a full build of Calligra. Most commits
were some simple fixes like removing/hiding unused parameters/variables, so I
felt free to skip any review process and to simply commit directly, noone
might have had fun reviewing them anyway ;) Managed to cut around 6 % of the
warnings (/me pats himself on the back), see
http://build.kde.org/job/calligra_master/warnings14/trendDetails/?
(those now and then slight increases in numbers are quite strange, anyone with
an explanation for that?)
I guess everyone agrees that ideally there are no warnings at all, not only to
quickly see new warnings due to own code changes. We build with warnings for a
reason, don't we? But with still more than 1000 warnings e.g. in a
build.kde.org build of master the motivation to prevent new warnings might be
low, because what is 1 new warning due to sloppy coding if there are already
1000, right? ;)
So I would like to continue the "game" where my/our highscore is the lowscore
of warnings :) to give everyone the feeling that that extra line to ensure
more code quality is worth it.
Now, a "grep '#warning' . -R | wc -l" tells there are at least 200 compiler
warnings only due to #warning, from which 152 are in kexi/ and which most look
to me rather like TODO comments.
Dear Kexi developers,
is there are real need for that, or would you possibly go with the idea that
TODOs can also be noted as comments?
Advantages that I see:
* can be done with different keywords, to map to different kind of TODOs
* quickly collectable without a compiler/build run, using grep & Co.
* does not clutter the warnings which only the compiler can find out about
So what do you think about a general rule to be added to the Calligra coding
style to avoid #warnings and use them just to emit real build/compiling
related problems (like build condition checks that should not fail or
similar)?
Of course I am willing to help with any patches needed to transform TODO
#warnings into TODO comments :)
Now please your comments, hints, proposals!
Cheers
Friedrich
More information about the calligra-devel
mailing list