9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] USED() macro
Date: Sat, 12 Nov 2005 11:37:23 -0500	[thread overview]
Message-ID: <ee9e417a0511120837xa80c9d5q4d7f45886d4ee9d3@mail.gmail.com> (raw)
In-Reply-To: <1131806556.7582.86.camel@localhost.localdomain>

> 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.

Fixed.

> 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?

Fixed.

> 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?

It probably is functioning correctly.  You still can't do
    Rectangle r;
    USED(r);
with that definition because you can't cast a Rectangle
to a ulong.  I could change the definition for __GNUC__>=3
but then it would allow non-scalar USED but all the other
platforms would not, so then I'd be getting reports from
the non-gcc users.  I'd rather all the platforms be consistent.

If you're not seeing a warning about the variable never
being used or being set and not used, then it's functioning fine.

Russ


      reply	other threads:[~2005-11-12 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-12 10:00 李微
2005-11-12 11:18 ` Charles Forsyth
2005-11-12 13:17   ` Russ Cox
2005-11-12 14:42     ` 李微
2005-11-12 16:37       ` Russ Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee9e417a0511120837xa80c9d5q4d7f45886d4ee9d3@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).