empty function macros

Roman Divacky rdivacky at freebsd.org
Tue Feb 1 15:19:49 UTC 2011


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 :)


More information about the freebsd-hackers mailing list