> In Plan 9's C compiler, USED is known to the compiler.
> It makes the compiler insert a use of the variable right
> there to silence used and not set warnings.
> 
> In the ports, it's a clumsy macro trying to have the same
> effect.
> 
> > perhaps it could use if(&x) instead of if(x)
> > to cope with structures as well
> 
> I tried this once, but then some (too smart for their
> own good) compilers complain that the value is never used.

Thanks. 

BTW, I'm trying to build plan9port on Ubuntu 5.10. Some problems
encountered:

1) X headers are in /usr/include/X11 only. No 'include' in $X11, not
even a link. So, $PLAN9/src/libdraw/mkwsysrules.sh could not find them;
and set $WSYSTYPE to 'nowsys'. As a result nowsys-*.c get compiled, and
I noticed USED() there.

2) install(1) says:

> If LOCAL.config contains a line WSYS=nowsys then the system is built
> without using X11.

I guess it might be WSYSTYPE=nowsys?

3) 9c uses gcc, but USED() is still defined as if(x){}else{}, not the
version with __attribute__ ((unused)). When I added -D__GNUC__ in 9c, it
complained for redefinition. Why not

        #ifdef __GNUC__
        #       if __GNUC__ >= 3
        #               undef USED
        #               define USED(x) { ulong __y __attribute__ ((unused)); 
__y =
        (ulong)(x); }
        #       endif
        #endif
        
functioning correctly?

Well, after all, those are all trivial. Few people will set
WSYSTYPE=nowsys.


Reply via email to