Upcoming incompatible changes of gcc 4.3
Xiaobin Lu
Xiaobin.Lu at Sun.COM
Wed Jun 25 17:50:52 PDT 2008
I've just fixed the build failure of hotspot using gcc 4.2 and thought
we were better off for a good hotspot gcc build for a while. But it was
wrong, it seems like there are more incompatible changes introduced in
gcc 4.3 which will affect the build of hotspot. Here are two things
which relate to hotspot.
1. The meaning of "-Wconversion" option has been modified. Its purpose
now is to warn for implicit conversions that may alter a value. This new
behavior is available for both C and C++. Warnings about conversions
between signed and unsigned integers can be disabled by using
-Wno-sign-conversion. In C++, they are disabled by default unless
-Wsign-conversion is explicitly requested. The old behavior of
-Wconversion, that is, warn for prototypes causing a type conversion
that is different from what would happen to the same argument in the
absence of a prototype, has been moved to a new option
-Wtraditional-conversion, which is only available for C.
This incompatible change caused a lot of build failure since we are
converting from int to short, double to float in many many places. I
believe this should eventually get fixed, but it will take a lot of
efforts and rethinking about the design of the classes we have. For
now, a workaround would be to turn off "-Wconversion" when we detect the
gcc version is greater or equal to 4.3. In fact, even a lot of existing
c/c++ library files will have such problems, for example, the definition
of isnan(x) in math.h does not do explicit conversion from double to
float and it will cause any code using them fail to compile if
"-Wconversion -Werror" are specified.
2. Removal of Pre-ISO headers so we can't include headers such as
iostream.h anymore. iostream should be included instead. This should
only affect a few places in adlc code and we can easily fix these.
I filed CR 6718830 to address this problem and the fix is on the way.
Please feel free to let me know your thoughts on this.
-Xiaobin
More information about the hotspot-dev
mailing list