git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Benoit Pierre <benoit.pierre@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/2] fix status_printf_ln calls "zero-length format" warnings
Date: Mon, 10 Mar 2014 15:51:21 -0400	[thread overview]
Message-ID: <20140310195121.GB24568@sigill.intra.peff.net> (raw)
In-Reply-To: <1394479647-22361-1-git-send-email-benoit.pierre@gmail.com>

On Mon, Mar 10, 2014 at 08:27:25PM +0100, Benoit Pierre wrote:

> Those happens with "gcc -Wformat-zero-length". Since passing NULL does not
> generate a warning (as __attribute__((printf())) does not imply nonull), modify
> status_printf/status_printf_ln to allow a NULL format and update calls with an
> empty string.

Most of us who compile with -Wall decided a while ago to use
-Wno-format-zero-length, because it really is a silly complaint (it
assumes there are no side effects of the function besides printing the
format string, which is obviously not true in this case).

It would be nice to compile out of the box with "-Wall -Werror", and I
think your solution looks relatively clean. But I am slightly concerned
about the assumption that it is OK to pass a NULL fmt parameter to a
function marked with __attribute__((format)).  It certainly seems to be
the case now, and I do not know of any plans for that to change, but it
seems like a potentially obvious thing for the compiler to check.

I dunno; perhaps it has already been considered and rejected by gcc
folks to allow the exact escape hatch we are using here.

-Peff

  parent reply	other threads:[~2014-03-10 19:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 19:27 [PATCH 0/2] fix status_printf_ln calls "zero-length format" warnings Benoit Pierre
2014-03-10 19:27 ` [PATCH 1/2] status: allow NULL fmt for status_printf/status_vprintf_ln Benoit Pierre
2014-03-10 20:13   ` Eric Sunshine
2014-03-10 19:27 ` [PATCH 2/2] fix status_printf_ln calls "zero-length format" warnings Benoit Pierre
2014-03-10 19:51 ` Jeff King [this message]
2014-03-11 19:25   ` [PATCH 0/2] " Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20140310195121.GB24568@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=benoit.pierre@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).