summaryrefslogtreecommitdiff
path: root/utils/cc/sub.c
diff options
context:
space:
mode:
authorforsyth <forsyth@lavoro.terzarima.net>2013-06-03 21:01:14 +0000
committerforsyth <forsyth@lavoro.terzarima.net>2013-06-03 21:01:14 +0000
commit45a20ab721a513710138340faff3d59a31c3e01e (patch)
treeeea29d2684c51cc73725b8992a2125bede48e118 /utils/cc/sub.c
parentcd8e99851af33e52bcdf8faf34f9d4e62fa0cbaf (diff)
sync compilers with Plan 9
remove 1[acl] 2[acl]
Diffstat (limited to 'utils/cc/sub.c')
-rw-r--r--utils/cc/sub.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/utils/cc/sub.c b/utils/cc/sub.c
index 46e0cada..441b0c7f 100644
--- a/utils/cc/sub.c
+++ b/utils/cc/sub.c
@@ -85,7 +85,10 @@ prtree1(Node *n, int d, int f)
break;
case OLSTRING:
- print(" \"%S\"", n->rstring);
+ if(sizeof(TRune) == sizeof(Rune))
+ print(" \"%S\"", (Rune*)n->rstring);
+ else
+ print(" \"...\"");
i = 0;
break;
@@ -914,6 +917,10 @@ loop:
case ONOT:
case OADDR:
case OIND:
+ case OCOM:
+ case ONEG:
+ case OPOS:
+ case OTST:
n = n->left;
goto loop;
@@ -1187,12 +1194,15 @@ warn(Node *n, char *fmt, ...)
char buf[STRINGSZ];
va_list arg;
- if(debug['w']) {
- Bprint(&diagbuf, "warning: ");
+ if(debug['w'] || debug['W']) {
va_start(arg, fmt);
vseprint(buf, buf+sizeof(buf), fmt, arg);
va_end(arg);
- Bprint(&diagbuf, "%L %s\n", (n==Z)? nearln: n->lineno, buf);
+ if(debug['W']) {
+ diag(n, "%s", buf);
+ return;
+ }
+ Bprint(&diagbuf, "warning: %L %s\n", (n==Z)? nearln: n->lineno, buf);
if(n != Z)
if(debug['v'])
@@ -1485,6 +1495,7 @@ Init onamesinit[] =
OINDEX, 0, "INDEX",
OFAS, 0, "FAS",
OREGPAIR, 0, "REGPAIR",
+ OEXREG, 0, "EXREG",
OEND, 0, "END",
-1, 0, 0,
};
@@ -1951,6 +1962,7 @@ tinit(void)
/* 32-bit defaults */
typeword = typechlp;
+ typeswitch = typechl;
typecmplx = typesuv;
}
@@ -2022,3 +2034,21 @@ mixedasop(Type *l, Type *r)
{
return !typefd[l->etype] && typefd[r->etype];
}
+
+
+/*
+ * (uvlong)~ul creates a ul mask with top bits zero, which is usually wrong
+ * an explicit cast to ulong after ~ suppresses the diagnostic
+ */
+int
+castucom(Node *r)
+{
+ Node *rl;
+
+ if(r->op == OCAST &&
+ (rl = r->left)->op == OCOM &&
+ (r->type->etype == TVLONG || r->type->etype == TUVLONG) &&
+ typeu[rl->type->etype] && typechl[rl->type->etype])
+ return 1;
+ return 0;
+}