gc/bits.c
. improved format with associated cast;
gc/closure.c
gc/dcl.c
gc/range.c
gc/reflect.c
gc/sinit.c
. dropped unnecessary assignments;
gc/gen.c
. dropped unnecessary assignment;
. added static qualifier to local function definition;
gc/go.h
. added varargck pragmas;
gc/lex.c
. used {} instead of ; in if statement to suppress warning;
. replaced exit(0) with exits(0);
. added compilation conditions for SIGBUS/SIGSEGV;
. dropped unnecessary assignment;
gc/mparith2.c
. dropped four unnecessary assignments/initialisations;
gc/obj.c
. added type cast to local pointer;
gc/pgen.c
. added cast and related print format;
gc/subr.c
. replaced exit(1) with exits("error");
. replaced unlink() with remove();
. renamed local cistrmp() as ucistrmp() to remove conflict with
Plan 9 function by the same name;
gc/swt.c
. added braces instead of ; as empty statment;
gc/typecheck.c
. added static qualifier to local function definition;
. dropped unnecessary assignments;
gc/walk.c
. dropped unnecessary assignments;
. added static qualifier to local function definitions;
R=rsc
CC=golang-dev
https://golang.org/cl/
4964046
else {
fmtprint(fp, var[i].sym->name);
if(var[i].offset != 0)
- fmtprint(fp, "%+d", var[i].offset);
+ fmtprint(fp, "%+lld", (vlong)var[i].offset);
}
bits.b[i/32] &= ~(1L << (i%32));
}
body = list1(nod(OEMPTY, N, N));
func = curfn;
- l = func->dcl;
func->nbody = body;
funcbody(func);
for(; l; l=l->next) {
n = l->n;
lineno = n->lineno;
- note = nil;
if(n->op != ODCLFIELD)
fatal("stotype: oops %N\n", n);
Type *f, *d, *pa;
Node *n;
- pa = nil;
-
// get field sym
if(sf == S)
fatal("no method symbol");
if(n == N)
goto ret;
- p3 = pc; // save pc for loop labels
if(n->ninit)
genlist(n->ninit);
/*
* generate code to start new proc running call n.
*/
-void
+static void
cgen_proc(Node *n, int proc)
{
switch(n->left->op) {
void data(void);
void text(void);
+#pragma varargck type "A" int
+#pragma varargck type "B" Mpint*
+#pragma varargck type "D" Addr*
+#pragma varargck type "lD" Addr*
+#pragma varargck type "E" int
+#pragma varargck type "F" Mpflt*
+#pragma varargck type "J" Node*
+#pragma varargck type "L" int
+#pragma varargck type "L" uint
+#pragma varargck type "N" Node*
+#pragma varargck type "O" uint
+#pragma varargck type "P" Prog*
+#pragma varargck type "Q" Bits
+#pragma varargck type "R" int
+#pragma varargck type "S" Sym*
+#pragma varargck type "lS" Sym*
+#pragma varargck type "T" Type*
+#pragma varargck type "lT" Type*
+#pragma varargck type "Y" char*
+#pragma varargck type "Z" Strlit*
#define isalpha use_yy_isalpha_instead_of_isalpha
#define isalnum use_yy_isalnum_instead_of_isalnum
-#define DBG if(!debug['x']);else print
+#define DBG if(!debug['x']){}else print
enum
{
EOF = -1,
print(" -u disable package unsafe\n");
print(" -w print the parse tree after typing\n");
print(" -x print lex tokens\n");
- exit(0);
+ exits(0);
}
void
int i, c;
NodeList *l;
char *p;
-
+
+#ifdef SIGBUS
signal(SIGBUS, fault);
signal(SIGSEGV, fault);
+#endif
localpkg = mkpkg(strlit(""));
localpkg->prefix = "\"\"";
case 'V':
print("%cg version %s\n", thechar, getgoversion());
- exit(0);
+ exits(0);
} ARGEND
if(argc < 1)
errorexit();
flusherrors();
- exit(0);
+ exits(0);
return 0;
}
ep = lexbuf+sizeof lexbuf;
*cp++ = c;
c = c1;
- c1 = 0;
goto casedot;
}
if(c1 == '.') {
return s->lexical;
tnum:
- c1 = 0;
cp = lexbuf;
ep = lexbuf+sizeof lexbuf;
if(c != '0') {
int i;
long x, *a1, *b1;
+ x = 0;
if(a->ovf || b->ovf) {
yyerror("ovf in mporfixfix");
mpmovecfix(a, 0);
int i;
long x, *a1, *b1;
+ x = 0;
if(a->ovf || b->ovf) {
yyerror("ovf in mpandfixfix");
mpmovecfix(a, 0);
int i;
long x, *a1, *b1;
+ x = 0;
if(a->ovf || b->ovf) {
yyerror("ovf in mpandnotfixfix");
mpmovecfix(a, 0);
int i;
long x, *a1, *b1;
+ x = 0;
if(a->ovf || b->ovf) {
yyerror("ovf in mporfixfix");
mpmovecfix(a, 0);
tmp.lit.len = len;
memmove(tmp.lit.s, s, len);
tmp.lit.s[len] = '\0';
- snprint(namebuf, sizeof(namebuf), "\"%Z\"", &tmp);
+ snprint(namebuf, sizeof(namebuf), "\"%Z\"", &tmp.lit);
pkg = gostringpkg;
}
sym = pkglookup(namebuf, pkg);
oldstksize = stksize;
compactframe(ptxt);
if(0)
- print("compactframe: %ld to %ld\n", oldstksize, stksize);
+ print("compactframe: %lld to %lld\n", oldstksize, (vlong)stksize);
defframe(ptxt);
}
v1 = n->list->n;
- hv1 = N;
-
v2 = N;
if(n->list->next)
v2 = n->list->next->n;
dowidth(t);
- sptr = nil;
if(t->sym != nil && !isptr[t->etype])
sptr = dtypesym(ptrto(t));
else
Node *vstat, *index, *value;
Sym *syma, *symb;
+USED(ctxt);
ctxt = 0;
// make the map var
b++;
}
- t = T;
if(b != 0) {
// build type [count]struct { a Tindex, b Tvalue }
t = n->type;
flusherrors();
if(outfile)
remove(outfile);
- exit(1);
+ exits("error");
}
extern int yychar;
if(debug['h']) {
flusherrors();
if(outfile)
- unlink(outfile);
+ remove(outfile);
*(volatile int*)0 = 0;
}
}
maxarg = w;
}
-/* unicode-aware case-insensitive strcmp */
+/*
+ * unicode-aware case-insensitive strcmp
+ */
static int
-cistrcmp(char *p, char *q)
+ucistrcmp(char *p, char *q)
{
Rune rp, rq;
c = 0;
if(u->etype == TSTRUCT || u->etype == TINTER) {
for(f=u->type; f!=T; f=f->down)
- if(f->sym == s || (ignorecase && cistrcmp(f->sym->name, s->name) == 0)) {
+ if(f->sym == s || (ignorecase && ucistrcmp(f->sym->name, s->name) == 0)) {
if(save)
*save = f;
c++;
u = methtype(t);
if(u != T) {
for(f=u->method; f!=T; f=f->down)
- if(f->embedded == 0 && (f->sym == s || (ignorecase && cistrcmp(f->sym->name, s->name) == 0))) {
+ if(f->embedded == 0 && (f->sym == s || (ignorecase && ucistrcmp(f->sym->name, s->name) == 0))) {
if(save)
*save = f;
c++;
yyerror("case %+N in %T switch", ll->n, t);
break;
case Etype: // type switch
- if(ll->n->op == OLITERAL && istype(ll->n->type, TNIL))
+ if(ll->n->op == OLITERAL && istype(ll->n->type, TNIL)) {
;
- else if(ll->n->op != OTYPE && ll->n->type != T) {
+ } else if(ll->n->op != OTYPE && ll->n->type != T) {
yyerror("%#N is not a type", ll->n);
// reset to original type
ll->n = n->ntest->right;
/*
* resolve ONONAME to definition, if any.
*/
-Node*
+static Node*
resolve(Node *n)
{
Node *r;
}
defaultlit(&n->right, t->type);
r = n->right;
- if((t = r->type) == T)
+ if(r->type == T)
goto error;
r = assignconv(r, l->type->type, "send");
// TODO: more aggressive
goto error;
if((n->op = convertop(t, n->type, &why)) == 0) {
yyerror("cannot convert %+N to type %T%s", n->left, n->type, why);
- op = OCONV;
+ n->op = OCONV;
}
switch(n->op) {
case OCONVNOP:
{
Node *f1, *f2;
- for(f1=f2=n; ; n=n->ntype) {
+ for(f2=n; ; n=n->ntype) {
if((n = resolve(n)) == N || n->op != OTYPE)
return T;
fatal("missed typecheck");
}
- t = T;
- et = Txxx;
-
switch(n->op) {
default:
dump("walk", n);
fatal("walkexpr: switch 1 unknown op %N", n);
- goto ret;
+ break;
case OTYPE:
case ONONAME:
fmtstrinit(&fmt);
fmtprint(&fmt, "\t");
- l = structfirst(&savel, nl);
first = 1;
for(l = structfirst(&savel, nl); l != T; l = structnext(&savel)) {
if(first)
* then it is done first. otherwise must
* make temp variables
*/
-NodeList*
+static NodeList*
reorder1(NodeList *all)
{
Node *f, *a, *n;
return 0;
}
-NodeList*
+static NodeList*
reorder3(NodeList *all)
{
Node *n1, *n2, *q;