Build portability: enable or disable warnings
Fredrik Öhrström
fredrik.ohrstrom at oracle.com
Mon May 16 07:39:37 UTC 2011
2011-05-13 15:20, Andrew Haley skrev:
> 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:
> 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.
I think it is better to fix the underlying complaint of the compiler.
Thus change the sscanf string to "%lx-%*x"
The compiler is complaining that you over specify the second scanned
parameter that is going to be thrown away anyway.
//Fredrik
More information about the build-dev
mailing list