git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Jeff King <peff@peff.net>, git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] config.mak.dev: enable -Wunused-function
Date: Thu, 18 Oct 2018 18:01:44 +0100	[thread overview]
Message-ID: <3295c759-473b-f279-5443-f915fd0b1061@ramsayjones.plus.com> (raw)
In-Reply-To: <20181018070522.GA29499@sigill.intra.peff.net>



On 18/10/2018 08:05, Jeff King wrote:
> We explicitly omitted -Wunused-function when we added
> -Wextra, but there is no need: the current code compiles
> cleanly with it. And it's worth having, since it can let you
> know when there are cascading effects from a cleanup (e.g.,
> deleting one function lets you delete its static helpers).
> 
> There are cases where we may need an unused function to
> exist, but we can handle these easily:
> 
>   - macro-generated code like commit-slab; there we have the
>     MAYBE_UNUSED annotation to silence the compiler
> 
>   - conditional compilation, where we may or may not need a
>     static helper. These generally fall into one of two
>     categories:
> 
>       - the call should not be conditional, but rather the
> 	function body itself should be (and may just be a
> 	no-op on one side of the #if). That keeps the
> 	conditional pollution out of the main code.
> 
>       - call-chains of static helpers should all be in the
>         same #if block, so they are all-or-nothing
> 
>     And if there's some case that doesn't cover, we still
>     have MAYBE_UNUSED as a fallback.
> 
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  config.mak.dev | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/config.mak.dev b/config.mak.dev
> index 92d268137f..bbeeff44fe 100644
> --- a/config.mak.dev
> +++ b/config.mak.dev
> @@ -34,7 +34,6 @@ ifeq ($(filter extra-all,$(DEVOPTS)),)
>  CFLAGS += -Wno-empty-body
>  CFLAGS += -Wno-missing-field-initializers
>  CFLAGS += -Wno-sign-compare
> -CFLAGS += -Wno-unused-function
>  CFLAGS += -Wno-unused-parameter
>  endif
>  endif
> 

Heh, as luck would have it, tonight I had an -Wunused-function
warning on cygwin, but not Linux, when building the 'pu' branch.

[On linux, I am using DEVELOPER=1 in my config.mak etc., whereas
on cygwin I am still using an explicit (but very similar) list
of -W args.]

I haven't looked too deeply, but this seems to be caused by
Junio's commit 42c89ea70a ("SQUASH??? - convert the other user of
string-list as db", 2018-10-17) which removes a call to the
add_existing() function - the subject of the warning.

[BTW there is another 'static add_existing()' in builtin/show_ref.c]

ATB,
Ramsay Jones


  parent reply	other threads:[~2018-10-18 17:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18  7:05 [PATCH] config.mak.dev: enable -Wunused-function Jeff King
2018-10-18  7:08 ` Jeff King
2018-10-18 15:48 ` Duy Nguyen
2018-10-18 17:09   ` Jeff King
2018-10-18 18:05     ` [PATCH/RFC] thread-utils: better wrapper to avoid #ifdef NO_PTHREADS Nguyễn Thái Ngọc Duy
2018-10-23 20:28       ` Jeff King
2018-10-24  2:58         ` Junio C Hamano
2018-10-26 14:09         ` Ben Peart
2018-10-27  7:12           ` can we deprecate NO_PTHREADS?, was: " Jeff King
2018-10-27  7:26           ` [PATCH/RFC] thread-utils: " Duy Nguyen
2018-10-27  8:17             ` Jeff King
2018-10-18 17:01 ` Ramsay Jones [this message]
2018-10-19  1:23   ` [PATCH] config.mak.dev: enable -Wunused-function 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=3295c759-473b-f279-5443-f915fd0b1061@ramsayjones.plus.com \
    --to=ramsay@ramsayjones.plus.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /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).