[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another manywarnings failure

From: Jim Meyering
Subject: Re: another manywarnings failure
Date: Thu, 06 Sep 2012 14:48:52 +0200

Eric Blake wrote:

> On 09/06/2012 12:07 AM, Jim Meyering wrote:
>> Eric Blake wrote:
>>> I compiled on FreeBSD 8.2 (gcc 4.2.1), and when I updated to the latest
>>> gnulib, I started to see the following in config.log when running
>>> ./configure CFLAGS=-g:
>> When you configure with one set of warning options and later
>> build with another, as with your "make CFLAGS=-g", you're
>> short-circuiting the build tests.  When I do that, I
>> simply turn off -Werror and ignore the warnings:
>>     make CFLAGS=-g WERROR_CFLAGS=
> But note that I did:
> ./configure CFLAGS=-g

Ah... I didn't read carefully enough.

> at the outset.  Yes, I'm aware that _if_ you override CFLAGS at make
> time, you may have to also disable warnings at that time as well.  But
> here, I'm talking about the case where I configured optimization to be
> off without needing to override CFLAGS at make time; that is, in a
> situation where we CAN run a configure test to see whether the warning
> will even be effective.
>> Of course, you could simply rerun configure with CFLAGS=-g,
> Which is what I did...
>> and it would test each -W option individually...
> except that each -W option individually succeeds.  -Wuninitialized only
> warns, not errors out, on this particular gcc 4.2.1 build.  You _have_
> to test the combination of '-Wuninitialized -Werror' but no -O, in order
> to hit the failure.  But I'm not sure how best to modify manywarnings.m4
> to do that testing.  Then again, we've already special-cased
> -Wno-missing-field-initializer to work around gcc infelicities, so I
> guess I could enhance the module by adding another test along those lines.

Yes, it looks like if we're using both of those, we'll have to
add code to reject -Wuninitialized (maybe with a warning?) when
configuring without -O.

Actually, with GNU make, this is something that we could probably
adjust at make-time.  And since we're typically enabling warnings
only when we have reasonable development tools, that might be even
better (simpler).  E.g.,

[here's simple PoC, i.e., it doesn't know about -O0,
 but you get the idea ]

W = -Wuninitialized -Werror

ifneq (,$(findstring -Wuninitialized,$(W)))
  ifneq (,$(findstring -Werror,$(W)))
    ifneq (,$(findstring -O,$(CFLAGS)))
      W := $(subst -Wuninitialized,,$(W))

        @echo $(W)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]