git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	git@vger.kernel.org, Michael Wookey <michaelwookey@gmail.com>,
	Markus Heidelberg <markus.heidelberg@web.de>
Subject: Re: [PATCH] run-command: prettify -D_FORTIFY_SOURCE workaround
Date: Wed, 16 Mar 2011 10:17:14 +0100	[thread overview]
Message-ID: <4D80801A.1000208@viscovery.net> (raw)
In-Reply-To: <7v7hbzaan9.fsf@alter.siamese.dyndns.org>

Am 3/16/2011 6:37, schrieb Junio C Hamano:
> It certainly is _not_ "ok" to see errors from write(2); we are _ignoring_
> the error because at that point in the codepath there isn't any better
> alternative.  The unusual "if ()" whose condition is solely for its side
> effect, with an empty body, is a strong enough sign to any reader that
> there is something fishy going on, and it would be helpful to the reader
> to hint _why_ such an unusual construct is there.  It would be much better
> for the longer term maintainability to say at least "gcc" in the comment,
> i.e.
> 
> 	if (write(...))
>         	; /* we know we are ignoring the error, mr gcc! */

And what about compilers that warn:

	';' : empty controlled statement found; is this the intent?

That's from MSVC. Perhaps:

	if (write(...))
		(void)0; /* we know we are ignoring the error, mr gcc! */

-- Hannes

  parent reply	other threads:[~2011-03-16  9:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 22:38 [PATCH] run-command.c: fix build warnings on Ubuntu Michael Wookey
2010-01-30 16:43 ` Markus Heidelberg
2011-03-16  3:51 ` [PATCH] run-command: prettify -D_FORTIFY_SOURCE workaround Jonathan Nieder
2011-03-16  5:37   ` Junio C Hamano
2011-03-16  7:32     ` [PATCH v2] " Jonathan Nieder
2011-03-17 22:34       ` Junio C Hamano
2011-03-16  9:17     ` Johannes Sixt [this message]
2011-03-16  9:25       ` [PATCH] " 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=4D80801A.1000208@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=markus.heidelberg@web.de \
    --cc=michaelwookey@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).