lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] g++ 4.3 compilation fixes


From: Vadim Zeitlin
Subject: [lmi] g++ 4.3 compilation fixes
Date: Mon, 6 Jul 2009 13:03:40 +0200

 Hello,

 I've recently upgraded my main Linux system to Debian Lenny which uses g++
4.3.2 as its standard compiler and now I can't compile LMI any longer (to
be honest I can still do it in "old stable" chroot but I'd prefer to do it
in the real system directly instead of having to build in chroot and I
think these problems should be fixed anyhow) because of several new
warnings and LMI use of -Werror.


 First warning is a rather strange:

cc1plus: error: -funit-at-a-time is required for inlining of functions that are 
only called once

which arise for (almost?) all files when building in "debug" mode, i.e.
without optimizations (as -O enables -funit-at-a-time implicitly). There
are 2 ways of suppressing it: we can either add -funit-at-a-time just as it
hints. Or we can also use -fno-inline-functions-called-once to tell g++
that it shouldn't try to inline static functions called only once. In fact
I really don't know why is this even on by default (the man page says that
it's enabled if -funit-at-a-time is used but clearly we do not use it here).
I am not sure which one is preferable: on one hand, using -funit-at-a-time
would make debug build behave more like the release/production one. OTOH we
really don't care about inlining when debugging. Would you have any
preference here?

 Also, could you please confirm that we don't care about g++ versions less
than 3.4.4 any more? I checked that these options (both of them) are
supported by 3.4.4 but I don't think they were present in 3.3.


 Second, g++ 4.3 seems to be much more pedantic in its -Wconversion
handling. The result is that including any wx header results in dozens of
warnings, here are some (but by no means all) examples:

include/wx/windowid.h:46: error: conversion to 'wxWindowID' from 'long int' may 
alter its value
include/wx/unichar.h:45: error: conversion to 'wxUint32' from 'long int' may 
alter its value
include/wx/string.h:742: error: conversion to 'unsigned int' from 'long int' 
may alter its value
include/wx/dynarray.h:1013: error: conversion to 'int' from 'long int' may 
alter its value
include/wx/gdicmn.h:245: error: conversion to 'int' from 'long int' may alter 
its value
...

Clearly, wx use of int and long as interchangeable types is at fault here.
But fixing it would take a lot of time so for now I just removed
-Wconversion from the warning flags. Please let me know if you think it's
worth fixing wx headers to compile with -Wconversion.


 Finally, -Wparentheses (enabled by -Wall) results in some more warnings
too:

fenv_lmi_x86.hpp:211: error: suggest parentheses around arithmetic in operand 
of |
value_cast.hpp:200: error: suggest parentheses around && within ||
...

Again, would you prefer me to fix them by inserting the appropriate
parentheses or just use -Wno-parentheses?

 Thanks,
VZ

reply via email to

[Prev in Thread] Current Thread [Next in Thread]