From: Pierre Habouzit Date: Thu, 08 Nov 2007 08:12:44 GMT Subject: Re: [PATCH MISC 1/1] Make gcc warning about empty if body go away. Message-ID: <20071108081244.GA6528@artemis.corp> In-Reply-To: <7vode57awg.fsf@gitster.siamese.dyndns.org> On Thu, Nov 08, 2007 at 02:01:51AM +0000, Junio C Hamano wrote: > Pierre Habouzit writes: > > > diff --git a/builtin-diff.c b/builtin-diff.c > > index f77352b..80392a8 100644 > > --- a/builtin-diff.c > > +++ b/builtin-diff.c > > @@ -204,7 +204,7 @@ static void refresh_index_quietly(void) > > if (write_cache(fd, active_cache, active_nr) || > > close(fd) || > > commit_locked_index(lock_file)) > > - ; /* > > + (void)0; /* > > * silently ignore it -- we haven't mucked > > * with the real index. > > */ > > Wouldn't this be much easier to read, by the way? > > The point is that if we touched the active_cache, we try to > write it out and make it the index file for later users to use > by calling "commit", but we do not really care about the failure > from this sequence because it is done purely as an optimization. > > The original code called three functions primarily for their > side effects, which is admittedly a bad style. Well all I care is that the warning goes away, it prevents me to build in -Werror and it's bad :) -- ·O· Pierre Habouzit ··O madcoder@debian.org OOO http://www.madism.org