From 2992d66f877935dfdd771db2c5c9dcd23e71f79f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 4 Mar 2011 13:52:32 +0900 Subject: [PATCH] Simplify the tag used for anonymous structs etc. Hopefully two files with the same file name won't have anonymous stucts on the same line. --- tools/qfcc/source/struct.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/qfcc/source/struct.c b/tools/qfcc/source/struct.c index b09d42587..a8d7d93eb 100644 --- a/tools/qfcc/source/struct.c +++ b/tools/qfcc/source/struct.c @@ -69,13 +69,16 @@ find_tag (ty_type_e ty, symbol_t *tag, type_t *type) { const char *tag_name; symbol_t *sym; - static int tag_num; - if (tag) + if (tag) { tag_name = va ("tag %s", tag->name); - else - tag_name = va ("tag .%s.%d.%d", - GETSTR (pr.source_file), pr.source_line, tag_num++); + } else { + const char *path = GETSTR (pr.source_file); + const char *file = strrchr (path, '/'); + if (!file++) + file = path; + tag_name = va ("tag .%s.%d", file, pr.source_line); + } sym = symtab_lookup (current_symtab, tag_name); if (sym) { if (sym->table == current_symtab && sym->type->ty != ty)