From 7bd775a7d8c4d74ce075ba3bb399c5dbff08b325 Mon Sep 17 00:00:00 2001 From: DGA45 <59612603+DGA45@users.noreply.github.com> Date: Mon, 3 Feb 2020 15:01:36 +0100 Subject: Fix #7556 ANSI-C anonymous (unnamed) struct/unions duplicated names Fix ANSI-C anonymous (unnamed) struct/unions duplicated names issue --- src/doxygen.cpp | 3 ++- src/perlmodgen.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 6388ce3..957c3ae 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1389,7 +1389,8 @@ static void processTagLessClasses(ClassDef *rootCd, if (type.find(icd->name())!=-1) // matching tag less struct/union { QCString name = md->name(); - if (md->isAnonymous()) name = "__unnamed__"; + /* DGA fix #7556 ANSI-C anonymous (unnamed) struct/unions have duplicated names (__unnamed__) */ + if (md->isAnonymous()) name = "__unnamed__" + name.right(name.length()-1); /* DGA: ensure unique name */ if (!prefix.isEmpty()) name.prepend(prefix+"."); //printf(" found %s for class %s\n",name.data(),cd->name().data()); ClassDef *ncd = createTagLessInstance(rootCd,icd,name); diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index 4ecee5e..7da71ce 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -1573,6 +1573,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini // (templateArguments(), definitionTemplateParameterLists()) QCString memType; + QCString name; bool isFunc=FALSE; switch (md->memberType()) { @@ -1594,9 +1595,13 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini case MemberType_Dictionary: memType="dictionary"; break; } + /* DGA fix #7556 ANSI-C anonymous (unnamed) struct/unions have duplicated names (__unnamed__) */ + name = md->name(); + if (md->isAnonymous()) name = "__unnamed__" + name.right(name.length() - 1); /* DGA: ensure unique name */ + m_output.openHash() .addFieldQuotedString("kind", memType) - .addFieldQuotedString("name", md->name()) + .addFieldQuotedString("name", name) .addFieldQuotedString("virtualness", getVirtualnessName(md->virtualness())) .addFieldQuotedString("protection", getProtectionName(md->protection())) .addFieldBoolean("static", md->isStatic()); -- cgit v0.12 From d75a287f2c5fc37cde07006bec7d027453d9827b Mon Sep 17 00:00:00 2001 From: DGA45 <59612603+DGA45@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:46:13 +0100 Subject: Fix issue #7547 --- src/perlmodgen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index eceff59..f6b5071 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -1835,6 +1835,8 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) m_output.openHash() .addFieldQuotedString("name", cd->name()); + /* DGA: fix # #7547 Perlmod does not generate "kind" information to discriminate struct/union */ + m_output.addFieldQuotedString("kind", cd->compoundTypeString()); if (cd->baseClasses()) { -- cgit v0.12