git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Michael Schubert <mschub@elegosoft.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] run-command.c: Fix unused variables warning with gcc 4.6
Date: Tue, 26 Apr 2011 15:13:37 +0200	[thread overview]
Message-ID: <4DB6C501.6000705@drmicha.warpmail.net> (raw)
In-Reply-To: <4DB6BA5E.3040306@elegosoft.com>

Michael Schubert venit, vidit, dixit 26.04.2011 14:28:
> As of gcc 4.6 -Wall includes -Wunused-but-set-variable. Remove all
> unused variables to prevent those warnings.
> 
> Signed-off-by: Michael Schubert <mschub@elegosoft.com>
> ---
>  run-command.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/run-command.c b/run-command.c
> index f91e446..6e0be54 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -67,21 +67,19 @@ static int child_notifier = -1;
> 
>  static void notify_parent(void)
>  {
> -	ssize_t unused;
> -	unused = write(child_notifier, "", 1);
> +	write(child_notifier, "", 1);
>  }
> 
>  static NORETURN void die_child(const char *err, va_list params)
>  {
>  	char msg[4096];
> -	ssize_t unused;
>  	int len = vsnprintf(msg, sizeof(msg), err, params);
>  	if (len > sizeof(msg))
>  		len = sizeof(msg);
> 
> -	unused = write(child_err, "fatal: ", 7);
> -	unused = write(child_err, msg, len);
> -	unused = write(child_err, "\n", 1);
> +	write(child_err, "fatal: ", 7);
> +	write(child_err, msg, len);
> +	write(child_err, "\n", 1);
>  	exit(128);
>  }
>  #endif

git log -S"unused" origin/master run-command.c

shows that these dummies were introduced for a reason. How do you
invalidate that?

Michael

  reply	other threads:[~2011-04-26 13:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 12:28 [PATCH] run-command.c: Fix unused variables warning with gcc 4.6 Michael Schubert
2011-04-26 13:13 ` Michael J Gruber [this message]
2011-04-26 13:27   ` Michael Schubert
2011-04-26 13:45     ` Andreas Ericsson
2011-04-27  1:16 ` Jonathan Nieder

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=4DB6C501.6000705@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=mschub@elegosoft.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).