git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/13] more unused parameter cleanups
Date: Thu, 21 Mar 2019 05:44:14 -0400	[thread overview]
Message-ID: <20190321094414.GA2894@sigill.intra.peff.net> (raw)
In-Reply-To: <87woksd322.fsf@evledraar.gmail.com>

On Thu, Mar 21, 2019 at 09:50:13AM +0100, Ævar Arnfjörð Bjarmason wrote:

> LGTM from skimming it, FWIW this is now what we need to compile cleanly
> with -Wextra:
> 
>     make DEVELOPER=1 DEVOPTS="extra-all" CFLAGS="-Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -Wno-empty-body" all
> 
> For some such as -Wempty-body we'd really need to contort ourselves to
> get it passing anywhere near cleanly (all of those have existing "/*
> this is intentional! */" comments).

I think we could probably define a NOOP_BODY macro or function and use
that instead. But it may not be worth the trouble. I'd have to see how
painful that would be, and whether it might find any cases that actually
look like real bugs.

For -Wunused-parameter I am working towards being able to actually
enable that everywhere. It is not _too_ bad to annotate the instances
which must be there, and my digging with it has uncovered several real
bugs. Right now I'm in the "drop useless parameters" phase, which I
expect will take one or two more rounds.

Then I'll start on the "annotate unused ones we must keep" series, which
culminates in actually flipping on the switch with DEVELOPER (or rather,
stopping flipping it off).

You can see my progress on the jk/unused-4-mark branch of
https://github.com/peff/git (I think the contents are good, but the
commit messages and organization need some cleanup).

> I wonder if for the rest of these it's worth re-picking up this old
> suggestions of yours about #pragma:
> https://public-inbox.org/git/20170126143252.ne533mcv3n2ksbai@sigill.intra.peff.net/
> 
> I.e. for us to define our own macro for these cases & use it.

The push/pop ones may be of use (which both clang and gcc seem to
support), since that would let us localize the effects. I think in many
cases there's usually a more readable solution, though (e.g., you'd want
to annotate specific parameters as unused with single word, not a 3-line
push-diag/declare-param/pop-diag mess).

-Peff

      reply	other threads:[~2019-03-21  9:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  8:12 [PATCH 0/13] more unused parameter cleanups Jeff King
2019-03-20  8:13 ` [PATCH 01/13] revision: drop some unused "revs" parameters Jeff King
2019-03-20  8:13 ` [PATCH 02/13] log: drop unused rev_info from early output Jeff King
2019-03-20  8:14 ` [PATCH 03/13] log: drop unused "len" from show_tagger() Jeff King
2019-03-20  8:14 ` [PATCH 04/13] update-index: drop unused prefix_length parameter from do_reupdate() Jeff King
2019-03-20  8:14 ` [PATCH 05/13] test-date: drop unused "now" parameter from parse_dates() Jeff King
2019-03-20  8:15 ` [PATCH 06/13] unpack-trees: drop name_entry from traverse_by_cache_tree() Jeff King
2019-03-20  8:15 ` [PATCH 07/13] unpack-trees: drop unused error_type parameters Jeff King
2019-03-20  8:15 ` [PATCH 08/13] report_path_error(): drop unused prefix parameter Jeff King
2019-03-20  8:16 ` [PATCH 09/13] fetch_pack(): drop unused parameters Jeff King
2019-03-20  8:16 ` [PATCH 10/13] parse-options: drop unused ctx parameter from show_gitcomp() Jeff King
2019-03-20  8:16 ` [PATCH 11/13] pretty: drop unused "type" parameter in needs_rfc2047_encoding() Jeff King
2019-03-20  8:16 ` [PATCH 12/13] pretty: drop unused strbuf from parse_padding_placeholder() Jeff King
2019-03-20  8:16 ` [PATCH 13/13] parse_opt_ref_sorting: always use with NONEG flag Jeff King
2019-03-20 12:22   ` Martin Ågren
2019-03-20 20:22     ` Jeff King
2019-03-20  9:29 ` [PATCH 0/13] more unused parameter cleanups Junio C Hamano
2019-03-21  8:50 ` Ævar Arnfjörð Bjarmason
2019-03-21  9:44   ` Jeff King [this message]

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=20190321094414.GA2894@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@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.
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).