git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: git discussion list <git@vger.kernel.org>
Subject: Re: Compiling git with -Werror
Date: Fri, 27 Apr 2012 06:07:31 -0400	[thread overview]
Message-ID: <20120427100731.GC19918@sigill.intra.peff.net> (raw)
In-Reply-To: <4F9A6AB0.1050504@alum.mit.edu>

On Fri, Apr 27, 2012 at 11:45:20AM +0200, Michael Haggerty wrote:

> I like to develop with errors and warnings turned up as strict as
> possible.  For example, I would like to use
> 
>     CFLAGS="-g -O2 -Wall -Werror -Wdeclaration-after-statement"

That's more or less how I compile git.

> I thought this would be as simple as
> 
>     git clean -fdx
>     make configure
>     ./configure CFLAGS="-g -O2 -Wall -Werror -Wdeclaration-after-statement"

I don't use our autoconf at all, though. I put settings like that into
config.mak, which gets sourced by the Makefile (right after
config.mak.autogen, which is what configure produces).

> The cause of the problem is that the CFLAGS variable is used by
> ./configure when it is running its tests, and some of the tests don't
> work correctly (they produce results that are not correct for the
> platform) when run with the strict CFLAGS.
> [...]
> Is there some other mechanism to set strict CFLAGS parameters for the
> build without confusing ./configure?

Try putting "CFLAGS += -Werror" in config.mak.

> Is this a bug in how the git project is using autoconf?
> 
> Is it a bug in autoconf itself?

I think autoconf. Our configure input is just using
AC_CHECK_FUNC(strtok_r) to generate the test.  Which would mean that
it's a bad interaction of autoconf's code and your CFLAGS. So I would be
surprised if other packages didn't have similar problems.

And indeed, googling for 'autoconf cflags "-Werror"' turns up:

  http://lists.gnu.org/archive/html/bug-autoconf/2012-03/msg00070.html

Summary: don't do that. We could add a special option to turn on
warnings, but given how easy the config.mak trick above is, I don't know
that it's necessary.

-Peff

      parent reply	other threads:[~2012-04-27 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27  9:45 Compiling git with -Werror Michael Haggerty
2012-04-27  9:58 ` Thomas Rast
2012-04-27 10:07 ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120427100731.GC19918@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).