[Xorp-hackers] -Werror

Hasso Tepper hasso@linux.ee
Sun, 18 Dec 2005 20:20:09 +0200


I tried to compile CVS with gcc-4.0.2 optimise enabled and failed. 
Bugzilla entry will follow shortly, but I think that -Werror usage should 
be discussed though.

There have been several discussions about using it in KDE project for 
example, but core developers always objected - many of these warnings are 
compiler and preprocessor bugs actually and it'd be insane to fix all 
these. In the situation where parsers and optimisers are rewritten with 
every gcc release (okok, not with every release), it's even more insane - 
warnings are even different with different optimise flags used.

Some examples ... Many fea classes don't compile with -Os with gcc-4.0.2, 
but do with -O2:

fticonfig_entry_get_dummy.cc: In destructor 
'FtiConfigEntryGetDummy::~FtiConfigEntryGetDummy()':
fticonfig_entry_get_dummy.cc:47: warning: control may reach end of 
non-void function 'virtual int 
FtiConfigEntryGetDummy::stop(std::string&)' being inlined

What it doesn't like, is:

return (XORP_OK);
UNUSED(error_msg);

Switch places (put return after UNUSED()) and it will compile.

OSPF peer.cc doesn't compile with -Os and -O2:

peer.cc:4446: warning: statement has no effect
peer.cc:4449: warning: statement has no effect
peer.cc:4451: warning: statement has no effect
peer.cc:4452: warning: statement has no effect

What it doesn't like is htonl(). Should this be removed?

Btw, linking bgp fails with (real) error with -Os, but it links with -O2. 
I'm investigating, but should I report it at all? Or is there policy 
which compiler flags are supported?


regards,

-- 
Hasso Tepper