From owner-freebsd-hackers@FreeBSD.ORG Mon Jan 31 09:42:53 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 943591065673; Mon, 31 Jan 2011 09:42:53 +0000 (UTC) Date: Mon, 31 Jan 2011 09:42:53 +0000 From: Alexander Best To: Julian Elischer Message-ID: <20110131094253.GA98011@freebsd.org> References: <20110130172941.GA10701@freebsd.org> <20110131075439.GA49765@freebsd.org> <4D46716E.6070500@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D46716E.6070500@freebsd.org> Cc: freebsd-hackers@freebsd.org, Roman Divacky Subject: Re: empty function macros X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2011 09:42:53 -0000 On Mon Jan 31 11, Julian Elischer wrote: > On 1/30/11 11:54 PM, Roman Divacky wrote: > >no problem with this with clang :) > > > >On Sun, Jan 30, 2011 at 05:29:41PM +0000, Alexander Best wrote: > >>hi there, > >> > >>i noticed freebsd has a few of the following macros: > >> > >>#define FUNC(sb) > >> > >>when you do something like > >> > >>if (cond) > >> FUNC(i) > > you missed an important part.... > > it's probably > if (cond) > FUNC(i); > (note the ';') > THAT would be ok.... > without the ';' you just made whatever comes next conditional. ... still clang outputs a warning. sorry if i was unclear: there's no issue with clang generating wrong code. i just thought we might be able to stop clang from complaining. basically int main(int argc, char **argv) { if (1 > 2) ; } produces a warning in clang, whereas with gcc (base) it doesn't. cheers. alex > > >>the compiler complains about an if statement with an empty body. any > >>sensible > >>way of dealing with this issue? > >> > >>i saw some reiserfs code which does the following to silence compilers: > >> > >>#define FUNC(sb) do { } while (0) > > yeah we do that too in some places. > (certainly at work I have done so) > > > >>cheers. > >>alex > >> > >>-- > >>a13x > >>_______________________________________________ > >>freebsd-hackers@freebsd.org mailing list > >>http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > >>To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > >_______________________________________________ > >freebsd-hackers@freebsd.org mailing list > >http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > >To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > -- a13x