ref: 24738fc266c6aefd6f9cdd21cdcd28e7757020bf
parent: 6ef69d3ee0b835e5aad1532e946977035de9c405
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu May 7 04:48:47 EDT 2015
Remove STRING token This token was totally useless because it is identical to CONSTANT. This patch also fix the type of the string. because it was char* while the correct type is an array of chars.
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -130,7 +130,6 @@
SHL_EQ,
SHR_EQ,
ELLIPSIS,
- STRING, /* TODO: remove this */
CASE,
DEFAULT,
IF,
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -457,7 +457,8 @@
Symbol *sym;
switch (yytoken) {
- case STRING: case CONSTANT: case IDEN:
+ case CONSTANT:
+ case IDEN:
if ((sym = yylval.sym) == NULL)
error("'%s' undeclared", yytext);
np = symbol(yylval.sym);
--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -181,9 +181,9 @@
*bp = '\0';
sym = install("", NS_IDEN);
sym->u.s = xstrdup(buf);
- sym->type = mktype(chartype, PTR, 0, NULL);
+ sym->type = mktype(chartype, ARY, (bp - buf) + 1, NULL);
yylval.sym = sym;
- return STRING;
+ return CONSTANT;
}
static uint8_t