scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit b73e30e7049459fcb5e8d7035b5aa7a98b2d4023
parent e5a17bc05c4dbabbd910a9edb0651e4e79c97179
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Sun, 29 Mar 2026 21:20:26 +0200

cc1: Use static for global compound literals

They cannot be auto per definition.

Diffstat:
Msrc/cmd/scc-cc/cc1/expr.c | 2+-
Mtests/cc/execute/scc-tests.lst | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cmd/scc-cc/cc1/expr.c b/src/cmd/scc-cc/cc1/expr.c @@ -975,7 +975,7 @@ cast(void) Symbol *sym = newsym(NS_IDEN, NULL); sym->id = newid(); sym->type = tp; - sym->flags |= SAUTO; + sym->flags |= (curctx == GLOBALCTX) ? SPRIVATE : SAUTO; initializer(sym); return decay(varnode(sym)); diff --git a/tests/cc/execute/scc-tests.lst b/tests/cc/execute/scc-tests.lst @@ -154,8 +154,8 @@ 0161-struct.c 0162-array.c 0163-array.c -0164-struct.c [TODO] -0165-struct.c [TODO] +0164-struct.c +0165-struct.c 0166-desig.c [TODO] 0167-array.c 0168-array.c