RFC: Avoiding #warning (C/C++ preprocessor extension)
Frans Englich
frans.englich at telia.com
Mon Oct 31 15:11:10 GMT 2005
On Sunday 30 October 2005 23:16, Olivier Goffart wrote:
> Le Dimanche 30 Octobre 2005 21:25, Jarosław Staniek a écrit :
> > Since KDE is becoming more portable, my proposal is to avoid using
> > #warning C/C++ preprocessor's extension. Unlike #error, #warning is not a
> > standard - several compilers in addition to gcc implement this. Msvc
> > compiler does not.
>
> All of this is correct.
> Anyway, #warning are just temporary code, and they should be removed
> before the release.
Agreed. In my world, compiler warnings are indications to mistakes in code,
and they should immediately be corrected. Thus, I understand using #warning
for detecting when inclusions are wrong or similar, not communicating the
roadmap of a project, which it in some cases are used like :}
> A good code compiles without warnings at all.
My view too, my current project compiles with:
AM_CXXFLAGS = -pedantic -Wredundant-decls -Werror -Wunused-macros
-Wfloat-equal
I think it would be cool if for for example kdelibs, once the Qt port is over,
that the compilation was made more strict, that the code gradually compiled
with more warning flags. In cases where global enabled warnings can't be
used, such as including C headers, compiling Bison parsers and similar, the
warnings can be disabled locally with -W-no-*.
GCC's warnings are for the most time valid and AFAICT everyone agrees that
they shouldn't be there -- but no one cares enough for fixing it. Thus,
adding "-Werror" and other options would raise the bar for what goes in and
increase the general "tidyness". Just a thought.
Cheers,
Frans
More information about the kde-core-devel
mailing list