9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] /sys/src/libdraw/arith.c:163
@ 2008-11-21  9:41 lucio
  2008-11-21 10:21 ` lucio
  2008-11-22  0:54 ` Russ Cox
  0 siblings, 2 replies; 7+ messages in thread
From: lucio @ 2008-11-21  9:41 UTC (permalink / raw)
  To: 9fans

The code is:

	extern ulong
	drawld2chan[] = {
		GREY1,
		GREY2,
		GREY4,
		CMAP8,
	};

and GCC (yes, that one!) complains about it:

	gcc -c -Wall -D_PLAN_9 -D_POSIX_SOURCE -D_PLAN9_SOURCE -I. /sys/src/libdraw/arith.c
	/sys/src/libdraw/arith.c:163: warning: `drawld2chan' initialized and declared `extern'

It seems a legitimate complaint, but I'm not sure how I should address
it.  The idea is to make sure that this remains compatible with the
Plan 9 native compilers, of course.

++L

PS: Yes, I'm trying to make some progress in bringing GCC out of the
closet.  Every time I return to this project, I need to learn a whole
lot of new things, nevermind remember all the old ones :-(




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

* Re: [9fans] /sys/src/libdraw/arith.c:163
  2008-11-21  9:41 [9fans] /sys/src/libdraw/arith.c:163 lucio
@ 2008-11-21 10:21 ` lucio
  2008-11-21 10:27   ` Richard Miller
  2008-11-22  0:54 ` Russ Cox
  1 sibling, 1 reply; 7+ messages in thread
From: lucio @ 2008-11-21 10:21 UTC (permalink / raw)
  To: 9fans

> and GCC (yes, that one!) complains about it:

Here's another:

	/sys/src/libdraw/window.c:25

	s = malloc(sizeof(Screen));
	if(s == 0)
		return 0;
	SET(id);
	^^^^^^^^
	for(try=0; try<25; try++){

I can't seem to find a definition for SET() anywhere, although I may
not be looking in the right places.  Here is what GCC has to say about
it:

	gcc -c -Wall -D_PLAN_9 -D_POSIX_SOURCE -D_PLAN9_SOURCE -I. /sys/src/libdraw/window.c
	/sys/src/libdraw/window.c: In function `allocscreen':
	/sys/src/libdraw/window.c:25: warning: implicit declaration of function `SET'

++L




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

* Re: [9fans] /sys/src/libdraw/arith.c:163
  2008-11-21 10:21 ` lucio
@ 2008-11-21 10:27   ` Richard Miller
  2008-11-21 10:49     ` lucio
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Miller @ 2008-11-21 10:27 UTC (permalink / raw)
  To: 9fans

> I can't seem to find a definition for SET() anywhere, although I may
> not be looking in the right places.

/sys/src/cmd/cc/lex.c:1163




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

* Re: [9fans] /sys/src/libdraw/arith.c:163
  2008-11-21 10:27   ` Richard Miller
@ 2008-11-21 10:49     ` lucio
  2008-11-21 10:56       ` Richard Miller
  0 siblings, 1 reply; 7+ messages in thread
From: lucio @ 2008-11-21 10:49 UTC (permalink / raw)
  To: 9fans

>> I can't seem to find a definition for SET() anywhere, although I may
>> not be looking in the right places.
>
> /sys/src/cmd/cc/lex.c:1163

Hm. So kencc knows about it, but it seems an undocumented feature.
How do I express it to suit GCC given that I don't know what it does?
And can I express it in a manner compatible to both compilers?

I'm sorry to be a pain, I don't have convenient net google access
right now.

++L




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

* Re: [9fans] /sys/src/libdraw/arith.c:163
  2008-11-21 10:49     ` lucio
@ 2008-11-21 10:56       ` Richard Miller
  2008-11-21 10:59         ` lucio
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Miller @ 2008-11-21 10:56 UTC (permalink / raw)
  To: 9fans

> Hm. So kencc knows about it, but it seems an undocumented feature.

Documented here:

/sys/doc/comp.ms:1256,1266

> How do I express it to suit GCC given that I don't know what it does?

Just replace SET(x) with x = 0;




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

* Re: [9fans] /sys/src/libdraw/arith.c:163
  2008-11-21 10:56       ` Richard Miller
@ 2008-11-21 10:59         ` lucio
  0 siblings, 0 replies; 7+ messages in thread
From: lucio @ 2008-11-21 10:59 UTC (permalink / raw)
  To: 9fans

> Documented here:
>
> /sys/doc/comp.ms:1256,1266

Thank you, I've been looking for this type of thing for a long time
(since typestr made its first appearance in kencc), but I could have
sworn there had been no updates to the compiler documentation.  Trust
me to overlook the obvious.

++L




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

* Re: [9fans] /sys/src/libdraw/arith.c:163
  2008-11-21  9:41 [9fans] /sys/src/libdraw/arith.c:163 lucio
  2008-11-21 10:21 ` lucio
@ 2008-11-22  0:54 ` Russ Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Russ Cox @ 2008-11-22  0:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Nov 21, 2008 at 1:41 AM,  <lucio@proxima.alt.za> wrote:
> The code is:
>
>        extern ulong
>        drawld2chan[] = {
>                GREY1,
>                GREY2,
>                GREY4,
>                CMAP8,
>        };
>
> and GCC (yes, that one!) complains about it:
>
>        gcc -c -Wall -D_PLAN_9 -D_POSIX_SOURCE -D_PLAN9_SOURCE -I. /sys/src/libdraw/arith.c
>        /sys/src/libdraw/arith.c:163: warning: `drawld2chan' initialized and declared `extern'
>
> It seems a legitimate complaint, but I'm not sure how I should address
> it.  The idea is to make sure that this remains compatible with the
> Plan 9 native compilers, of course.

Gcc has correctly diagnosed a mistake; s/extern\n//

Russ


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

end of thread, other threads:[~2008-11-22  0:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-21  9:41 [9fans] /sys/src/libdraw/arith.c:163 lucio
2008-11-21 10:21 ` lucio
2008-11-21 10:27   ` Richard Miller
2008-11-21 10:49     ` lucio
2008-11-21 10:56       ` Richard Miller
2008-11-21 10:59         ` lucio
2008-11-22  0:54 ` 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).