From f17b176ddd4e3d88bc67ae81904d52557ded715a Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 27 Feb 1990 15:45:09 +0000 Subject: [PATCH] Fixed problem with anonymous structure tags --- lang/cem/cemcom/l_outdef.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lang/cem/cemcom/l_outdef.c b/lang/cem/cemcom/l_outdef.c index 6d2bc48b0..273e7e765 100644 --- a/lang/cem/cemcom/l_outdef.c +++ b/lang/cem/cemcom/l_outdef.c @@ -32,6 +32,7 @@ extern char *bts2str(); extern char *symbol2str(); +extern char *strindex(); int stat_number = 9999; /* static scope number */ struct outdef OutDef; @@ -433,7 +434,18 @@ outargtype(tp) case STRUCT: case UNION: case ENUM: - printf("%s %s", symbol2str(tp->tp_fund), tp->tp_idf->id_text); + /* watch out for anonymous identifiers; the count field does + not have to be the same for all compilation units. + Remove it, so that pass 2 does not see it. The only + problem with this is that pass2 will not see a difference + between two non-tagged types declared on the same line. + */ + printf("%s ", symbol2str(tp->tp_fund)); + if (is_anon_idf(tp->tp_idf)) { + /* skip the #, replace it by '#anonymous id' */ + printf("#anonymous id%s", strindex(tp->tp_idf->id_text, ' ')); + } + else printf(tp->tp_idf->id_text); break; case CHAR: -- 2.34.1