shithub: scc

Download patch

ref: eb8c10b2b2d7bfe987a2b00039ec4023bb54d1e6
parent: 0e5daaccd0f0a6e82b71ff2c85712ba0312526bc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jun 29 13:12:49 EDT 2012

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.

--- a/decl.c
+++ b/decl.c
@@ -68,12 +68,15 @@
 		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);
--- a/symbol.h
+++ b/symbol.h
@@ -38,6 +38,7 @@
 	bool c_reg : 1;
 	bool c_const : 1;
 	bool c_vol : 1;
+	bool c_unsigned : 1;
 	struct type *base;
 	unsigned char len;
 	char *iden;
--