From 59c8e8e9079d17efc980690c4bbd5c5f256337f2 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 19 Nov 2024 17:12:03 +0900 Subject: [PATCH] [qfcc] Don't check for redefs of unnamed symbols Both glsl and spir-v need this for non-instanced interface blocks. --- tools/qfcc/source/target_spirv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/qfcc/source/target_spirv.c b/tools/qfcc/source/target_spirv.c index 4ede971fd..5f678fb47 100644 --- a/tools/qfcc/source/target_spirv.c +++ b/tools/qfcc/source/target_spirv.c @@ -1761,16 +1761,20 @@ spirv_declare_sym (specifier_t spec, const expr_t *init, symtab_t *symtab, expr_t *block) { symbol_t *sym = spec.sym; - symbol_t *check = symtab_lookup (symtab, sym->name); - if (check && check->table == symtab) { - error (0, "%s redefined", sym->name); + if (sym->name[0]) { + symbol_t *check = symtab_lookup (symtab, sym->name); + if (check && check->table == symtab) { + error (0, "%s redefined", sym->name); + } } auto storage = spirv_storage_class (spec.storage); sym->type = tagged_reference_type (storage, sym->type); sym->lvalue = !spec.is_const; sym->sy_type = sy_var; sym->var.storage = spec.storage; - symtab_addsymbol (symtab, sym); + if (sym->name[0]) { + symtab_addsymbol (symtab, sym); + } if (symtab->type == stab_local) { if (init) { if (!block && is_constexpr (init)) {