9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h
  2004-01-18 17:21 [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h (fwd) ron minnich
@ 2004-01-18 17:09 ` mirtchov
  2004-01-18 23:20   ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: mirtchov @ 2004-01-18 17:09 UTC (permalink / raw)
  To: 9fans

> given the ongoing discussion of C extensions, I thought this one was a
> beaut.
>

suppressing warnings seems to be a problem few programmers (present on
this list company excluded) manage to tackle successfuly:

	home% cd src/links-ape/
	home% sed -n 223,228p gif.c
	accept_code(struct gif_decoder *deco,int c)
	{
	 int k;

	 k=k; /* To suppress warning */
	 if (c>4096||c<0) return; /* Erroneous code word will be ignored */
	home%

Plan 9 has USED().  Interestingly enough, in the lunix version of Plan
9's libraries USED() works on a single argument only :)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h (fwd)
@ 2004-01-18 17:21 ron minnich
  2004-01-18 17:09 ` [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h mirtchov
  0 siblings, 1 reply; 3+ messages in thread
From: ron minnich @ 2004-01-18 17:21 UTC (permalink / raw)
  To: 9fans


given the ongoing discussion of C extensions, I thought this one was a
beaut.

ron

---------- Forwarded message ----------
Date: Sun, 18 Jan 2004 16:32:23 +0000 (GMT)
From: Michael Brown <mbrown@fensystems.co.uk>
To: Etherboot <Etherboot-developers@lists.sourceforge.net>
Subject: Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h
    (fwd)

Forgot to post this to the list, sorry.

---------- Forwarded message ----------
Date: Sat, 17 Jan 2004 14:00:26 +0000 (GMT)
From: Michael Brown <mbrown@fensystems.co.uk>
To: Georg Baum <gbaum@users.sourceforge.net>
Subject: Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h

> Does the __unused attribute in
> void arch_main ( struct Elf_Bhdr * __unused );
> in arch/i386/include/hooks.h have any influence on the generated code?
> I ask because gcc 2.95 does not compile this. It seems that __unused is only
> allowed for function definitions and not declarations. Therefore I would
> like to remove the __unused attribute.

I added that recently in order to remove an unnecessary compiler warning.
I don't see any problem with removing it from the declaration; I assume
that having it present in the definition will serve to inhibit the
warning.

Michael


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Etherboot-developers mailing list
Etherboot-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/etherboot-developers



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h
  2004-01-18 17:09 ` [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h mirtchov
@ 2004-01-18 23:20   ` Russ Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Russ Cox @ 2004-01-18 23:20 UTC (permalink / raw)
  To: 9fans

> > given the ongoing discussion of C extensions, I thought this one was a
> > beaut.

Gcc suffers from having multiple versions in use at
any given time -- they don't have the luxury we do.
But beyond that I don't see anything wrong with how
they solved the problem.  __unused is a bit long for
a name, but since almost all of the USED uses in Plan 9
code are for function parameters, solving the problem
this way seems fine to me.

Why do you think this is so bad?  The only thing I can
think of is "it's not the way Plan 9 does it", which by itself
isn't such a great reason.

> suppressing warnings seems to be a problem few programmers (present on
> this list company excluded) manage to tackle successfuly:
>
> 	home% cd src/links-ape/
> 	home% sed -n 223,228p gif.c
> 	accept_code(struct gif_decoder *deco,int c)
> 	{
> 	 int k;
>
> 	 k=k; /* To suppress warning */
> 	 if (c>4096||c<0) return; /* Erroneous code word will be ignored */
> 	home%
>
> Plan 9 has USED().

I'm not sure that Links is representative of anything.

The fact is that there are no portable ways to silence
compiler warnings, so people resort to compiler-specific
hacks like "k=k" or "SET(k)".  I still don't see why Plan 9 is
any different, except that maybe (maybe!) its compiler-specific
hacks smell a little nicer.

> Interestingly enough, in the lunix version of Plan
> 9's libraries USED() works on a single argument only :)

And?

Russ


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-18 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-18 17:21 [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h (fwd) ron minnich
2004-01-18 17:09 ` [9fans] Re: [Etherboot-developers] __unused in arch/i386/include/hooks.h mirtchov
2004-01-18 23:20   ` Russ Cox

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