summaryrefslogtreecommitdiff
path: root/utils/cc/lex.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/lex.c
parentcd8e99851af33e52bcdf8faf34f9d4e62fa0cbaf (diff)
sync compilers with Plan 9
remove 1[acl] 2[acl]
Diffstat (limited to 'utils/cc/lex.c')
-rw-r--r--utils/cc/lex.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/utils/cc/lex.c b/utils/cc/lex.c
index 8ba5af5a..9aae5c2b 100644
--- a/utils/cc/lex.c
+++ b/utils/cc/lex.c
@@ -80,7 +80,8 @@ main(int argc, char *argv[])
case 'I':
p = ARGF();
- setinclude(p);
+ if(p)
+ setinclude(p);
break;
} ARGEND
if(argc < 1 && outfile == 0) {
@@ -242,14 +243,10 @@ compile(char *file, char **defs, int ndef)
close(fd[1]);
av[0] = CPP;
i = 1;
- if(debug['.']){
- sprint(opt, "-.");
- av[i++] = strdup(opt);
- }
- if(debug['+']) {
- sprint(opt, "-+");
- av[i++] = strdup(opt);
- }
+ if(debug['.'])
+ av[i++] = strdup("-.");
+ /* 1999 ANSI C requires recognising // comments */
+ av[i++] = strdup("-+");
for(c = 0; c < ndef; c++) {
sprint(opt, "-D%s", defs[c]);
av[i++] = strdup(opt);
@@ -469,7 +466,7 @@ l1:
yyerror("missing '");
peekc = c1;
}
- yylval.vval = convvtox(c, TUSHORT);
+ yylval.vval = convvtox(c, TRUNE);
return LUCONST;
}
if(c == '"') {
@@ -543,15 +540,15 @@ l1:
c = escchar('"', 1, 0);
if(c == EOF)
break;
- cp = allocn(cp, c1, sizeof(ushort));
- *(ushort*)(cp + c1) = c;
- c1 += sizeof(ushort);
+ cp = allocn(cp, c1, sizeof(TRune));
+ *(TRune*)(cp + c1) = c;
+ c1 += sizeof(TRune);
}
yylval.sval.l = c1;
do {
- cp = allocn(cp, c1, sizeof(ushort));
- *(ushort*)(cp + c1) = 0;
- c1 += sizeof(ushort);
+ cp = allocn(cp, c1, sizeof(TRune));
+ *(TRune*)(cp + c1) = 0;
+ c1 += sizeof(TRune);
} while(c1 & MAXALIGN);
yylval.sval.s = cp;
return LLSTRING;
@@ -1028,7 +1025,7 @@ getnsc(void)
} else
c = GETC();
for(;;) {
- if(!isspace(c))
+ if(c >= Runeself || !isspace(c))
return c;
if(c == '\n') {
lineno++;
@@ -1072,7 +1069,7 @@ loop:
*/
i = 2;
if(longflg)
- i = 4;
+ i = 6;
l = 0;
for(; i>0; i--) {
c = getc();
@@ -1102,7 +1099,7 @@ loop:
*/
i = 2;
if(longflg)
- i = 5;
+ i = 8;
l = c - '0';
for(; i>0; i--) {
c = getc();
@@ -1238,7 +1235,7 @@ cinit(void)
if(mygetwd(pathname, 99) == 0) {
pathname = allocn(pathname, 100, 900);
if(mygetwd(pathname, 999) == 0)
- strcpy(pathname, "/???");
+ strcpy(pathname, "/?");
}
fmtinstall('O', Oconv);