Re: Compiling without warnings issues

Hi Petr,

> warning: switch missing default case|

I had that one too somewhere last time I fixed warnings. I know that I insisted on not writing the default: because otherwise we don’t get warnings for missing case: values. However, if extra-warnings is configured in the pri file, then we activate these two warnings:
QMAKE_CXXFLAGS += -Wswitch-default
# Warn whenever a "switch" statement does not have a "default" case.

QMAKE_CXXFLAGS += -Wswitch-enum
# Warn whenever a "switch" statement has an index of enumerated type
# and lacks a "case" for one or more of the named codes of that
# enumeration. "case" labels outside the enumeration range also
# provoke warnings when this option is used.

which means that we’ll need to write a case: for each value and a default: which which could assert in debug builds or provide some kind of fall back for release builds.

> I’ve tried to generate a doxygen docs and I saw that after updating all
> “value object type” classes to use our macro, doxygen won’t generate
> docs for these member functions (namely comparison operators, copy ctor
> and assignment operator) because they’re missing in the class definition
> in the header file.

http://www.stack.nl/~dimitri/doxygen/preprocessing.html

We’ll just have to experiment to see which of the proposed solutions would work best for us.

> The last thing I noticed is that the “class type” macro from Qt.h is not
> shown in the generated docs - it’s visible only in the source code, so
> (probably) the only possible way is to add a text comment to the class
> description.

You mean REFERENCE_OBJECT, etc? If we have Doxygen do macro expansion then REFERENCE_OBJECT will not be listed as a class member because it will be expanded. Probably now it is not listed as a class member because there is no semicolon and the Doxygen parser may not parse it as a function (just a suggestion though).

Best regards,

Peter

Would you like to post a relpy?


This post is a reply to:
Re: Compiling without warnings issues
Hi Peter, I've fixed nearly all ("fixable") warnings in the Protocols::BitTorrent::{Bencoding,Torrents,Trackers} packages and I've found some things which I'd like to discuss. Protocols/BitTorrent/Trackers/TrackerRequestUrlCreator.cpp:110: warning: switch missing default case I haven't noticed that since (more...)

Follow-ups:
Re: Compiling without warnings issues
Hi Peter, thanks for that link! Now I see that it should be possible to expand these macros to make the docs complete and that's what we actually want. I've tried this (more...)