Re: [PATCH] run-command: prettify -D_FORTIFY_SOURCE workaround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]