On 16/05/11 09:19, David Holmes wrote: > Fredrik Öhrström said the following on 05/16/11 17:39: >> 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. > > This particular issue has already been fixed. > > I assumed Andrew was more generally questioning whether to force Wformat > on or off rather than potentially have it vary depending on the compiler > version.
Exactly. The crucial paragraph is: "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." Different distros enable different sets of warnings by default. As it stands at the moment we have to build on a wide variety of distros to know if OpenJDK will build on a wide variety of distros. Would a patch to force on a set of warnings be a good idea? I'll have a look at the compiler defaults used by Debian and Gentoo to determine that set. Andrew.