Build portability: enable or disable warnings

Andrew Haley aph at redhat.com
Fri May 13 13:20:34 UTC 2011


A recent patch (of mine, as it happens) broke builds on Debian and
Gentoo.  It was caused by a scanf call:

         if (sscanf(chars, "%lx-%*lx", &x) == 1)

which looks pretty innocuous, but it triggers a warning if -Wformat is
turned on:

warning: use of assignment suppression and length modifier together in gnu_scanf format

And, because -Werror is enabled when compiling c++ files in HotSpot, the
build fails.

I'd like our builds to be portable: that is, we should be able to
build on Fedora and have a reasonable expectation that our builds will
not fail on Debian & co.

There are two ways to fix this: either force -Wformat and
-Wformat-security on when building HotSpot or force them off.  Either
would work, but my vote goes to the former.

Thoughts?

Andrew.



More information about the build-dev mailing list