From: Jeff King <peff@peff.net>
To: Samuel Bronson <naesten@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] wt-status.c: disable those distracting -Wformat-zero-length warnings
Date: Sat, 21 Dec 2013 04:42:02 -0500 [thread overview]
Message-ID: <20131221094202.GA32622@sigill.intra.peff.net> (raw)
In-Reply-To: <1387554301-23901-1-git-send-email-naesten@gmail.com>
On Fri, Dec 20, 2013 at 10:45:01AM -0500, Samuel Bronson wrote:
> These warnings don't really seem to make much sense for this file.
Agreed, though the advice so far has been to put -Wno-format-zero-length
in your CFLAGS.
> +/* We have good reasons for using zero-length format strings, and
> + * there's unfortunately no way to turn this off on a per-function
> + * basis ... */
> +#pragma GCC diagnostic ignored "-Wformat-zero-length"
Are other compilers happy to ignore this pragma? I guess we could wrap
it in an #ifdef, if so.
It's also really not about this file in particular. The whole concept of
format-zero-length is questionable, as it ignores the concept that a
format function might actually do something useful with an empty format
(e.g., by adding boilerplate, or having a side-effect). It's just that
this file is the only one that happens to do so.
Annotating the _function_ to say "it's useful to pass an empty format
into this function" would make sense, but as you note, there is no way
to do that.
So I dunno. This seems like it does not quite specify what we want to
say as well as just "-Wno-format-zero-length", but it is more convenient
in practice (because we take care of it in the source code, rather than
relying on the user's build settings).
-Peff
next prev parent reply other threads:[~2013-12-21 9:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 15:45 [PATCH] wt-status.c: disable those distracting -Wformat-zero-length warnings Samuel Bronson
2013-12-21 9:42 ` Jeff King [this message]
2013-12-21 20:09 ` Samuel Bronson
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=20131221094202.GA32622@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=naesten@gmail.com \
/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).