From 597890dda154e8817bffa96bde0104dcbe7a6130 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 4 Mar 2020 16:32:04 +0900 Subject: [PATCH] [qfcc] Catch duplicate field definitions --- tools/qfcc/source/qc-parse.y | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 17316e79f..f0a2f5055 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -741,6 +741,9 @@ struct_decl $1->sy_type = sy_var; $1->visibility = current_visibility; symtab_addsymbol (current_symtab, $1); + if (!$1->table) { + error (0, "duplicate field `%s'", $1->name); + } } | var_decl { @@ -751,6 +754,9 @@ struct_decl $1->sy_type = sy_var; $1->visibility = current_visibility; symtab_addsymbol (current_symtab, $1); + if (!$1->table) { + error (0, "duplicate field `%s'", $1->name); + } } | var_decl ':' expr %prec COMMA {} | ':' expr %prec COMMA {}