From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 1 15:24:40 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 75F74106566B; Tue, 1 Feb 2011 15:24:40 +0000 (UTC) Date: Tue, 1 Feb 2011 15:24:40 +0000 From: Alexander Best To: Roman Divacky Message-ID: <20110201152440.GA35573@freebsd.org> References: <20110130172941.GA10701@freebsd.org> <20110131075439.GA49765@freebsd.org> <20110131095158.GC98011@freebsd.org> <20110201081236.GA63338@freebsd.org> <20110201112501.GA99666@freebsd.org> <20110201151946.GA28197@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110201151946.GA28197@freebsd.org> Cc: freebsd-hackers@freebsd.org 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: Tue, 01 Feb 2011 15:24:40 -0000 On Tue Feb 1 11, Roman Divacky wrote: > On Tue, Feb 01, 2011 at 11:25:01AM +0000, Alexander Best wrote: > > On Tue Feb 1 11, Roman Divacky wrote: > > > On Mon, Jan 31, 2011 at 09:51:58AM +0000, Alexander Best wrote: > > > > On Mon Jan 31 11, Roman Divacky wrote: > > > > > no problem with this with clang :) > > > > > > > > hmmmmm....so compiling the following code > > > > > > > > int > > > > main(int argc, char **argv) > > > > { > > > > if (1<2) > > > > ; > > > > } > > > > > > > > with clang -Werror code.c -o code works for you? > > > > > > if (1<2) > > > ; > > > > > > gives a warning (and it should), on the other hand > > > > > > #define NOTHING > > > > > > if (1<2) > > > NOTHING; > > > > > > does not warn, which is what you want right? > > > > actually > > > > #define NOTHING > > > > int > > main(int argc, char **argv) > > { > > if (1<2) > > NOTHING; > > > > return (0); > > } > > > > *does* warn for me: > > > > otaku% clang test.c -o test > > test.c:7:12: warning: if statement has empty body [-Wempty-body] > > NOTHING; > > ^ > > 1 warning generated. > > are you using clang2.8? if so this is 2.9 feature then :) indeed only clang 2.8 generates the warning: otaku% clang test.c -o test test.c:7:15: warning: if statement has empty body [-Wempty-body] NOTHING(1); ^ 1 warning generated. otaku% /usr/local/bin/clang test.c -o test otaku% thanks for the hint. so there's no need to remove any #define NOTHING lines, since gcc doesn't complain and with the import of clang 2.9 clang will no longer complain about it. cheers. alex -- a13x