RFC: Avoiding #warning (C/C++ preprocessor extension)

Martijn Klingens klingens at kde.org
Tue Nov 1 16:15:24 GMT 2005


On Tuesday 01 November 2005 16:57, Nicolas Goutte wrote:
> On Tuesday 01 November 2005 13:26, Martijn Klingens wrote:
> > Doesn't it work if you patch the failing Qt includes with '#pragma GCC
> > system_header'? AFAICS that shouldn't affect BC and should suppress the
> > warnings and hence the -Werror traps.
>
> That is the kind of things I meant. You have to add a gcc-ism to keep the
> compiler calm. But we are supposed to make *portable* code!

C'mon, don't cry wolf.

-Werror is a gcc-ism too. It's part of the compiler flags just as much as 
-pedantic is, and even in the hypothetical case where we would start to use 
it globally it would only be enabled on gcc, not affecting portability in the 
least.

While I don't agree with having it on unconditionally your reasoning is still 
wrong.

> I do not think that extra #ifs are better than warnings. (I would even
> think the contrary, as it makes the code less readable.)

Please read the thread more carefully -- this part was about turning warnings 
into errors, and was talking about ALL warnings, including those that the 
compiler generates itself. It was a sidestep from the #warning discussion and 
has little to do with it anymore.

-- 
Martijn




More information about the kde-core-devel mailing list