Re: Breakage (?) in configure and git_vsnprintf()
- From
Jeff King <peff@peff.net>
- Date
- Dec 12, 2011, 08:10 UTC
- Message-ID
- <20111212081019.GA17725@sigill.intra.peff.net>
- In-Reply-To
- <4EE5B123.2030708@viscovery.net>
On Mon, Dec 12, 2011 at 08:45:39AM +0100, Johannes Sixt wrote:
Show 11 quoted lines
> Am 12/12/2011 7:43, schrieb Jeff King: > > I'll leave the issue of "-std=c89" triggering SNPRINTF_RETURNS_BOGUS to > > people who know and care about autoconf. My gut is to say "don't do > > that". > > Right. But Michael's problem was actually that SNPRINTF_RETURNS_BOGUS was > set incorrectly; his system has a working snprintf (or so I assume). The > reason for the failure is that ./configure's test program produced a > warning, and that warning was turned into an error due to -Werror. Without > -Werror, the test program would have compiled successfully, and the > working snprintf would have been detected.
Right, I understand that. But he has given a set of options that shouldn't compile git at all (he tells the compiler not to use snprintf via -std=c89, but we require that it exists, because even our git_vsnprintf wrapper uses the underlying system vsnprintf).
So yes, the configure script is broken to detect the situation as SNPRINTF_RETURNS_BOGUS and not "this platform doesn't have snprintf at all"[1]. But I'm saying that the "we do not have snprintf at all" case is not all that interesting: git needs it. So I'm not sure compiling with -std=c89 really makes sense[2].
If somebody wants to make the configure script more accurate, I certainly don't want to stop them. I'm just not sure it is worth anybody's time in this case.
-Peff
[1] Yes, obviously we do actually have it, but it is somewhat a fluke
that it works. We tell the compiler during the compile phase that we
don't have it, but then during the link phase it is magically
available in libc.[2] I can convince git to compile on recent Linux with gcc using
CFLAGS='-std=c89 -Dinline='. Turning on "-Wall -Werror" doesn't
work because all of the inline functions appear to be unused
statics. But if I understand Michael's problem correctly, wouldn't
we be missing the prototype for snprintf, which could cause subtle
errors?