From fe7cd7e7a78652ffb3ed0053cb5b8e6b6a06f2d1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 18 Dec 2012 13:52:02 +0900 Subject: [PATCH] Catch omitted parameter names from function definitions. void foo (int); is fine for a prototype (or, presumably, a qc function variable), but not for an actual function body. This fixes the segmentation fault when the parameter name is omitted. --- tools/qfcc/source/function.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index 565e1e4d9..2d38a1442 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -466,6 +466,10 @@ build_scope (symbol_t *fsym, symtab_t *parent) continue; // ellipsis marker if (!p->type) continue; // non-param selector + if (!p->name) { + error (0, "parameter name omitted"); + p->name = save_string (""); + } param = new_symbol_type (p->name, p->type); initialize_def (param, param->type, 0, symtab->space, sc_param); i++;