From 1d7ada091876552e74083be37a50c23fa2166f2c Mon Sep 17 00:00:00 2001 From: gtkwave Date: Thu, 27 Mar 2025 16:32:19 -0400 Subject: [PATCH] Unnamed scope fix for fstReader. --- src/fstapi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fstapi.c b/src/fstapi.c index 70e86d9..197b907 100644 --- a/src/fstapi.c +++ b/src/fstapi.c @@ -3890,6 +3890,7 @@ struct fstHier *fstReaderIterateHier(fstReaderContext *xc) fstHandle alias; char *pnt; int ch; + int unnamed_scope_idx = 0; if (!xc) return (NULL); @@ -3921,6 +3922,9 @@ struct fstHier *fstReaderIterateHier(fstReaderContext *xc) pnt[cl++] = ch; } }; /* scopename */ + if (!cl) { + cl = snprintf(pnt, FST_ID_NAM_SIZ, "$unnamed_scope_%d", unnamed_scope_idx++); + } pnt[cl] = 0; xc->hier.u.scope.name_length = cl; @@ -4059,6 +4063,7 @@ int fstReaderProcessHier(fstReaderContext *xc, FILE *fv) uint64_t attrarg; fstHandle maxhandle_scanbuild; int cl; + int unnamed_scope_idx = 0; if (!xc) return (0); @@ -4194,6 +4199,9 @@ int fstReaderProcessHier(fstReaderContext *xc, FILE *fv) pnt[cl++] = ch; } }; /* scopename */ + if (!cl) { + cl = snprintf(pnt, FST_ID_NAM_SIZ, "$unnamed_scope_%d", unnamed_scope_idx++); + } pnt[cl] = 0; while (fgetc(xc->fh)) { }; /* scopecomp */