9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Porting GO LANG
       [not found] <<1b73f2112d5c28d755e3b29552b17edb@proxima.alt.za>
@ 2009-11-21 16:08 ` erik quanstrom
  0 siblings, 0 replies; 4+ messages in thread
From: erik quanstrom @ 2009-11-21 16:08 UTC (permalink / raw)
  To: lucio, 9fans

it really isn't worth fighting.

/n/dump/2009/1120/sys/src/cmd/yacc.c:1918,1933 - yacc.c:1918,1940

  	/* i is the number of lines skipped */
  	i = 0;
- 	if(Bgetrune(finput) != '*')
- 		error("illegal comment");
  	c = Bgetrune(finput);
- 	while(c != Beof) {
- 		while(c == '*')
- 			if((c=Bgetrune(finput)) == '/')
- 				return i;
- 		if(c == '\n')
- 			i++;
+ 	if(c == '/'){
+ 		while((c = Bgetrune(finput)) != Beof)
+ 			if(c == '\n')
+ 				return 1;
+ 	}else{
+ 		if(c != '*')
+ 			error("illegal comment");
  		c = Bgetrune(finput);
+ 		while(c != Beof) {
+ 			while(c == '*')
+ 				if((c=Bgetrune(finput)) == '/')
+ 					return i;
+ 			if(c == '\n')
+ 				i++;
+ 			c = Bgetrune(finput);
+ 		}
  	}
  	error("EOF inside comment");
  	return 0;

and for 8a

/n/dump/2009/1120/sys/src/cmd/cc/lexbody:418,425 - /sys/src/cmd/cc/lexbody:418,424
  			for(;;) {
  				c = GETC();
  				if(c == '\n') {
- 					lineno++;
- 					goto l0;
+ 					goto l1;		/* return ; for ?a's benefit. */
  				}
  				if(c == EOF) {
  					yyerror("eof in comment");

- erik



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

* Re: [9fans] Porting GO LANG
  2009-11-20 19:16 ` Russ Cox
@ 2009-11-21  4:26   ` lucio
  0 siblings, 0 replies; 4+ messages in thread
From: lucio @ 2009-11-21  4:26 UTC (permalink / raw)
  To: 9fans

> It's just a bug left over from when convlit and convlit1
> did return things.  Gcc apparently lets you do this.

Worked a treat.  Thank you.

++L




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

* Re: [9fans] Porting GO LANG
  2009-11-20 18:07 lucio
@ 2009-11-20 19:16 ` Russ Cox
  2009-11-21  4:26   ` lucio
  0 siblings, 1 reply; 4+ messages in thread
From: Russ Cox @ 2009-11-20 19:16 UTC (permalink / raw)
  To: lucio, Fans of the OS Plan 9 from Bell Labs

On Fri, Nov 20, 2009 at 10:07 AM,  <lucio@proxima.alt.za> wrote:
> From the Go compiler sources (cmd/gc/const.c:51...):
>
>        /*
>         * convert n, if literal, to type t.
>         * implicit conversion.
>         */
>        void
>        convlit(Node **np, Type *t)
>        {
>                return convlit1(np, t, 0);
>        }
>
>        /*
>         * convert n, if literal, to type t.
>         * return a new node if necessary
>         * (if n is a named constant, can't edit n->type directly).
>         */
>        void
>        convlit1(Node **np, Type *t, int explicit)
>        {
>                int ct, et;
>                Node *n, *nn;
>        ...
>
> There's got to be a return type for both of these that actually makes
> sense?  As it stands, the Plan 9 native C compiler objects.

s/return //

It's just a bug left over from when convlit and convlit1
did return things.  Gcc apparently lets you do this.

Russ


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

* [9fans] Porting GO LANG
@ 2009-11-20 18:07 lucio
  2009-11-20 19:16 ` Russ Cox
  0 siblings, 1 reply; 4+ messages in thread
From: lucio @ 2009-11-20 18:07 UTC (permalink / raw)
  To: 9fans

>From the Go compiler sources (cmd/gc/const.c:51...):

	/*
	 * convert n, if literal, to type t.
	 * implicit conversion.
	 */
	void
	convlit(Node **np, Type *t)
	{
		return convlit1(np, t, 0);
	}

	/*
	 * convert n, if literal, to type t.
	 * return a new node if necessary
	 * (if n is a named constant, can't edit n->type directly).
	 */
	void
	convlit1(Node **np, Type *t, int explicit)
	{
		int ct, et;
		Node *n, *nn;
	...

There's got to be a return type for both of these that actually makes
sense?  As it stands, the Plan 9 native C compiler objects.

++L

PS: Plan 9 yacc objects to C++-type comments (//), I'm happy to submit
a patch that fixes this incompatibility.




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

end of thread, other threads:[~2009-11-21 16:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <<1b73f2112d5c28d755e3b29552b17edb@proxima.alt.za>
2009-11-21 16:08 ` [9fans] Porting GO LANG erik quanstrom
2009-11-20 18:07 lucio
2009-11-20 19:16 ` Russ Cox
2009-11-21  4:26   ` lucio

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