commit ad37e51e277f84bb1985379d54f2974b3d35bc3a
parent ab23974dffb7d6b6b73d65ef7c566e8b6abbd76b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 5 Jul 2013 09:40:15 +0200
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.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/types.c b/types.c
@@ -191,7 +191,7 @@ storage(register struct ctype *tp, unsigned char mod)
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 @@ storage(register struct ctype *tp, unsigned char mod)
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;