shithub: scc

Download patch

ref: ad37e51e277f84bb1985379d54f2974b3d35bc3a
parent: ab23974dffb7d6b6b73d65ef7c566e8b6abbd76b
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jul 5 05:40:15 EDT 2013

Fix bug detecting auto and register in file scope

auto and register are storage qualifiers that can be only applied
to local variables, so they must be defined in a higher context
than CTX_OUTER.

--- a/types.c
+++ b/types.c
@@ -191,7 +191,7 @@
 		tp->c_static = 1;
 		return tp;
 	case AUTO:
-		if (curctx != CTX_OUTER)
+		if (curctx == CTX_OUTER)
 			goto bad_file_scope_storage;
 		if (tp->c_typedef | tp->c_extern | tp->c_static | tp->c_reg)
 			goto two_storage;
@@ -200,7 +200,7 @@
 		tp->c_static = 1;
 		return tp;
 	case REGISTER:
-		if (curctx != CTX_OUTER)
+		if (curctx == CTX_OUTER)
 			goto bad_file_scope_storage;
 		if (tp->c_typedef | tp->c_extern | tp->c_auto | tp->c_static)
 			goto two_storage;
--