From 453d276f20c193a6b92a6e2d8636ace108d21dde Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 14 Jan 2022 11:07:08 -0500 Subject: [PATCH] Cleaned up a bit of confusing diagnostic output when reading GDS. If cells are instanced before being defined, causing the GDS parser to rewind the cell from the top, then the "already defined" error messages will be suppressed, since it is to be expected that cells will be seen twice (and ignored the 2nd time). When rewinding, an output message is issued so that it is clear that the file contains instances that are used before they are defined, and recommends the "gds ordering on" setting. Also: Fixed the "gds ordering" command code so that the command with no third argument returns the state of the "gds ordering" setting instead of generating a parser error. --- VERSION | 2 +- calma/CalmaRdcl.c | 7 ++++++- commands/CmdCD.c | 2 +- ext2spice/ext2spice.c | 5 +++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index c1d9d424..8442fba6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.256 +8.3.257 diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 4ec872b5..7a45a437 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -49,6 +49,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ int calmaNonManhattan; int CalmaFlattenLimit = 10; int NameConvertErrors = 0; +bool CalmaRewound = FALSE; extern HashTable calmaDefInitHash; @@ -141,7 +142,11 @@ calmaSetPosition(sname) if (originalPos != 0) { rewind(calmaInputFile); + CalmaRewound = TRUE; calmaSetPosition(sname); + if (!CalmaPostOrder) + CalmaReadError("Rewinding input. Cells may have been instanced before " + "they were defined. Consider using \"gds ordering on\".\n"); return originalPos; } @@ -330,7 +335,7 @@ calmaParseStructure(filename) /* However, if post-ordering is set, then this cell was */ /* probably just read earlier, so don't gripe about it. */ - if (!CalmaPostOrder) + if (!CalmaPostOrder && !CalmaRewound) { CalmaReadError("Cell \"%s\" was already defined in this file.\n", strname); diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 0d28007e..f9936f49 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -485,8 +485,8 @@ CmdCalma(w, cmd) else TxPrintf("GDS parser reads cells in the order " "encountered in the stream file.\n"); - return; #endif + return; } else if (cmd->tx_argc != 3) goto wrongNumArgs; diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index de858de2..3ed31e10 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -1798,9 +1798,10 @@ topVisit(def, doStub) * and should be removed from the port list. */ if (def->def_flags & DEF_ABSTRACT) - heh = HashLookOnly(&efNodeHashTable, nodeName->efnn_hier); + heh = HashLookOnly(&efNodeHashTable, (char *)nodeName->efnn_hier); else - heh = HashLookOnly(&efNodeHashTable, snode->efnode_name->efnn_hier); + heh = HashLookOnly(&efNodeHashTable, + (char *)snode->efnode_name->efnn_hier); if (heh == (HashEntry *)NULL) { /* Port was optimized out */