Skip to content

Commit 56810ce

Browse files
tbybellgtkwave
andauthored
Unnamed scope fix for fstReader. (#10)
Co-authored-by: gtkwave <[email protected]>
1 parent 1d93e26 commit 56810ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/fstapi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3890,6 +3890,7 @@ struct fstHier *fstReaderIterateHier(fstReaderContext *xc)
38903890
fstHandle alias;
38913891
char *pnt;
38923892
int ch;
3893+
int unnamed_scope_idx = 0;
38933894

38943895
if (!xc)
38953896
return (NULL);
@@ -3921,6 +3922,9 @@ struct fstHier *fstReaderIterateHier(fstReaderContext *xc)
39213922
pnt[cl++] = ch;
39223923
}
39233924
}; /* scopename */
3925+
if (!cl) {
3926+
cl = snprintf(pnt, FST_ID_NAM_SIZ, "$unnamed_scope_%d", unnamed_scope_idx++);
3927+
}
39243928
pnt[cl] = 0;
39253929
xc->hier.u.scope.name_length = cl;
39263930

@@ -4059,6 +4063,7 @@ int fstReaderProcessHier(fstReaderContext *xc, FILE *fv)
40594063
uint64_t attrarg;
40604064
fstHandle maxhandle_scanbuild;
40614065
int cl;
4066+
int unnamed_scope_idx = 0;
40624067

40634068
if (!xc)
40644069
return (0);
@@ -4194,6 +4199,9 @@ int fstReaderProcessHier(fstReaderContext *xc, FILE *fv)
41944199
pnt[cl++] = ch;
41954200
}
41964201
}; /* scopename */
4202+
if (!cl) {
4203+
cl = snprintf(pnt, FST_ID_NAM_SIZ, "$unnamed_scope_%d", unnamed_scope_idx++);
4204+
}
41974205
pnt[cl] = 0;
41984206
while (fgetc(xc->fh)) {
41994207
}; /* scopecomp */

0 commit comments

Comments
 (0)