On Tue, Sep 24, 2019 at 05:34:08PM -0400, Jeff King wrote:
> > I'm tacking this patch on since this warning didn't show up until I
> > compiled it on gcc 9.1.0.
>
> Curiously, I _don't_ see the warning with gcc 9.2.1. By my reading of
> the manpage, this should be triggered by -Wunused-const-variable=2, but
> not by "1" (the difference being whether it triggers for stuff in header
> files). And only the latter is triggered by -Wall or -Wextra.
>
> But another weirdness is that hdr-check is directly compiling the header
> files. So I guess that fools it. But we don't pass any of the extra
> diagnostic options there. Have you put "-Wall" into your $(CC)?
>
> Perhaps a more realistic hdr-check would be:
>
> {
> echo '#include "git-compat-util.h"'
> echo '#include "$<"'
> } >$*.hcc
> $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $*.hcc
Oh, heh. I should have read your whole series (the mention of
pack-bitmaps in the subject got my attention).
So yeah, I think the problem is that you're using $(ALL_CFLAGS) with our
fake "compile the header" check, which does not reflect how our code is
really compiled. I think we should use a more accurate simulation, like
what I wrote above.
-Peff