RFR (S): 8143215: gcc 4.1.2: fix three issues breaking the build.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Wed Nov 18 20:31:55 UTC 2015

Hi Kim,

Yes, this is because the warnings are enabled, and -Werror is set.
I had to do similar changes on a regular basis before, and I don't want to 
question support of gcc 4.1.2 and the corresponding flags each time.
So for now I really would appreciate if you could agree to that change.
If there is a way to note the casts down that you would prefer more, 
I'm happy to adapt the code. 

We are trying to get our internal build to go to newer compilers
for newer Java versions. In case we manage that, we will no more
insist on gcc 4.1.2 support.

Best regards

-----Original Message-----
From: Kim Barrett [mailto:kim.barrett at oracle.com] 
Sent: Wednesday, November 18, 2015 6:17 PM
To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>
Cc: hotspot-gc-dev at openjdk.java.net
Subject: Re: RFR (S): 8143215: gcc 4.1.2: fix three issues breaking the build.

On Nov 18, 2015, at 6:07 AM, Lindenmaier, Goetz <goetz.lindenmaier at sap.com> wrote:
> This change fixes some minor issues breaking the build with gcc 4.1.2.
> In g1CollectorPolicy.cpp casts are missing.
> concurrentG1RefineThread.cpp needs a newline at the end of the file.
> Please review this change. I please need a sponsor.
> http://cr.openjdk.java.net/~goetz/webrevs/8143215-gcc412/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8143215

I really dislike casts, so I'm predisposed against changes of the kind
being proposed here.  Especially when they are targeted specifically
at a particular version of a particular compiler.

The code appears to be fine as-is, so what is the purpose of these
casts?  I will hazard a guess that they are to prevent warnings.  So
what warnings?  And why are there not warnings from later versions of
the same compiler?

All of the new casts are to make explicit what are currently implicit
double to size_t conversions.  Looking through gcc's warning options,
this suggests something to do with -Wconversion.  And that option is
only added when the gcc version is less than 4.3, due to a significant
change to the semantics of that option in that version.

Assuming my guesses are correct, rather than uglifying the source
code, I suggest a better direction would be to look at the warning
option usage and make some change there.

More information about the hotspot-gc-dev mailing list