git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Makefile: suppress false positive warnings of empty format string.

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Sep 29, 2013, 19:00 UTC
Message-ID
<20130929190017.GA2482@elie.Belkin>
In-Reply-To
<1380456534-7582-1-git-send-email-stefanbeller@googlemail.com>
Hi,
Stefan Beller wrote:
Show 8 quoted lines
> --- a/Makefile
> +++ b/Makefile
> @@ -349,7 +349,7 @@ GIT-VERSION-FILE: FORCE
>  
>  # CFLAGS and LDFLAGS are for the users to override from the command line.
>  
> -CFLAGS = -g -O2 -Wall
> +CFLAGS = -g -O2 -Wall -Wno-format-zero-length
Thanks for taking this on.  Two thoughts:
 1) As Felipe mentioned, this isn't portable.  Would it make sense to
    make it conditional on the value of $(CC) or the output of
    "$(CC) --version"?
 2) I don't understand the value of -Wformat-zero-length at all.  What
    bug is it meant to prevent?  Do you know if anyone has asked the
    GCC maintainers to disable it from the default set of warnings in
    -Wall, which would give us a bug number to point to?
 3) Since we don't enable -Werror by default (which is really good ---
    use of -Werror can be a fine development tool but is a terrible
    default), the warning does not actually do much harm.  When it
    becomes harmful is when someone turns on -Werror for static
    analysis purposes and is unable to move forward from there.  Do we
    document suggested pedantic compiler flags anywhere other than the
    todo:Make script?  Should we?
    I suspect such a documentation fix would have more impact, since it
    could encourage people to experiment with flags and to check their
    code strictly even when warnings are not portable, without
    significantly slowing down the normal build.
    For reference, todo:Make suggests the following flags:
	-Wpointer-arith -Woverflow -Wunused \
	-Wno-pointer-to-int-cast -Werror \
	-Wold-style-definition std=c99 -O2 \
	-Wall -Wdeclaration-after-statement -Wno-format-zero-length -g

Hope that helps, Jonathan

Previous: Ramsay JonesNext: Jeff King
Message 5 of 10 in “What's cooking in git.git (Jul 2013, #04; Thu, 11)”
  1. Junio C HamanoJul 11, 2013
  2. Makefile: suppress false positive warnings of empty format string.Stefan Beller, Sep 29, 2013
  3. Felipe ContrerasSep 29, 2013
  4. Ramsay JonesSep 29, 2013
  5. Jonathan NiederSep 29, 2013
  6. Jeff KingSep 30, 2013
  7. Jonathan NiederSep 30, 2013
  8. Jeff KingSep 30, 2013
  9. Stefan BellerSep 30, 2013
  10. Jeff KingSep 30, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.