commit eb8c10b2b2d7bfe987a2b00039ec4023bb54d1e6
parent 0e5daaccd0f0a6e82b71ff2c85712ba0312526bc
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 29 Jun 2012 17:12:49 +0200
Added signed and unsigned handling in parser
We were not storing information about the sign in any place. This patch adds
a new field in ctype for this function.
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/decl.c b/decl.c
@@ -68,12 +68,15 @@ static unsigned char spec(register struct ctype *cp)
case REGISTER: case CONST: case VOLATILE:
ctype(cp, yytoken);
break;
- case UNSIGNED: case SIGNED:
+ case UNSIGNED:
+ cp->c_unsigned = 1;
+ case SIGNED:
if (sign == yytoken)
goto duplicated;
if (sign)
goto signed_and_unsigned;
sign = yytoken;
+ break;
case VOID: case CHAR: case SHORT: case INT: case FLOAT:
case DOUBLE: case LONG: case BOOL:
cp->base = btype(cp->base, yytoken);
diff --git a/symbol.h b/symbol.h
@@ -38,6 +38,7 @@ struct ctype {
bool c_reg : 1;
bool c_const : 1;
bool c_vol : 1;
+ bool c_unsigned : 1;
struct type *base;
unsigned char len;
char *iden;