Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[9fans] Porting GO LANG

30 views
Skip to first unread message

lu...@proxima.alt.za

unread,
Nov 20, 2009, 1:12:33 PM11/20/09
to
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.


Russ Cox

unread,
Nov 20, 2009, 2:19:23 PM11/20/09
to
On Fri, Nov 20, 2009 at 10:07 AM, <lu...@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

lu...@proxima.alt.za

unread,
Nov 20, 2009, 11:31:23 PM11/20/09
to
> 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


erik quanstrom

unread,
Nov 21, 2009, 11:13:26 AM11/21/09
to
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

0 new messages