From cf5fd867f4e794b41fb06c66b00969e6d1dcb178 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 24 May 2024 12:43:36 -0400 Subject: [PATCH 001/206] Corrected another error related to read-only views in which magic crashes when attempting to place a generated cell in the layout, as pointed out by Mark Martin in github Issue #309. --- VERSION | 2 +- database/DBcellname.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 97d9b26a..58371726 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.483 +8.3.484 diff --git a/database/DBcellname.c b/database/DBcellname.c index 490c8942..589cb72f 100644 --- a/database/DBcellname.c +++ b/database/DBcellname.c @@ -1121,11 +1121,13 @@ DBUsePrint(CellName, who, dolist) celldef = DBCellLookDef(CellName); *lasthier = '/'; } - else + else if (EditCellUse != NULL) { /* Referenced cellDef is the current edit def */ celldef = EditCellUse->cu_def; } + else + return; switch (who) { From e9db9ecbc9943a304de80b32ecc58a61a46cc91f Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 25 May 2024 21:15:01 -0400 Subject: [PATCH 002/206] Another correction that avoids a crash condition when attempting to do an instance array resizing on an uneditable cell. --- VERSION | 2 +- database/DBcellcopy.c | 3 ++- select/selCreate.c | 13 ++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 58371726..9734220e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.484 +8.3.485 diff --git a/database/DBcellcopy.c b/database/DBcellcopy.c index ebfd15dd..d103ce38 100644 --- a/database/DBcellcopy.c +++ b/database/DBcellcopy.c @@ -1725,7 +1725,8 @@ DBCellCopyAllCells(scx, xMask, targetUse, pArea) /* dbCellCopyCellsFunc() allows cells to be left with duplicate IDs */ /* so generate unique IDs as needed now. */ - DBGenerateUniqueIds(targetUse->cu_def, FALSE); + + if (targetUse != NULL) DBGenerateUniqueIds(targetUse->cu_def, FALSE); } /* diff --git a/select/selCreate.c b/select/selCreate.c index dff8707e..a8a3b903 100644 --- a/select/selCreate.c +++ b/select/selCreate.c @@ -1247,11 +1247,14 @@ SelectAndCopy2(newSourceDef) (void) DBCellCopyAllCells(&scx, CU_DESCEND_SPECIAL, EditCellUse, (Rect *) NULL); GeoTransRect(&scx.scx_trans, &scx.scx_area, &editArea); - DBAdjustLabels(EditCellUse->cu_def, &editArea); - DBWAreaChanged(EditCellUse->cu_def, &editArea, DBW_ALLWINDOWS, - (TileTypeBitMask *) NULL); - DRCCheckThis(EditCellUse->cu_def, TT_CHECKPAINT, &editArea); - DBReComputeBbox(EditCellUse->cu_def); + if (EditCellUse != NULL) + { + DBAdjustLabels(EditCellUse->cu_def, &editArea); + DBWAreaChanged(EditCellUse->cu_def, &editArea, DBW_ALLWINDOWS, + (TileTypeBitMask *) NULL); + DRCCheckThis(EditCellUse->cu_def, TT_CHECKPAINT, &editArea); + DBReComputeBbox(EditCellUse->cu_def); + } SelectRootDef = newSourceDef; SelSetDisplay(SelectUse, SelectRootDef); From 81b5ac20797d64d262b905e324cc401d01f58d57 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 13 Jun 2024 15:39:27 -0400 Subject: [PATCH 003/206] Added two checks when loading a file to determine if two cells are the same: (1) If the inodes of the filename are the same, then the cells are the same. This avoids treating symbolic links as different paths with different files; (2) If both layouts are in git repositories and the git repository commit hashes are the same, then the cells are considered to be the same. This allows projects to be cloned into other projects as dependencies and used in multiple places without magic treating them as different layouts. --- VERSION | 2 +- database/DBio.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9734220e..5c84de62 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.485 +8.3.486 diff --git a/database/DBio.c b/database/DBio.c index 9635220f..a594764c 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -28,6 +28,8 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include +#include #ifdef HAVE_DIRENT_H #include @@ -1973,6 +1975,121 @@ badTransform: } else if (!strcmp(cwddir, pathptr)) pathOK = TRUE; + /* Apply same check as done in DBWprocs, which is to check the + * inode of the two files and declare the path okay if they are + * the same. This avoids conflicts in files that are referenced + * from two different places via different relative paths, or + * through symbolic links. + */ + + if ((pathOK == FALSE) && strcmp(subCellDef->cd_file, pathptr) + && (dereference == FALSE) && (firstUse == TRUE)) + { + struct stat statbuf; + ino_t inode; + + if (stat(subCellDef->cd_file, &statbuf) == 0) + { + inode = statbuf.st_ino; + + if (stat(pathptr, &statbuf) == 0) + { + if (inode == statbuf.st_ino) + pathOK = TRUE; + } + } + } + + if ((pathOK == FALSE) && strcmp(subCellDef->cd_file, pathptr) + && (dereference == FALSE) && (firstUse == TRUE)) + { + /* See if both paths are inside a git repository, and both + * git repositories have the same commit hash. Then the + * two layouts can be considered equivalent. If the "git" + * command fails for any reason, then ignore the error and + * continue. + */ + char *sl1ptr, *sl2ptr; + int link[2], nbytes, status; + pid_t pid; + char githash1[128]; + char githash2[128]; + char argstr[1024]; + + githash1[0] = '\0'; + + /* Remove the file component */ + sl1ptr = strrchr(pathptr, '/'); + if (sl1ptr != NULL) *sl1ptr = '\0'; + + /* Check first file for a git hash */ + if (pipe(link) != -1) + { + FORK(pid); + if (pid == 0) + { + dup2(link[1], STDOUT_FILENO); + close(link[0]); + close(link[1]); + sprintf(argstr, "-C %s", pathptr); + execlp("git", argstr, "rev-parse", "HEAD", NULL); + _exit(122); /* see vfork man page for reason for _exit() */ + } + else + { + close(link[1]); + nbytes = read(link[0], githash1, sizeof(githash1)); + waitpid(pid, &status, 0); + } + } + + if (sl1ptr != NULL) *sl1ptr = '/'; + + if (githash1[0] != '\0') + { + /* Check the second repository */ + + /* Remove the file component */ + sl2ptr = strrchr(subCellDef->cd_file, '/'); + if (sl2ptr != NULL) *sl2ptr = '\0'; + + /* Check first file for a git hash */ + if (pipe(link) != -1) + { + FORK(pid); + if (pid == 0) + { + dup2(link[1], STDOUT_FILENO); + close(link[0]); + close(link[1]); + sprintf(argstr, "-C %s", subCellDef->cd_file); + execlp("git", argstr, "rev-parse", "HEAD", NULL); + _exit(123); /* see vfork man page for reason for _exit() */ + } + else + { + close(link[1]); + nbytes = read(link[0], githash2, sizeof(githash2)); + waitpid(pid, &status, 0); + } + } + + if (sl2ptr != NULL) *sl2ptr = '/'; + + if (githash2[0] != '\0') + { + /* Check if the repositories have the same hash */ + if (!strcmp(githash1, githash2)) + { + TxPrintf("Cells %s in %s and %s have matching git repository" + " commits and can be considered equivalent.\n", + slashptr + 1, subCellDef->cd_file, pathptr); + pathOK = TRUE; + } + } + } + } + if ((pathOK == FALSE) && strcmp(subCellDef->cd_file, pathptr) && (dereference == FALSE) && (firstUse == TRUE)) { From b441d668bd11e261a61c999c6c5ab55ffcc0da5f Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 3 Aug 2024 12:05:41 -0400 Subject: [PATCH 004/206] Corrected the "property" command parsing, which had a print statement without an argument, resulting in random things getting printed to the output when a property name does not exist. --- commands/CmdCD.c | 2 +- commands/CmdLQ.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/CmdCD.c b/commands/CmdCD.c index edd80361..3f11aa62 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -1296,7 +1296,7 @@ CmdCellname(w, cmd) if (cellDef == (CellDef *) NULL) TxError("Unknown cell %s\n", cellname); else - CmdDoProperty(cellDef, cmd, 3 + ((dolist) ? 1 : 0)); + CmdDoProperty(cellDef, cmd, 2 + ((dolist) ? 1 : 0)); break; case IDX_DELETE: diff --git a/commands/CmdLQ.c b/commands/CmdLQ.c index 283d2381..bdd0e9d1 100644 --- a/commands/CmdLQ.c +++ b/commands/CmdLQ.c @@ -2326,6 +2326,7 @@ CmdDoProperty(def, cmd, argstart) /* print all properties and their values */ DBPropEnum(def, printPropertiesFunc); } + else if (locargc == 2) { /* print the value of the indicated property */ @@ -2342,7 +2343,7 @@ CmdDoProperty(def, cmd, argstart) /* just return NULL if the property was not found. */ if (strcmp(cmd->tx_argv[1], "list")) #endif - TxError("Property name %s is not defined\n"); + TxError("Property name \"%s\" is not defined\n", cmd->tx_argv[1]); } } else if (locargc == 3) From 155f19a6d8cc6fffb5c39b26b5c4c24f113416b5 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sun, 4 Aug 2024 11:37:54 -0400 Subject: [PATCH 005/206] Corrected an issue causing a crash condition when using "extract unique" on a flattened layout (some labels end up NULL and the NULL condition needs to be checked). Also remembered to update VERSION, which was missed on the last commit. --- VERSION | 2 +- extract/ExtUnique.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 5c84de62..7659510c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.486 +8.3.487 diff --git a/extract/ExtUnique.c b/extract/ExtUnique.c index 05645a3e..2e2a716c 100644 --- a/extract/ExtUnique.c +++ b/extract/ExtUnique.c @@ -164,7 +164,8 @@ extUniqueCell(def, option) if (!(ll->ll_label->lab_flags & PORT_DIR_MASK)) for (lltest = lastreg->lreg_labels; lltest; lltest = lltest->ll_next) - if (!strcmp(lltest->ll_label->lab_text, text)) + if ((lltest->ll_label != NULL) && + (!strcmp(lltest->ll_label->lab_text, text))) if (lltest->ll_label->lab_flags & PORT_DIR_MASK) break; From f3bfde60f0f484ea9b6f39ffa6acd4e15e9cc1a4 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 6 Aug 2024 11:17:27 -0400 Subject: [PATCH 006/206] Change to ext2spice which should solve the problem of ports no longer being output in order after flattening a circuit. --- VERSION | 2 +- ext2spice/ext2spice.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7659510c..e4716a47 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.487 +8.3.488 diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 6ae81ed1..0edd34fc 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -1816,6 +1816,9 @@ topVisit(def, doStub) snode = sname->efnn_node; if ((!snode) || (!(snode->efnode_flags & EF_PORT))) continue; explicit = FALSE; + portorder = snode->efnode_name->efnn_port; + if (portorder > portmax) portmax = portorder; + if (portorder != -1) explicit = TRUE; for (nodeName = sname; nodeName != NULL; nodeName = nodeName->efnn_next) { portorder = nodeName->efnn_port; From 0c36365db8921397a258abbea0369cee8d560c99 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 16 Aug 2024 17:45:10 -0400 Subject: [PATCH 007/206] Revised the file opening routine with respect to the search paths. Previously, a file path beginning with "/", "./", or "../" would be searched for verbatim and no searching would be done over paths. This behavior now occurs for a leading "/" only. File paths with "./" or "../" will search for the file with the path verbatim, then proceed to search for the file with each search path prepended to the filename as usual. This solves a problem for reusable, non- PDK IP blocks, where the IP block may have an abstract view pointing to a GDS file which is specified as being located at "../gds/". This file would not be found if the IP block was included into another project. Now it can be done if the path to the IP is given by "addpath". --- VERSION | 2 +- utils/path.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index e4716a47..091aeb8f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.488 +8.3.489 diff --git a/utils/path.c b/utils/path.c index 852b2ef2..71431dac 100644 --- a/utils/path.c +++ b/utils/path.c @@ -736,8 +736,9 @@ PaLockOpen(file, mode, ext, path, library, pRealName, is_locked, fdp) #endif f = fopen(realName, mode); - if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f); - return f; + if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f); + if ((f != NULL) || (file[0] == '/')) + return f; } /* Now try going through the path, one entry at a time. */ @@ -883,9 +884,15 @@ PaZOpen(file, mode, ext, path, library, pRealName) || strcmp(file, "..") == 0 || strncmp(file, "../", 3) == 0))) { + gzFile result; (void) strncpy(realName, file, MAXSIZE-1); realName[MAXSIZE-1] = '\0'; - return gzopen(realName, mode); + + /* For full paths, halt immediately if not found. Otherwise, + * treat the path as relative to something in the search path. + */ + result = gzopen(realName, mode); + if ((result != NULL) || (file[0] == '/')) return result; } /* Now try going through the path, one entry at a time. */ From 974621ebe7fd023721332479ab6c64dfcf357aa2 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 30 Aug 2024 01:48:38 -0400 Subject: [PATCH 008/206] Corrected a missing pointer to integer cast in code that was added fairly recently when getting rid of crashes related to commands operating on non-edit cells. The lack of a cast was prevening compilation on systems with more rigorous error checking. --- VERSION | 2 +- commands/CmdTZ.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 091aeb8f..ac237a8d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.489 +8.3.490 diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index 60ec727b..56fa95b3 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -981,7 +981,7 @@ CmdWhat(w, cmd) if (EditCellUse == NULL) { editNull = TRUE; - EditCellUse = w->w_surfaceID; + EditCellUse = (CellUse *)w->w_surfaceID; } /* Find all the selected paint and print out the layer names. */ From 427547c9272d695a81bbc55922c799d4277cf1da Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sun, 15 Sep 2024 17:33:51 -0400 Subject: [PATCH 009/206] Changed the behavior of renaming conflicting cells from "#" to "__", because the use of "#" is considered illegal for cell names in GDS. --- VERSION | 2 +- database/DBio.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index ac237a8d..b206c631 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.490 +8.3.491 diff --git a/database/DBio.c b/database/DBio.c index a594764c..d6e58024 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -2111,7 +2111,7 @@ badTransform: } else { - char *newname = (char *)mallocMagic(strlen(cellname) + 6); + char *newname = (char *)mallocMagic(strlen(cellname) + 7); int i = 0; /* To do: Run checksum on file (not yet implemented) */ @@ -2119,7 +2119,7 @@ badTransform: while (TRUE) { - sprintf(newname, "%s#%d", cellname, i); + sprintf(newname, "%s__%d", cellname, i); if (DBCellLookDef(newname) == NULL) break; i++; } @@ -2188,7 +2188,7 @@ badTransform: } else { - char *newname = (char *)mallocMagic(strlen(cellname) + 6); + char *newname = (char *)mallocMagic(strlen(cellname) + 7); int i = 0; /* To do: Run checksum on file (not yet implemented) */ @@ -2196,7 +2196,7 @@ badTransform: while (TRUE) { - sprintf(newname, "%s#%d", cellname, i); + sprintf(newname, "%s__%d", cellname, i); if (DBCellLookDef(newname) == NULL) break; i++; } From f3b08ad470cf1dee1a466f2121089436340c9207 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 25 Sep 2024 21:26:41 -0400 Subject: [PATCH 010/206] Corrected an error that was introduced in the August 3 commit and which prevents the "Ctrl-P" key from raising the .params window; the underlying error is that the original error in the "property" command was a disagreement about where "argstart" is placed. The command was fixed to make the "property" command work correctly. However, the solution made "argstart" wrong when using the command "cellname property". Now both uses are handled correctly. --- VERSION | 2 +- commands/CmdCD.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index b206c631..a5586930 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.491 +8.3.492 diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 3f11aa62..edd80361 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -1296,7 +1296,7 @@ CmdCellname(w, cmd) if (cellDef == (CellDef *) NULL) TxError("Unknown cell %s\n", cellname); else - CmdDoProperty(cellDef, cmd, 2 + ((dolist) ? 1 : 0)); + CmdDoProperty(cellDef, cmd, 3 + ((dolist) ? 1 : 0)); break; case IDX_DELETE: From 881115a856493381f35c490b9d164d392aecbc9c Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 30 Sep 2024 23:00:00 +0100 Subject: [PATCH 011/206] database/DBio.c: Fix MAGIC_WRAPPER #endif to fix CI WASM build Misplaced #endif causing the build to break when option enabled error introduced in 3dc5018 Related commits: commit 68a088943f5534ac356ce8113d3985868b35d03e Date: Tue Sep 12 11:12:00 2023 -0400 commit 3dc5018af4994cc23e2c2dbc822927d7897fba93 (tag: 8.3.477) Date: Fri May 3 21:43:27 2024 -0400 --- database/DBio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBio.c b/database/DBio.c index d6e58024..889f7ba0 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -688,8 +688,8 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference) freeMagic(argv[1]); freeMagic(argv[0]); } -#endif } +#endif } if (strcmp(DBTechName, tech)) { From fed93c200d6e24b36a2fbe5033844f2df5170d6d Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:44:21 +0100 Subject: [PATCH 012/206] gcr/gcrShwFlgs.c: Likely overrunning write Fix code scanning alert no. 2: Likely overrunning write (#5) * Fix code scanning alert no. 2: Likely overrunning write Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Update gcrShwFlgs.c * AI added snprintf(), DLM increased buffer for enough space for rounded/aligned 64bit %p --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- gcr/gcrShwFlgs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcr/gcrShwFlgs.c b/gcr/gcrShwFlgs.c index 084a2a76..1c8b1e18 100644 --- a/gcr/gcrShwFlgs.c +++ b/gcr/gcrShwFlgs.c @@ -203,14 +203,14 @@ void gcrDumpChannel(ch) GCRChannel * ch; { - char name[20]; + char name[32]; int track, col, netCount = 0, gcrNetName(); short res; GCRNet * net, * netNames[500]; FILE * fp, * fopen(); netNames[0]=(GCRNet *) 0; - (void) sprintf(name, "channel.%p", ch); + (void) snprintf(name, sizeof(name), "channel.%p", ch); if((fp = fopen(name, "w")) == NULL) { TxError("Can't open file %s to dump channel.\n", name); From 51b8161a211821e988bcfb7ac897566d7696c085 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:44:50 +0100 Subject: [PATCH 013/206] lef/defWrite.c: Too few arguments to formatting function Fix code scanning alert no. 62: Too few arguments to formatting function (#1) * Create codeql.yml * Fix code scanning alert no. 62: Too few arguments to formatting function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- lef/defWrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lef/defWrite.c b/lef/defWrite.c index 907f9acb..b5b5c4f1 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -330,7 +330,7 @@ defnodeCount(node, res, cap, total) if (pwr && (!strcmp(cp, pwr))) { /* Diagnostic */ - TxPrintf("Node %s matches VDD variable definition!\n"); + TxPrintf("Node %s matches VDD variable definition!\n", cp); node->efnode_flags |= EF_SPECIAL; } From 4374a1918eeae5e7b1c4ba33388f1be65a05f175 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:46:25 +0100 Subject: [PATCH 014/206] lef/defWrite.c: Too few arguments to formatting function Fix code scanning alert no. 63: Too few arguments to formatting function (#3) * Create codeql.yml * Fix code scanning alert no. 63: Too few arguments to formatting function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- lef/defWrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lef/defWrite.c b/lef/defWrite.c index b5b5c4f1..ccbdef57 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -338,7 +338,7 @@ defnodeCount(node, res, cap, total) if (pwr && (!strcmp(cp, pwr))) { /* Diagnostic */ - TxPrintf("Node %s matches GND variable definition!\n"); + TxPrintf("Node %s matches GND variable definition!\n", cp); node->efnode_flags |= EF_SPECIAL; } From 64d94ae5881d2221bf3514e0c43771d6fbc2a386 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:46:52 +0100 Subject: [PATCH 015/206] router/rtrCmd.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 156: Incorrect return-value check for a 'scanf'-like function (#6) * Create codeql.yml * Fix code scanning alert no. 156: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- router/rtrCmd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/router/rtrCmd.c b/router/rtrCmd.c index 55e94271..d33abea8 100644 --- a/router/rtrCmd.c +++ b/router/rtrCmd.c @@ -640,7 +640,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%d", &RtrViaLimit)) + if(sscanf(cmd->tx_argv[2], "%d", &RtrViaLimit) != 1) TxError("Bad value for via limit\n"); } TxPrintf("Via limit is %d\n", RtrViaLimit); @@ -650,7 +650,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%f", &RtrEndConst)) + if(sscanf(cmd->tx_argv[2], "%f", &RtrEndConst) != 1) TxError("Bad value for channel end distance\n"); } TxPrintf("Channel end constant is %f\n", RtrEndConst); @@ -660,7 +660,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%d", &GCRMinJog)) + if(sscanf(cmd->tx_argv[2], "%d", &GCRMinJog) != 1) TxError("Bad value for minimum jog length\n"); } TxPrintf("Minimum jog length is %d\n", GCRMinJog); @@ -670,7 +670,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%f", &GCRObstDist)) + if(sscanf(cmd->tx_argv[2], "%f", &GCRObstDist) != 1) TxError("Bad value for obstacle constant\n"); } TxPrintf("Obstacle constant is %f\n", GCRObstDist); @@ -680,7 +680,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%d", &GCRSteadyNet)) + if(sscanf(cmd->tx_argv[2], "%d", &GCRSteadyNet) != 1) TxError("Bad value for steady net constant\n"); } TxPrintf("Steady net constant is %d\n", GCRSteadyNet); From 39e76f3f31c7a6fff1ee741df4e85efc07962eb4 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:48:04 +0100 Subject: [PATCH 016/206] graphics/grDStyle.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 151: Incorrect return-value check for a 'scanf'-like function (#7) * Create codeql.yml * Fix code scanning alert no. 151: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Update grDStyle.c * AI suggested '< 1', DLM edited to '<= 0' easier for a human to reason about ? --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- graphics/grDStyle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/grDStyle.c b/graphics/grDStyle.c index 57d8f7b6..d85c15e4 100644 --- a/graphics/grDStyle.c +++ b/graphics/grDStyle.c @@ -229,7 +229,7 @@ styleBuildDisplayStyle(line, version) */ /* Allow colors to be specified by index or by name */ - if (sscanf(colorName, ((version > 6) ? "%i" : "%o"), &color) == 0) + if (sscanf(colorName, ((version > 6) ? "%i" : "%o"), &color) <= 0) color = GrNameToColor(colorName); newstyle->style.mask = (mask & grBitPlaneMask); From 4ca98dc31bf7bb3952656c66f1a18ec848998bae Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:48:38 +0100 Subject: [PATCH 017/206] graphics/grCMap.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 150: Incorrect return-value check for a 'scanf'-like function (#8) * Create codeql.yml * Fix code scanning alert no. 150: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Update grCMap.c * AI suggested '< 1', DLM edited to '<= 0' easier for a human to reason about ? --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- graphics/grCMap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/grCMap.c b/graphics/grCMap.c index b60b5b86..44e94391 100644 --- a/graphics/grCMap.c +++ b/graphics/grCMap.c @@ -156,7 +156,7 @@ char *libPath; /* a library search path */ while (fgets(inputLine, 128, f) != NULL) { argc = sscanf(inputLine, "%*d %*d %*d %d", &newmax); - if (argc == 0) + if (argc <= 0) { /* Allow comment lines */ if (*inputLine == '#') continue; From 96c7e283c0f135a8eea2e973a532b5d8e50bb0c8 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:48:58 +0100 Subject: [PATCH 018/206] gcr/gcrDebug.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 137: Incorrect return-value check for a 'scanf'-like function (#9) * Create codeql.yml * Fix code scanning alert no. 137: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- gcr/gcrDebug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcr/gcrDebug.c b/gcr/gcrDebug.c index a0fad0e1..16a5bbcb 100644 --- a/gcr/gcrDebug.c +++ b/gcr/gcrDebug.c @@ -978,8 +978,12 @@ gcrShowMap(ch) while (1) { TxPrintf("Field selector (0 terminates): "); - if(!scanf("%d", &field)) /*typed something funny*/ + if(scanf("%d", &field) != 1) /*typed something funny or EOF*/ { + if (feof(stdin)) { + TxPrintf("End of input detected. Terminating.\n"); + return; + } TxPrintf("Bad input. Legal responses are\n"); TxPrintf(" GCRBLKM 1\n"); TxPrintf(" GCRBLKP 2\n"); From e66e3b32ad2806b11e38d8a20b1c2cfe7bdc058f Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:49:18 +0100 Subject: [PATCH 019/206] extract/ExtBasic.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 149: Incorrect return-value check for a 'scanf'-like function (#10) * Create codeql.yml * Fix code scanning alert no. 149: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtBasic.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 0f45ce3e..7ca31c2c 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -427,14 +427,14 @@ extBasic(def, outFile) case DEV_FET: /* Read area */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda * ExtCurStyle->exts_unitsPerLambda; /* Read perimeter */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; @@ -444,13 +444,13 @@ extBasic(def, outFile) case DEV_BJT: /* Read width */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda; /* Read length */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; @@ -460,13 +460,13 @@ extBasic(def, outFile) { /* Read width */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda; /* Read length */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; @@ -479,14 +479,14 @@ extBasic(def, outFile) { /* Read area */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda * ExtCurStyle->exts_unitsPerLambda; /* Read perimeter */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; From 2a00ab7eb87e492bf84695d31c41dd9ed02ff0a1 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:49:35 +0100 Subject: [PATCH 020/206] extract/ExtTech.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 136: Incorrect return-value check for a 'scanf'-like function (#11) * Create codeql.yml * Fix code scanning alert no. 136: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtTech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtTech.c b/extract/ExtTech.c index 36435d34..3dcdf9e6 100644 --- a/extract/ExtTech.c +++ b/extract/ExtTech.c @@ -2501,7 +2501,7 @@ ExtTechLine(sectionName, argc, argv) equal = TRUE; limitstr++; } - if (sscanf(limitstr, "%lg", &dval) == 0) + if (sscanf(limitstr, "%lg", &dval) != 1) { TxError("Non-numeric limit \"%s\" for parameter \"%c%s\".\n", limitstr, cond, argv[argc - 1]); From 886a0212e82254d28d82ac0b84f1d9cc4b7b39f0 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:49:50 +0100 Subject: [PATCH 021/206] database/DBtech.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 135: Incorrect return-value check for a 'scanf'-like function (#12) * Create codeql.yml * Fix code scanning alert no. 135: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- database/DBtech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBtech.c b/database/DBtech.c index 2ea3676f..47f8b818 100644 --- a/database/DBtech.c +++ b/database/DBtech.c @@ -223,7 +223,7 @@ DBTechSetVersion(sectionName, argc, argv) major = minor = rev = 0; rmajor = rminor = rrev = 0; - if (sscanf(vstring, "%d.%d.%d", &rmajor, &rminor, &rrev) == 0) + if (sscanf(vstring, "%d.%d.%d", &rmajor, &rminor, &rrev) != 3) { TechError("Badly formed magic version string, should be major.minor.rev\n"); return FALSE; From c89455782b4aac9acfb7b078abe65d3760828b0f Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 01:50:14 +0100 Subject: [PATCH 022/206] cmwind/CMWcmmnds.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 134: Incorrect return-value check for a 'scanf'-like function (#13) * Create codeql.yml * Fix code scanning alert no. 134: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- cmwind/CMWcmmnds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmwind/CMWcmmnds.c b/cmwind/CMWcmmnds.c index 3cf3404e..b5aaf2dc 100644 --- a/cmwind/CMWcmmnds.c +++ b/cmwind/CMWcmmnds.c @@ -372,7 +372,7 @@ cmwColor(w, cmd) } else if (cmd->tx_argc == 2) { - if (sscanf(cmd->tx_argv[1], "%i", &color) == 0) + if (sscanf(cmd->tx_argv[1], "%i", &color) != 1) { /* Invalid color---allow keywords "next" and "last" */ crec = (CMWclientRec *) w->w_clientData; From a5f7cbd597d517c7b3a6d6b98abde984fff38fa8 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 03:47:46 +0100 Subject: [PATCH 023/206] database/DBcellcopy.c: Call to function with fewer arguments than declared parameters Fix code scanning alert no. 9: Call to function with fewer arguments than declared parameters (#15) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- database/DBcellcopy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBcellcopy.c b/database/DBcellcopy.c index d103ce38..d253ea08 100644 --- a/database/DBcellcopy.c +++ b/database/DBcellcopy.c @@ -603,7 +603,7 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels, doclear) { int savemask = scx.scx_use->cu_expandMask; scx.scx_use->cu_expandMask = CU_DESCEND_SPECIAL; - DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest); + DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest, NULL); scx.scx_use->cu_expandMask = savemask; } From 573e59da44006b4770bfacc0fceba5405ca04e22 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 03:48:27 +0100 Subject: [PATCH 024/206] database/DBcellname.c: Call to function with fewer arguments than declared parameters Fix code scanning alert no. 10: Call to function with fewer arguments than declared parameters (#14) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- database/DBcellname.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBcellname.c b/database/DBcellname.c index 589cb72f..b554b5af 100644 --- a/database/DBcellname.c +++ b/database/DBcellname.c @@ -283,7 +283,7 @@ DBCellDelete(cellname, force) /* so that WindUnload() will create a new one. */ if (!strcmp(cellname, UNNAMED)) - DBCellRename(cellname, "__UNNAMED__"); + DBCellRename(cellname, "__UNNAMED__", FALSE); /* For all top-level cell uses, check if any windows have this */ /* use. If so, load the window with (UNNAMED). */ From 9295240047cac1b7493a4ca8d1155c177e6dd710 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 03:48:52 +0100 Subject: [PATCH 025/206] textio/txCommands.c: Wrong type of arguments to formatting function Fix code scanning alert no. 114: Wrong type of arguments to formatting function (#21) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- textio/txCommands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textio/txCommands.c b/textio/txCommands.c index 554cae2c..04f0eaea 100644 --- a/textio/txCommands.c +++ b/textio/txCommands.c @@ -639,7 +639,7 @@ TxLogStart(fileName, mw) { if (txLogFile != NULL) { - TxError("There is already a log file (%s) open!\n", txLogFile); + TxError("There is already a log file open!\n"); return; } From a307e9d0523b5526f772b190111af621b7a14afc Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 03:49:07 +0100 Subject: [PATCH 026/206] textio/txCommands.c: Wrong type of arguments to formatting function Fix code scanning alert no. 115: Wrong type of arguments to formatting function (#20) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- textio/txCommands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textio/txCommands.c b/textio/txCommands.c index 04f0eaea..e1926338 100644 --- a/textio/txCommands.c +++ b/textio/txCommands.c @@ -255,7 +255,7 @@ TxPrintCommand(cmd) int i, j; char TxTemp[200]; - TxError("Command at 0x%x\n ", cmd); + TxError("Command at %p\n ", cmd); if (cmd->tx_button == TX_CHARACTER) { TxError("Text command with %d words: ", cmd->tx_argc); for (i = 0; i < cmd->tx_argc; i++) { From 8f60ed472b2eb56253e3dd478afef85308d681c2 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 03:49:25 +0100 Subject: [PATCH 027/206] textio/txCommands.c: Wrong type of arguments to formatting function Fix code scanning alert no. 116: Wrong type of arguments to formatting function (#19) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- textio/txCommands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textio/txCommands.c b/textio/txCommands.c index e1926338..32b1c5ee 100644 --- a/textio/txCommands.c +++ b/textio/txCommands.c @@ -201,7 +201,7 @@ void TxPrintEvent(event) TxInputEvent *event; { - TxError("Input event at 0x%x\n ", event); + TxError("Input event at %p\n ", event); if (event->txe_button == TX_EOF) { TxError("EOF event"); } else if (event->txe_button == TX_BYPASS) { From 9f052c0e4d1c643f311636399944d95db375e135 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 03:49:39 +0100 Subject: [PATCH 028/206] utils/undo.c: Wrong type of arguments to formatting function Fix code scanning alert no. 117: Wrong type of arguments to formatting function (#16) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- utils/undo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/undo.c b/utils/undo.c index 06b85292..1f36da32 100644 --- a/utils/undo.c +++ b/utils/undo.c @@ -924,8 +924,8 @@ undoPrintForw(iup, n) { int i = 0; - (void) TxPrintf("head=0x%x\ttail=0x%x\tcur=0x%x\n", - undoLogHead, undoLogTail, undoLogCur); + (void) TxPrintf("head=%p\ttail=%p\tcur=%p\n", + (void *)undoLogHead, (void *)undoLogTail, (void *)undoLogCur); if (iup == (internalUndoEvent *) NULL) iup = undoLogHead; while (iup != (internalUndoEvent *) NULL) @@ -947,8 +947,8 @@ undoPrintBack(iup, n) { int i = 0; - (void) TxPrintf("head=0x%x\ttail=0x%x\tcur=0x%x\n", - undoLogHead, undoLogTail, undoLogCur); + (void) TxPrintf("head=%p\ttail=%p\tcur=%p\n", + (void *)undoLogHead, (void *)undoLogTail, (void *)undoLogCur); if (iup == (internalUndoEvent *) NULL) iup = undoLogTail; while (iup != (internalUndoEvent *) NULL) From 88a1a9b166a1f723cf6ad55771109408a15bc7e7 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 03:52:55 +0100 Subject: [PATCH 029/206] utils/undo.c: Wrong type of arguments to formatting function Fix code scanning alert no. 120: Wrong type of arguments to formatting function (#17) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- utils/undo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/undo.c b/utils/undo.c index 1f36da32..7baa50b5 100644 --- a/utils/undo.c +++ b/utils/undo.c @@ -910,8 +910,8 @@ undoPrintEvent(iup) else client_name = undoClientTable[iup->iue_type].uc_name; - (void) TxPrintf("0x%x: \t%s \tf=0x%x \tb=0x%x\n", - iup, client_name, iup->iue_forw, iup->iue_back); + (void) TxPrintf("%p: \t%s \tf=%p \tb=%p\n", + (void *)iup, client_name, (void *)iup->iue_forw, (void *)iup->iue_back); } /* Print events forward from "iup". If n is 0 or negative, print to */ From f47a173a4939efdde166ac06099ba2e215dc1766 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 030/206] commands/CmdLQ.c: Call to function with fewer arguments than declared parameters No AI resolution. The NULL added is cdata which looks to be opaque callback user-defined-pointer, this is not used in the method printPropertiesFunc() as a possible 3rd argument. CodeQL: https://github.com/dlmiles/magic/security/code-scanning/157 --- commands/CmdLQ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/CmdLQ.c b/commands/CmdLQ.c index bdd0e9d1..3b3440cb 100644 --- a/commands/CmdLQ.c +++ b/commands/CmdLQ.c @@ -2324,7 +2324,7 @@ CmdDoProperty(def, cmd, argstart) if (locargc == 1) { /* print all properties and their values */ - DBPropEnum(def, printPropertiesFunc); + DBPropEnum(def, printPropertiesFunc, NULL); } else if (locargc == 2) From 49f4daa71560630029178990050c73f60e584588 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 031/206] utils/main.c: Call to function with fewer arguments than declared parameters Copilot Autofix rejected: DBFileRecovery(MainFileName); database/DBio.c looks to take NULL as a value for automatic recovery. Related commits: commit 231a299b164177c532ec9b8a829cddbc5a0fad64 (tag: 8.2.0) Date: Tue Apr 25 08:41:48 2017 -0400 Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky --- utils/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/main.c b/utils/main.c index cc9b2304..0ffc84da 100644 --- a/utils/main.c +++ b/utils/main.c @@ -1164,7 +1164,7 @@ mainInitFinal() if (mainRecover && MakeMainWindow) { - DBFileRecovery(); + DBFileRecovery(NULL); /* automatic search most recent */ } /* From 3db35216b9f2c23d11481fee65f7ccdbeb33de55 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 032/206] utils/main.c: LefRead() Call to function with fewer arguments than declared parameters Looks like -1 is accepted as placeholder, maybe it should be the temporary->fn (filename mtime?). Copilot Autofix rejected: LefRead(temporary->fn, FALSE, NULL); related git blame utils/main.c: 8e80644d (2022-01-22 13:30:11 -0500 2078) int lefTimestamp; /* If not -1, use the value pointed to 8e80644d (2022-01-22 13:30:11 -0500 2884) int lefTimestamp; related commit: commit 8e80644dd76495b37bf8b2303ae7a29c757fa2a2 Date: Sat Jan 22 13:30:11 2022 -0500 CodeQL: https://github.com/dlmiles/magic/security/code-scanning/28 --- utils/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/main.c b/utils/main.c index 0ffc84da..ecfca76f 100644 --- a/utils/main.c +++ b/utils/main.c @@ -1188,7 +1188,7 @@ mainInitFinal() break; #ifdef LEF_MODULE case FN_LEF_FILE: - LefRead(temporary->fn, FALSE, FALSE); + LefRead(temporary->fn, FALSE, FALSE, -1); break; case FN_DEF_FILE: DefRead(temporary->fn, FALSE); From fff3be2f290363673d7ead3a1584c0b4af6cafba Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 033/206] utils/main.c: DefRead() Call to function with fewer arguments than declared parameters Resolution maintains behaviour closest to original behaviour from a37fc1e2 Copilot Autofix no offered. related git blame lef/defRead.c: cfb81101 (2022-03-30 13:02:12 -0400 2388) bool annotate; f7df5e7c (2022-06-24 15:22:53 -0400 2389) bool noblockage; related commits: commit cfb81101ecae618ea111ede4319d2b7516dc4338 Date: Wed Mar 30 13:02:12 2022 -0400 commit f7df5e7c86fb47c5fd445c846afddc6fbabad6ae (tag: 8.3.315) Date: Fri Jun 24 15:22:53 2022 -0400 commit a37fc1e242be934891b26a2ced211caebbca746d Date: Thu Mar 5 14:29:54 2020 -0500 CodeQL: https://github.com/dlmiles/magic/security/code-scanning/29 --- utils/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/main.c b/utils/main.c index ecfca76f..8865e65b 100644 --- a/utils/main.c +++ b/utils/main.c @@ -1191,7 +1191,7 @@ mainInitFinal() LefRead(temporary->fn, FALSE, FALSE, -1); break; case FN_DEF_FILE: - DefRead(temporary->fn, FALSE); + DefRead(temporary->fn, FALSE, FALSE, FALSE); break; #endif #ifdef MAGIC_WRAPPER From d297b99953822c7f8c5618a530c3fc464ebc06ba Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 034/206] select/selOps.c: CmdFindNetProc() Call to function with fewer arguments than declared parameters The 'isvalid' pointer argument to CmdFindNetProc() is for an optional return value, so must be NULL when feature is not used. Copilot Autofix rejected: ttype = CmdFindNetProc(lab1, use, &rect, FALSE, additionalArg); commands/CmdFI.c cfb81101 (2022-03-30 13:02:12 -0400 1584) bool *isvalid; commit f89d52dbcc6f21eafff2479d94a44e944bd0b767 (tag: 8.3.253) Date: Thu Jan 6 13:29:43 2022 -0500 CodeQL: https://github.com/dlmiles/magic/security/code-scanning/25 --- select/selOps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select/selOps.c b/select/selOps.c index 3305b48f..1d1663c5 100644 --- a/select/selOps.c +++ b/select/selOps.c @@ -942,7 +942,7 @@ SelectShort(char *lab1, char *lab2) /* Make sure the selection is clear before starting */ SelectClear(); - ttype = CmdFindNetProc(lab1, use, &rect, FALSE); + ttype = CmdFindNetProc(lab1, use, &rect, FALSE, NULL); if (ttype == TT_SPACE) return NULL; bzero(&scx, sizeof(SearchContext)); From ce1e027c553455b8bb51fd2dd1431bca2257f171 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 035/206] resis/ResSimple.c: ResGetDevice(): Call to function with fewer arguments than declared parameters gparams.rg_ttype seems to be the only value of the correct type that has connectivity with the callsite. Copilot Autofix rejected: ResGetDevice(gparams.rg_devloc, /* second argument */); resis/ResSimple.c 9aa39f82 (2021-05-25 22:41:52 -0400 1039) resDevice *res = ResGetDevice(gparams.rg_devloc); commit 9aa39f820fca6b1ab303a61463709726323ac29f (tag: 8.3.169) Date: Tue May 25 22:41:52 2021 -0400 --- resis/ResSimple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resis/ResSimple.c b/resis/ResSimple.c index 13fbfd4c..b0f7aae9 100644 --- a/resis/ResSimple.c +++ b/resis/ResSimple.c @@ -1036,7 +1036,7 @@ ResSetPathRes() } if (ResOriginNode == NULL) { - resDevice *res = ResGetDevice(gparams.rg_devloc); + resDevice *res = ResGetDevice(gparams.rg_devloc, gparams.rg_ttype); ResOriginNode = res->rd_fet_source; ResOriginNode->rn_why = RES_NODE_ORIGIN; ResOriginNode->rn_noderes = 0; From 7feec6358093b615a0e53e890ffbe30d2f2ed772 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 036/206] cif/CIFgen.c: CmdFindNetProc() Call to function with fewer arguments than declared parameters The 'isvalid' pointer argument to CmdFindNetProc() is for an optional return value, so must be NULL when feature is not used. Copilot Autofix rejected: ttype = CmdFindNetProc(netname, CIFDummyUse, &bbox, FALSE, additional_arg1, additional_arg2); commands/CmdFI.c cfb81101 (2022-03-30 13:02:12 -0400 1584) bool *isvalid; commit f89d52dbcc6f21eafff2479d94a44e944bd0b767 (tag: 8.3.253) Date: Thu Jan 6 13:29:43 2022 -0500 CodeQL: https://github.com/dlmiles/magic/security/code-scanning/7 --- cif/CIFgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cif/CIFgen.c b/cif/CIFgen.c index 1591088c..0d9e04b3 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -4896,7 +4896,7 @@ CIFGenLayer(op, area, cellDef, origDef, temps, hier, clientdata) } netname = (char *)op->co_client; cifPlane = curPlane; - ttype = CmdFindNetProc(netname, CIFDummyUse, &bbox, FALSE); + ttype = CmdFindNetProc(netname, CIFDummyUse, &bbox, FALSE, NULL); if (ttype != TT_SPACE) { UndoDisable(); From 1360f962a15662660dde858fb1ae621a6e9aa700 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 037/206] calma/CalmaRdcl.c: calmaFindCell() Call to function with fewer arguments than declared parameters The 'predefined' pointer argument to calmaFindCell() is for an optional return value, so must be NULL when feature is not used. Copilot Autofix rejected: newdef = calmaFindCell(newname, someSecondArgument); calma/CalmaRdcl.c 1c822652 (2020-12-04 16:56:51 -0500 1359) bool *predefined; /* If this cell was in memory before the GDS 1c822652 (2020-12-04 16:56:51 -0500 1360) * file was read, then this flag gets set. 1c822652 (2020-12-04 16:56:51 -0500 1361) */ commit 1c822652442ca3dc016efbbbce2c3052340bdd10 (tag: mpw-one-a, tag: 8.3.92) Date: Fri Dec 4 16:56:51 2020 -0500 CodeQL: https://github.com/dlmiles/magic/security/code-scanning/6 https://github.com/dlmiles/magic/security/code-scanning/5 --- calma/CalmaRdpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 92bd9ef3..146f3276 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -267,7 +267,7 @@ calmaElementBoundary() he = HashFind(&calmaDefInitHash, newname); if (!HashGetValue(he)) { - newdef = calmaFindCell(newname, NULL); + newdef = calmaFindCell(newname, NULL, NULL); cifReadCellDef = newdef; DBCellClearDef(cifReadCellDef); DBCellSetAvail(cifReadCellDef); @@ -673,7 +673,7 @@ calmaElementPath() he = HashFind(&calmaDefInitHash, newname); if (!HashGetValue(he)) { - newdef = calmaFindCell(newname, NULL); + newdef = calmaFindCell(newname, NULL, NULL); cifReadCellDef = newdef; DBCellClearDef(cifReadCellDef); DBCellSetAvail(cifReadCellDef); From d2ae7f78e83b75ae1112b542dbe3115c3a55b248 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 038/206] ext2sim/ext2sim.c: EFDone() Call to function with fewer arguments than declared parameters Passing NULL is valid in efFreeNodeList() to not perform callback.. extflat/EFdef.c: ^231a299 (2017-04-25 08:41:48 -0400 97) void 5e3c26c9 (2021-12-13 18:05:53 -0500 98) EFDone(func) 5e3c26c9 (2021-12-13 18:05:53 -0500 99) int (*func)(); commit 5e3c26c95afadfd07753bb8126fa6528afce5dd8 (tag: 8.3.241) Date: Mon Dec 13 18:05:53 2021 -0500 extflat/EFdef.c:97 void EFDone(int (*func)()); extflat/EFbuild.c:2180 void efFreeNodeList(EFNode *head, int (*func)()); CodeQL: https://github.com/dlmiles/magic/security/code-scanning/11 --- ext2sim/ext2sim.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index a4e87cbd..51861ec4 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -534,7 +534,7 @@ runexttosim: if (err_result == TRUE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } @@ -548,7 +548,7 @@ runexttosim: if (w == (MagWindow *) NULL) { TxError("Point to a window or specify a cell name.\n"); - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } inName = ((CellUse *) w->w_surfaceID)->cu_def->cd_name; @@ -585,7 +585,7 @@ runexttosim: #else TxError("exttosim: Unable to open file %s for writing\n", simesOutName); #endif - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } if (!esNoAlias && (esAliasF = fopen(esAliasName, "w")) == NULL) @@ -598,7 +598,7 @@ runexttosim: #else TxError("exttosim: Unable to open file %s for writing\n", esAliasName); #endif - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } if (!esNoLabel && (esLabF = fopen(esLabelName, "w")) == NULL) @@ -617,7 +617,7 @@ runexttosim: /* Read the hierarchical description of the input circuit */ if (EFReadFile(inName, FALSE, esDoSimExtResis, FALSE, FALSE) == FALSE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } From c8e00ef49451aceec3ab9fdcb5185a87f2c985b2 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 039/206] ext2spice/ext2spice.c: EFDone() Call to function with fewer arguments than declared parameters Passing NULL is valid in efFreeNodeList() to not perform callback.. extflat/EFdef.c: ^231a299 (2017-04-25 08:41:48 -0400 97) void 5e3c26c9 (2021-12-13 18:05:53 -0500 98) EFDone(func) 5e3c26c9 (2021-12-13 18:05:53 -0500 99) int (*func)(); commit 5e3c26c95afadfd07753bb8126fa6528afce5dd8 (tag: 8.3.241) Date: Mon Dec 13 18:05:53 2021 -0500 extflat/EFdef.c:97 void EFDone(int (*func)()); extflat/EFbuild.c:2180 void efFreeNodeList(EFNode *head, int (*func)()); CodeQL: https://github.com/dlmiles/magic/security/code-scanning/20 https://github.com/dlmiles/magic/security/code-scanning/21 https://github.com/dlmiles/magic/security/code-scanning/22 --- ext2spice/ext2spice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 0edd34fc..1bf26779 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -840,7 +840,7 @@ runexttospice: inName = EFArgs(argc, argv, &err_result, spcParseArgs, (ClientData) NULL); if (err_result == TRUE) { - EFDone(); + EFDone(NULL); return; } @@ -878,7 +878,7 @@ runexttospice: if (EFReadFile(inName, esDoHierarchy, esDoExtResis, FALSE, TRUE) == FALSE) { - EFDone(); + EFDone(NULL); return; } @@ -894,7 +894,7 @@ runexttospice: #else TxError("exttospice: Unable to open file %s for writing\n", spcesOutName); #endif - EFDone(); + EFDone(NULL); return; } From 4d81a77bf3e1a9776fe6b0a9d8786fd0073d4d25 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 040/206] extcheck/extcheck.c: EFDone() Call to function with fewer arguments than declared parameters Passing NULL is valid in efFreeNodeList() to not perform callback.. extflat/EFdef.c: ^231a299 (2017-04-25 08:41:48 -0400 97) void 5e3c26c9 (2021-12-13 18:05:53 -0500 98) EFDone(func) 5e3c26c9 (2021-12-13 18:05:53 -0500 99) int (*func)(); commit 5e3c26c95afadfd07753bb8126fa6528afce5dd8 (tag: 8.3.241) Date: Mon Dec 13 18:05:53 2021 -0500 extflat/EFdef.c:97 void EFDone(int (*func)()); extflat/EFbuild.c:2180 void efFreeNodeList(EFNode *head, int (*func)()); CodeQL: none (grep found this?) --- extcheck/extcheck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extcheck/extcheck.c b/extcheck/extcheck.c index 5a71cf5b..07550b50 100644 --- a/extcheck/extcheck.c +++ b/extcheck/extcheck.c @@ -90,7 +90,7 @@ main(argc, argv) #ifdef free_all_mem EFFlatDone(NULL); - EFDone(); + EFDone(NULL); #endif /* free_all_mem */ printf("Memory used: %s\n", RunStats(RS_MEM, NULL, NULL)); From e896377eada561b368b5bc9976e20337ab4340e9 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 041/206] extflat/EFantenna.c: EFDone() Call to function with fewer arguments than declared parameters Passing NULL is valid in efFreeNodeList() to not perform callback.. extflat/EFdef.c: ^231a299 (2017-04-25 08:41:48 -0400 97) void 5e3c26c9 (2021-12-13 18:05:53 -0500 98) EFDone(func) 5e3c26c9 (2021-12-13 18:05:53 -0500 99) int (*func)(); commit 5e3c26c95afadfd07753bb8126fa6528afce5dd8 (tag: 8.3.241) Date: Mon Dec 13 18:05:53 2021 -0500 extflat/EFdef.c:97 void EFDone(int (*func)()); extflat/EFbuild.c:2180 void efFreeNodeList(EFNode *head, int (*func)()); CodeQL: https://github.com/dlmiles/magic/security/code-scanning/16 --- extflat/EFantenna.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extflat/EFantenna.c b/extflat/EFantenna.c index c0a9725e..3ee40a24 100644 --- a/extflat/EFantenna.c +++ b/extflat/EFantenna.c @@ -197,7 +197,7 @@ runantennacheck: if (err_result == TRUE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } @@ -211,7 +211,7 @@ runantennacheck: if (w == (MagWindow *) NULL) { TxError("Point to a window or specify a cell name.\n"); - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } inName = ((CellUse *) w->w_surfaceID)->cu_def->cd_name; @@ -226,7 +226,7 @@ runantennacheck: TxPrintf("Reading extract file.\n"); if (EFReadFile(inName, FALSE, FALSE, FALSE, FALSE) == FALSE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } @@ -257,7 +257,7 @@ runantennacheck: TxPrintf("Running antenna checks.\n"); EFVisitDevs(antennacheckVisit, (ClientData)editUse); EFFlatDone(NULL); - EFDone(); + EFDone(NULL); TxPrintf("antennacheck finished.\n"); freeMagic(EFDeviceTypes); From 82aa62e65d248912de2dc850e71ebdc9ebb562d2 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:49:16 +0100 Subject: [PATCH 042/206] database/DBcellsrch.c: Wrong type of arguments to formatting function Fix code scanning alert no. 66: Wrong type of arguments to formatting function (#33) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- database/DBcellsrch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index c5a2e400..ed08f7b7 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -1621,7 +1621,7 @@ dbTileScaleFunc(tile, scvals) if ((targetRect.r_xtop - targetRect.r_xbot == 0) || (targetRect.r_ytop - targetRect.r_ybot == 0)) { - TxPrintf("Tile 0x%x at (%d, %d) has zero area after scaling: Removed.\n", + TxPrintf("Tile %p at (%d, %d) has zero area after scaling: Removed.\n", tile, targetRect.r_xbot, targetRect.r_ybot); return 0; } From 318993cb7bcc84352ab36d539690587f8a12fe96 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:49:43 +0100 Subject: [PATCH 043/206] plow/PlowTest.c: Wrong type of arguments to formatting function Fix code scanning alert no. 103: Wrong type of arguments to formatting function (#28) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- plow/PlowTest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plow/PlowTest.c b/plow/PlowTest.c index 9da0b126..04d19d39 100644 --- a/plow/PlowTest.c +++ b/plow/PlowTest.c @@ -307,8 +307,8 @@ PlowTest(w, cmd) tp = TiSrPointNoHint(plane, &editArea.r_ll); if (cmd->tx_argc == 3) trail = atoi(cmd->tx_argv[2]); else trail = editArea.r_xtop; - TxPrintf("Trailing coordinate of tile 0x%x updated from %d to %d\n", - tp, TRAILING(tp), trail); + TxPrintf("Trailing coordinate of tile %p updated from %d to %d\n", + (void *)tp, TRAILING(tp), trail); plowSetTrailing(tp, trail); break; case PC_MOVE: From 384e59ea98b10dbd5b2c276c6cdbb52445081788 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:49:57 +0100 Subject: [PATCH 044/206] plow/PlowTest.c: Wrong type of arguments to formatting function Fix code scanning alert no. 104: Wrong type of arguments to formatting function (#29) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- plow/PlowTest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plow/PlowTest.c b/plow/PlowTest.c index 04d19d39..ac59df2b 100644 --- a/plow/PlowTest.c +++ b/plow/PlowTest.c @@ -328,8 +328,8 @@ PlowTest(w, cmd) return; } TiToRect(tp, &area2); - TxPrintf("Splitting tile 0x%x at y=%d yielding 0x%x\n", - tp, editArea.r_ybot, plowSplitY(tp, editArea.r_ybot)); + TxPrintf("Splitting tile %p at y=%d yielding %p\n", + (void *)tp, editArea.r_ybot, (void *)plowSplitY(tp, editArea.r_ybot)); DBWAreaChanged(def, &area2, DBW_ALLWINDOWS, &DBAllButSpaceBits); break; case PC_MERGEDOWN: From 6946ea68459ba720d2ae02bf80c4ed62bacada85 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:51:06 +0100 Subject: [PATCH 045/206] plow/PlowTest.c: Wrong type of arguments to formatting function Fix code scanning alert no. 106: Wrong type of arguments to formatting function (#30) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- plow/PlowTest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plow/PlowTest.c b/plow/PlowTest.c index ac59df2b..a291008d 100644 --- a/plow/PlowTest.c +++ b/plow/PlowTest.c @@ -334,7 +334,7 @@ PlowTest(w, cmd) break; case PC_MERGEDOWN: tp = TiSrPointNoHint(plane, &editArea.r_ll); - TxPrintf("Merging tile 0x%x below\n", tp); + TxPrintf("Merging tile %p below\n", tp); TiToRect(tp, &editArea); TiToRect(RT(tp), &area2); (void) GeoInclude(&area2, &editArea); @@ -343,7 +343,7 @@ PlowTest(w, cmd) break; case PC_MERGEUP: tp = TiSrPointNoHint(plane, &editArea.r_ll); - TxPrintf("Merging tile 0x%x above\n", tp); + TxPrintf("Merging tile %p above\n", tp); TiToRect(tp, &editArea); TiToRect(RT(tp), &area2); (void) GeoInclude(&area2, &editArea); @@ -352,7 +352,7 @@ PlowTest(w, cmd) break; case PC_PRINT: tp = TiSrPointNoHint(plane, &editArea.r_ll); - TxPrintf("Tile 0x%x LEFT=%d RIGHT=%d BOTTOM=%d TOP=%d\n", + TxPrintf("Tile %p LEFT=%d RIGHT=%d BOTTOM=%d TOP=%d\n", tp, LEFT(tp), RIGHT(tp), BOTTOM(tp), TOP(tp)); TxPrintf(" TRAILING=%d LEADING=%d TYPE=%s\n", TRAILING(tp), LEADING(tp), DBTypeLongName(TiGetTypeExact(tp))); From 9f39380b6ae504c047ad793c124daa3a5b27406e Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:51:21 +0100 Subject: [PATCH 046/206] resis/ResDebug.c: Wrong type of arguments to formatting function Fix code scanning alert no. 109: Wrong type of arguments to formatting function (#27) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- resis/ResDebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resis/ResDebug.c b/resis/ResDebug.c index 2eb210cc..cd393f0a 100644 --- a/resis/ResDebug.c +++ b/resis/ResDebug.c @@ -87,7 +87,7 @@ ResPrintResistorList(fp, list) list->rr_connection2->rn_loc.p_y, list->rr_value); else - fprintf(fp, "r (%d,%d) (%d,%d) r=%d\n", + fprintf(fp, "r (%d,%d) (%d,%d) r=%.2f\n", list->rr_connection1->rn_loc.p_x, list->rr_connection1->rn_loc.p_y, list->rr_connection2->rn_loc.p_x, From 91ec4e4cb886ed03f40cea330c5c54894a43291f Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:53:19 +0100 Subject: [PATCH 047/206] resis/ResRex.c: Wrong type of arguments to formatting function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- resis/ResRex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resis/ResRex.c b/resis/ResRex.c index 31cfd8e5..521d5e5e 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -945,8 +945,8 @@ ResCheckPorts(cellDef) /* and a drivepoint. */ node = ResInitializeNode(entry); - TxPrintf("Port: name = %s is new node 0x%x\n", - lab->lab_text, node); + TxPrintf("Port: name = %s is new node %p\n", + lab->lab_text, (void *)node); TxPrintf("Location is (%d, %d); drivepoint (%d, %d)\n", portloc.p_x, portloc.p_y, portloc.p_x, portloc.p_y); From c16c770d7aef9557e1fd61558f796aaeac0a74fa Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:54:46 +0100 Subject: [PATCH 048/206] extract/ExtBasic.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 138: Incorrect return-value check for a 'scanf'-like function (#22) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtBasic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 7ca31c2c..e436368a 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -389,7 +389,7 @@ extBasic(def, outFile) if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &llx)) + if ((token == NULL) || (sscanf(token, "%d", &llx) != 1)) propfound = FALSE; else llx *= ExtCurStyle->exts_unitsPerLambda; @@ -397,7 +397,7 @@ extBasic(def, outFile) if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &lly)) + if ((token == NULL) || (sscanf(token, "%d", &lly) != 1)) propfound = FALSE; else lly *= ExtCurStyle->exts_unitsPerLambda; From 0619cf4291025b5ba111dfd1cc3b00483e4d542c Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 04:54:59 +0100 Subject: [PATCH 049/206] extract/ExtBasic.c: Incorrect return-value check for a 'scanf'-like function Fix code scanning alert no. 140: Incorrect return-value check for a 'scanf'-like function (#23) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtBasic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index e436368a..14bc7eed 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -405,7 +405,7 @@ extBasic(def, outFile) if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &urx)) + if ((token == NULL) || (sscanf(token, "%d", &urx) != 1)) propfound = FALSE; else urx *= ExtCurStyle->exts_unitsPerLambda; @@ -414,7 +414,7 @@ extBasic(def, outFile) if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &ury)) + if ((token == NULL) || (sscanf(token, "%d", &ury) != 1)) propfound = FALSE; else ury *= ExtCurStyle->exts_unitsPerLambda; From 4f5eb7da2d11236a81eb36a2c9ec761e5f7e3c25 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 050/206] ext2spice/ext2spice.c: %x => (intmax_t) %lx Wrong type of arguments to formatting function Looks like SPICE comment, change maintains hex without 0x prefix in portable way. Copilot Autofix rejected: TxError("** %s (%p)\n", nsn, node); CodeQL: https://github.com/dlmiles/magic/security/code-scanning/70 --- ext2spice/ext2spice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 1bf26779..47a671db 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -17,6 +17,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include /* for atof() */ #include #include @@ -3699,7 +3700,7 @@ nodeVisitDebug(node, res, cap) hierName = (HierName *) node->efnode_name->efnn_hier; nsn = nodeSpiceName(hierName, NULL); - TxError("** %s (%x)\n", nsn, node); + TxError("** %s (%lx)\n", nsn, (intmax_t) node); printf("\t client.name=%s, client.m_w=%p\n", ((nodeClient *)node->efnode_client)->spiceNodeName, From 4359aa8d4b25205e21779b23a1216d2f8614f5ef Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 051/206] commands/CmdWizard.c: %x => (intmax_t) %lx Wrong type of arguments to formatting function Looks like SPICE comment, change maintains hex without 0x prefix in portable way. Copilot Autofix rejected: TxPrintf("%p\n", tp); CodeQL: https://github.com/dlmiles/magic/security/code-scanning/65 --- commands/CmdWizard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/CmdWizard.c b/commands/CmdWizard.c index 06598a24..b66d8828 100644 --- a/commands/CmdWizard.c +++ b/commands/CmdWizard.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include #include #include @@ -976,7 +977,7 @@ cmdTsrFunc(tp) Tile *tp; { if (cmdTsearchDebug) - TxPrintf("%x\n", tp); + TxPrintf("%lx\n", (intmax_t) tp); numTilesFound++; return 0; } From 66297bd7d07aaadc783b1310934cad7d3cdaa302 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 05:31:49 +0100 Subject: [PATCH 052/206] extract/ExtTech.c: Too few arguments to formatting function Fix code scanning alert no. 60: Too few arguments to formatting function (#36) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtTech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtTech.c b/extract/ExtTech.c index 3dcdf9e6..127273f3 100644 --- a/extract/ExtTech.c +++ b/extract/ExtTech.c @@ -2976,7 +2976,7 @@ ExtTechLine(sectionName, argc, argv) ExtCurStyle->exts_antennaModel |= ANTENNAMODEL_CUMULATIVE; else TxError("Unknown antenna model \"%s\": Use \"partial\" or " - "\"cumulative\""); + "\"cumulative\"", argv[1]); if (argc > 2) { From 21924ec151fc4e4e8351f91a8a97c7c519ee8921 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 05:32:02 +0100 Subject: [PATCH 053/206] extract/ExtTech.c: Too few arguments to formatting function Fix code scanning alert no. 61: Too few arguments to formatting function (#35) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtTech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtTech.c b/extract/ExtTech.c index 127273f3..d936dd0c 100644 --- a/extract/ExtTech.c +++ b/extract/ExtTech.c @@ -2986,7 +2986,7 @@ ExtTechLine(sectionName, argc, argv) ExtCurStyle->exts_antennaModel |= ANTENNAMODEL_SIDEWALL; else TxError("Unknown antenna model \"%s\": Use \"surface\" or " - "\"sidewall\""); + "\"sidewall\"", argv[2]); } break; From 77c1082886daee5c5debc3e25148d6390736cfc3 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 05:43:02 +0100 Subject: [PATCH 054/206] grouter/grouteTest.c: Wrong type of arguments to formatting function Fix code scanning alert no. 100: Wrong type of arguments to formatting function (#31) * Update grouteTest.c * AI suggested just "%p", DLM modified to used intmax_t cast. --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- grouter/grouteTest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grouter/grouteTest.c b/grouter/grouteTest.c index 27b5163f..1aed3070 100644 --- a/grouter/grouteTest.c +++ b/grouter/grouteTest.c @@ -21,6 +21,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include #include @@ -371,9 +372,9 @@ glShowCross(pin, netId, kind) { (void) strcpy(name1, NLNetName(pin->gcr_pId)); (void) strcpy(name2, NLNetName(netId.netid_net)); - TxPrintf("%s (%d,%d), Net %s/%d->%s/%d, Ch %d\n", + TxPrintf("%s (%d,%d), Net %s/%d->%s/%d, Ch %ld\n", name, pin->gcr_point.p_x, pin->gcr_point.p_y, - name1, pin->gcr_pSeg, name2, netId.netid_seg, pin->gcr_ch); + name1, pin->gcr_pSeg, name2, netId.netid_seg, (intmax_t) pin->gcr_ch); } r.r_ll = r.r_ur = pin->gcr_point; From cf90d509996b319cf70d94b96c3449337abe52b0 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 05:43:36 +0100 Subject: [PATCH 055/206] grouter/grouteMaze.c: Wrong type of arguments to formatting function * Fix code scanning alert no. 99: Wrong type of arguments to formatting function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Update grouteMaze.c --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- grouter/grouteMaze.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grouter/grouteMaze.c b/grouter/grouteMaze.c index d422d6ba..2615adc7 100644 --- a/grouter/grouteMaze.c +++ b/grouter/grouteMaze.c @@ -26,6 +26,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" #include "utils/geofast.h" @@ -595,10 +596,10 @@ glPathPrint(path) pin = rp->gl_pin; ch = pin->gcr_ch; tp = rp->gl_tile; - TxPrintf("(%d,%d) cost=%d pcost=%d pId=%d/%d\n", + TxPrintf("(%d,%d) cost=%d pcost=%d pId=%ld/%d\n", pin->gcr_point.p_x, pin->gcr_point.p_y, rp->gl_cost, pin->gcr_cost, - pin->gcr_pId, pin->gcr_pSeg); + (intmax_t) pin->gcr_pId, pin->gcr_pSeg); TxPrintf("\tchan=(%d,%d,%d,%d)/%d\n", ch->gcr_area.r_xbot, ch->gcr_area.r_ybot, ch->gcr_area.r_xtop, ch->gcr_area.r_ytop, From fdc81f5eec17ca8b5085068daf0d14608d6c6615 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 05:46:10 +0100 Subject: [PATCH 056/206] windows/windDebug.c: Wrong type of arguments to formatting function Fix code scanning alert no. 129: Wrong type of arguments to formatting function (#24) * Update windDebug.c * AI wanted "%p", DLM changed to (intmax_t) "%lx" --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- windows/windDebug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/windows/windDebug.c b/windows/windDebug.c index a4cd11a8..d6c1844a 100644 --- a/windows/windDebug.c +++ b/windows/windDebug.c @@ -21,6 +21,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$"; #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" @@ -106,9 +107,9 @@ windDump() for (rc = windFirstClientRec; rc != (clientRec * ) NULL; rc = rc->w_nextClient) { - TxPrintf("'%10s' %x %x %x %x\n", rc->w_clientName, - rc->w_create, rc->w_delete, - rc->w_redisplay, rc->w_command); + TxPrintf("'%10s' %lx %lx %lx %lx\n", rc->w_clientName, + (intmax_t) rc->w_create, (intmax_t) rc->w_delete, + (intmax_t) rc->w_redisplay, (intmax_t) rc->w_command); } TxPrintf("\n"); From f69b02b092fbbd9eaac7092548028d87b045d871 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 057/206] sim/SimExtract.c: extEnumTilePerim() Call to function with fewer arguments than declared parameters This is a complete guess based on function parameter types and the locallity of the 'pNum' value. This error predates the 2017 Initial Commit git history. Copilot Autofix rejected: extEnumTilePerim(tile, devptr->exts_deviceSDTypes[i], SimTransTerms, (ClientData) &transistor, (ClientData) NULL ); CodeQL: https://github.com/dlmiles/magic/security/code-scanning/26 --- sim/SimExtract.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/SimExtract.c b/sim/SimExtract.c index 417c9879..eb7f0981 100644 --- a/sim/SimExtract.c +++ b/sim/SimExtract.c @@ -486,7 +486,7 @@ SimTransistorTile(tile, pNum, arg) devptr = ExtCurStyle->exts_device[t]; for (i = 0; !TTMaskHasType(&devptr->exts_deviceSDTypes[i], TT_SPACE); i++) - extEnumTilePerim(tile, devptr->exts_deviceSDTypes[i], + extEnumTilePerim(tile, devptr->exts_deviceSDTypes[i], pNum, SimTransTerms, (ClientData) &transistor ); } From 3c90bbbe1f26fc77b4036e2387cd75bcaad2e22b Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 05:58:45 +0100 Subject: [PATCH 058/206] lef/defWrite.c: Call to function with fewer arguments than declared parameters Fix code scanning alert no. 23: Call to function with fewer arguments than declared parameters (#38) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- lef/defWrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lef/defWrite.c b/lef/defWrite.c index ccbdef57..bb1b296b 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -441,7 +441,7 @@ char *defHNsprintfPrefix(hierName, str, divchar) char *cp, c; if (hierName->hn_parent) - str = defHNsprintfPrefix(hierName->hn_parent, str); + str = defHNsprintfPrefix(hierName->hn_parent, str, divchar); cp = hierName->hn_name; while (*str++ = *cp++) ; From f976005d2dd0e68558ee6bd3f5c30a4608ec15c3 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 00:43:42 +0100 Subject: [PATCH 059/206] resis/ResMerge.c: Too few arguments to formatting function Fix code scanning alert no. 64: Too few arguments to formatting function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- resis/ResMerge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resis/ResMerge.c b/resis/ResMerge.c index ff865492..57c35116 100644 --- a/resis/ResMerge.c +++ b/resis/ResMerge.c @@ -679,7 +679,8 @@ ResMergeNodes(node1, node2, pendingList, doneList) else { TxError("Bad plug node: is (%d %d), should be (%d %d)\n", - plug->rpl_node->rn_loc, node2->rn_loc); + plug->rpl_node->rn_loc.p_x, plug->rpl_node->rn_loc.p_y, + node2->rn_loc.p_x, node2->rn_loc.p_y); plug->rpl_node = NULL; } } From 499ac84ac05889543f80f5be9d9870efeb948651 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 06:11:54 +0100 Subject: [PATCH 060/206] database/DBio.c: Redundant null check due to previous dereference Fix code scanning alert no. 132: Redundant null check due to previous dereference (#39) * Update DBio.c * AI wanted to move guard 'pathptr != NULL' up to 1953, but it is assigned to guaranteed non-null in every assignment above and only incremented or dereferenced. --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- database/DBio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBio.c b/database/DBio.c index 889f7ba0..330afcda 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -2148,7 +2148,7 @@ badTransform: /* default path but the new cell has a (different) path. */ /* The paths only match if pathptr is the CWD. */ - else if ((pathptr != NULL) && (*pathptr != '\0')) + else if (*pathptr != '\0') { bool pathOK = FALSE; char *cwddir = getenv("PWD"); From d1dc038cb77f34ccad13653148bce761bbb98780 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 06:21:20 +0100 Subject: [PATCH 061/206] windows/windDisp.c: Redundant null check due to previous dereference Fix code scanning alert no. 133: Redundant null check due to previous dereference (#40) * Update windDisp.c * DLM - AI wanted to guard the '*area' dereference in if() statement, but the code path above has address of '&' operator for the assignment to 'area' so it must always be non-null. So I rejected this approach and removed the extra null check, replacing it with an assert(). --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- windows/windDisp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/windows/windDisp.c b/windows/windDisp.c index 63f8f40a..91b3533d 100644 --- a/windows/windDisp.c +++ b/windows/windDisp.c @@ -19,6 +19,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$"; #endif /* not lint */ +#include #include #include "tcltk/tclmagic.h" @@ -337,9 +338,11 @@ WindAreaChanged(w, area) /* will be copied into on the next display redraw. */ if ((w != NULL) && (w->w_backingStore == (ClientData)NULL) && - (!(w->w_flags & WIND_OBSCURED)) && (GrCreateBackingStorePtr != NULL)) - if ((area == (Rect *)NULL) || GEO_SURROUND(&biggerArea, &w->w_screenArea)) + (!(w->w_flags & WIND_OBSCURED)) && (GrCreateBackingStorePtr != NULL)) { + assert(area); // area is non-null + if (GEO_SURROUND(&biggerArea, &w->w_screenArea)) (*GrCreateBackingStorePtr)(w); + } } int From aa703a67b7ce2283e2a1fb71f345e06566c3cbcf Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 062/206] resis/ResDebug.c: %.2f Wrong type of arguments to formatting function Applied same fix as other patch for line below; Copilot Autofix: did not infer the same fix for same vaiable from line next to it. CodeQL: https://github.com/dlmiles/magic/security/code-scanning/158 --- resis/ResDebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resis/ResDebug.c b/resis/ResDebug.c index cd393f0a..be4775a9 100644 --- a/resis/ResDebug.c +++ b/resis/ResDebug.c @@ -80,7 +80,7 @@ ResPrintResistorList(fp, list) for (; list != NULL; list = list->rr_nextResistor) { if (fp == stdout) - TxPrintf("r (%d,%d) (%d,%d) r=%d\n", + TxPrintf("r (%d,%d) (%d,%d) r=%.2f\n", list->rr_connection1->rn_loc.p_x, list->rr_connection1->rn_loc.p_y, list->rr_connection2->rn_loc.p_x, From fc20977fa59fe5b412a8fe9f51ec76de5d4122c4 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 063/206] gcr/gcrDebug.c: (intmax_t) %ld Wrong type of arguments to formatting function Mutiple items per line. CodeQL: https://github.com/dlmiles/magic/security/code-scanning/87 --- gcr/gcrDebug.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/gcr/gcrDebug.c b/gcr/gcrDebug.c index 16a5bbcb..52fc698b 100644 --- a/gcr/gcrDebug.c +++ b/gcr/gcrDebug.c @@ -20,6 +20,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include #include @@ -454,33 +455,33 @@ gcrDumpPins(ch) TxPrintf("LEFT PINS\n"); for(i=0; i<=ch->gcr_width; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } pinArray=ch->gcr_rPins; TxPrintf("RIGHT PINS\n"); for(i=0; i<=ch->gcr_width; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } pinArray=ch->gcr_bPins; TxPrintf("BOTTOM PINS\n"); for(i=0; i<=ch->gcr_length; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } pinArray=ch->gcr_tPins; TxPrintf("TOP PINS\n"); for(i=0; i<=ch->gcr_length; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } } @@ -507,9 +508,9 @@ gcrDumpPinList(pin, dir) { if (pin) { - TxPrintf("Location (%d, %d)=%x: pNext=%d, pPrev=%d, id=%d\n", - pin->gcr_x, pin->gcr_y, pin, - pin->gcr_pNext, pin->gcr_pPrev, pin->gcr_pId); + TxPrintf("Location (%d, %d)=%lx: pNext=%ld, pPrev=%ld, id=%ld\n", + pin->gcr_x, pin->gcr_y, (intmax_t) pin, + (intmax_t) pin->gcr_pNext, (intmax_t) pin->gcr_pPrev, (intmax_t) pin->gcr_pId); if (dir) gcrDumpPinList(pin->gcr_pNext, dir); else gcrDumpPinList(pin->gcr_pPrev, dir); } From 4ddd0624cb3ae246ba8b4f7f39a0a0226e91fab8 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 06:41:36 +0100 Subject: [PATCH 064/206] gcr/gcrDebug.c: Wrong type of arguments to formatting function Fix code scanning alert no. 97: Wrong type of arguments to formatting function (#41) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- gcr/gcrDebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcr/gcrDebug.c b/gcr/gcrDebug.c index 52fc698b..dfb02ece 100644 --- a/gcr/gcrDebug.c +++ b/gcr/gcrDebug.c @@ -107,7 +107,7 @@ GCRRouteFromFile(fname) (void) GCRroute(ch); times(&tbuf2); TxPrintf("Time : %5.2fu %5.2fs\n", (tbuf2.tms_utime - - tbuf1.tms_utime)/60.0, (tbuf2.tms_stime-tbuf1.tms_stime)*60); + tbuf1.tms_utime)/60.0, (double)(tbuf2.tms_stime-tbuf1.tms_stime)*60); gcrDumpResult(ch, GcrShowEnd); gcrShowMap(ch); From 2703f55449645ede35d54831126b9b487cb93609 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 065/206] extract/ExtTest.c: Too few arguments to formatting function A bit of a guess based on context. CodeQL: https://github.com/dlmiles/magic/security/code-scanning/58 https://github.com/dlmiles/magic/security/code-scanning/59 --- extract/ExtTest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extract/ExtTest.c b/extract/ExtTest.c index 8b23b407..571b3a6c 100644 --- a/extract/ExtTest.c +++ b/extract/ExtTest.c @@ -191,11 +191,13 @@ ExtractTest(w, cmd) "Total interaction area processed = %ld (%.2f%%) / %ld (%.2f%%)\n", extSubtreeInteractionArea, ((double) extSubtreeInteractionArea) / ((double) a1) * 100.0, + areaInteraction, ((double) areaInteraction) / ((double) a2) * 100.0); TxPrintf( "Clipped interaction area= %ld (%.2f%%) / %ld (%.2f%%)\n", extSubtreeClippedArea, ((double) extSubtreeClippedArea) / ((double) a1) * 100.0, + areaClipped, ((double) areaClipped) / ((double) a2) * 100.0); extSubtreeTotalArea = 0; extSubtreeInteractionArea = 0; From 3848ec7b4ee55cbf5b31b1deb3d698ca4a0a0eeb Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 06:52:41 +0100 Subject: [PATCH 066/206] extract/ExtHier.c: Wrong type of arguments to formatting function Fix code scanning alert no. 71: Wrong type of arguments to formatting function (#37) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtHier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtHier.c b/extract/ExtHier.c index 4fc502b7..3f8c04f5 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -854,7 +854,7 @@ extOutputConns(table, outf) fprintf(outf, "merge \"%s\" \"%s\" %lg", nn->nn_name, nnext->nn_name, c); for (n = 0; n < ExtCurStyle->exts_numResistClasses; n++) - fprintf(outf, " %d %d", + fprintf(outf, " %ld %ld", node->node_pa[n].pa_area, node->node_pa[n].pa_perim); fprintf(outf, "\n"); From 9096946a124ddedcda09ac6b7b489fb3f31ae108 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 06:53:23 +0100 Subject: [PATCH 067/206] windows/windDebug.c: Wrong type of arguments to formatting function Fix code scanning alert no. 130: Wrong type of arguments to formatting function (#43) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- windows/windDebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/windDebug.c b/windows/windDebug.c index d6c1844a..feccaf59 100644 --- a/windows/windDebug.c +++ b/windows/windDebug.c @@ -54,7 +54,7 @@ windPrintWindow(w) LinkedRect *lr; TxPrintf("\nWindow %d: '%s'\n", w->w_wid, w->w_caption); - TxPrintf(" Client %x Surface %x \n", w->w_client, w->w_surfaceID); + TxPrintf(" Client %lx Surface %lx \n", w->w_client, w->w_surfaceID); TxPrintf(" All area (%d, %d) (%d, %d)\n", w->w_allArea.r_xbot, w->w_allArea.r_ybot, From f809b2dfac1f0b02de2bfbff83239376ca5d4eb3 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 06:53:41 +0100 Subject: [PATCH 068/206] graphics/grTk1.c: Wrong type of arguments to formatting function Fix code scanning alert no. 98: Wrong type of arguments to formatting function (#44) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- graphics/grTk1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/grTk1.c b/graphics/grTk1.c index c1fd2060..7712d333 100644 --- a/graphics/grTk1.c +++ b/graphics/grTk1.c @@ -535,7 +535,7 @@ GrTkInit(dispType) } else { - TxPrintf("Using %s, VisualID 0x%x depth %d\n", + TxPrintf("Using %s, VisualID 0x%lx depth %d\n", visual_type[grvisual_get[gritems].class], grvisual_get[gritems].visualid, grvisual_get[gritems].depth); From 5a8cdb68d022334cc29998a29149899b601c4ff0 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:11:16 +0100 Subject: [PATCH 069/206] ext2spice/ext2spice.c: Multiplication result converted to larger type Fix code scanning alert no. 49: Multiplication result converted to larger type (#52) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2spice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 47a671db..d57f27bc 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -2212,8 +2212,8 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_ybot * (double)scale + * (double)esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_ybot + plist->parm_offset) * scale * esScale * 1.0E-6); From 6cae64edc52801b3d40ff45bceafa232790051cd Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:12:08 +0100 Subject: [PATCH 070/206] drc/DRCbasic.c: Multiplication result converted to larger type Fix code scanning alert no. 35: Multiplication result converted to larger type (#53) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- drc/DRCbasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drc/DRCbasic.c b/drc/DRCbasic.c index 1ea451e2..0a6e1fdb 100644 --- a/drc/DRCbasic.c +++ b/drc/DRCbasic.c @@ -176,7 +176,7 @@ areaCheck(tile, arg) unsigned int i; int sqx, sqy; int sdist = arg->dCD_radial & 0xfff; - long sstest, ssdist = sdist * sdist; + long sstest, ssdist = (long) sdist * sdist; if ((arg->dCD_radial & RADIAL_NW) != 0) { From d6cc790d481b3ad3856fc6564af8526d1d01d36c Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:12:45 +0100 Subject: [PATCH 071/206] extflat/EFvisit.c: Multiplication result converted to larger type Fix code scanning alert no. 50: Multiplication result converted to larger type (#51) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extflat/EFvisit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extflat/EFvisit.c b/extflat/EFvisit.c index e28b7135..285677da 100644 --- a/extflat/EFvisit.c +++ b/extflat/EFvisit.c @@ -789,7 +789,7 @@ EFNodeResist(node) if (v < 0.0) s = 0.0; else s = sqrt(v); fperim = (float) perim; - dresist = (fperim + s)/(fperim - s) * efResists[n]; + dresist = ((double)fperim + (double)s)/((double)fperim - (double)s) * efResists[n]; if (dresist + (double) resist > (double) INT_MAX) resist = INT_MAX; else From 00086817a4f98469752e650155ab6cf6d54ea013 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:13:21 +0100 Subject: [PATCH 072/206] extract/ExtCouple.c: Multiplication result converted to larger type Fix code scanning alert no. 51: Multiplication result converted to larger type (#50) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtCouple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtCouple.c b/extract/ExtCouple.c index bffe1893..80a177d6 100644 --- a/extract/ExtCouple.c +++ b/extract/ExtCouple.c @@ -963,7 +963,7 @@ extRemoveSubcap(bp, clip, esws) if (dnear < 0) dnear = 0; /* Don't count underlap */ mult = ExtCurStyle->exts_overlapMult[ta][0]; - snear = 0.6366 * atan(mult * dnear); + snear = 0.6366 * atan((double)mult * dnear); /* "snear" is the fractional portion of the fringe cap seen by */ /* the substrate, so (1.0 - snear) is the part that is blocked. */ From 1a351efd56b2afe0ee4f388db299945536f85c1a Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:13:59 +0100 Subject: [PATCH 073/206] extract/ExtBasic.c: Multiplication result converted to larger type Fix code scanning alert no. 52: Multiplication result converted to larger type (#49) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtBasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 14bc7eed..ad15e8bd 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -612,7 +612,7 @@ extSetResist(reg) reg->nreg_pa[n].pa_perim = perim = extResistPerim[n]; if (area > 0 && perim > 0) { - v = (double) (perim*perim - 16*area); + v = (double) ((dlong)perim * perim - 16 * area); /* Approximate by one square if v < 0 */ if (v < 0) s = 0; else s = sqrt(v); From 5ffc74d915f450f70f27e19ac2fd26020599ae11 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:14:32 +0100 Subject: [PATCH 074/206] lef/defWrite.c: Multiplication result converted to larger type Fix code scanning alert no. 53: Multiplication result converted to larger type (#48) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- lef/defWrite.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lef/defWrite.c b/lef/defWrite.c index bb1b296b..96896a90 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -2285,8 +2285,7 @@ defCountCompFunc(cellUse, total) int sy = cellUse->cu_yhi - cellUse->cu_ylo + 1; // TxPrintf("Diagnostic: cell %s %d %d\n", cellUse->cu_id, sx, sy); ASSERT(sx >= 0 && sy >= 0, "Valid array"); - - (*total) += sx * sy; /* Increment the count of uses */ + (*total) += (unsigned long)sx * sy; /* Increment the count of uses */ return 0; /* Keep the search going */ } From 40f96faff81579560834e8fa6956d05462abd144 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:15:06 +0100 Subject: [PATCH 075/206] plot/plotPNM.c: Multiplication result converted to larger type Fix code scanning alert no. 55: Multiplication result converted to larger type (#47) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- plot/plotPNM.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plot/plotPNM.c b/plot/plotPNM.c index 4e2a29a4..6d6cdf59 100644 --- a/plot/plotPNM.c +++ b/plot/plotPNM.c @@ -877,7 +877,7 @@ PlotPNM(fileName, scx, layers, xMask, width) /* Clear tile memory with the background gray level */ memset((void *)rtile, PlotPNMBG, - (size_t)(ds_xsize * ds_ysize * PIXELSZ)); + (size_t)ds_xsize * ds_ysize * PIXELSZ); if (SigInterruptPending) { From 846f2b4cb1f0e3a30c896c09225e72116f6d5b17 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:15:46 +0100 Subject: [PATCH 076/206] debug/debugFlags.c: Wrong type of arguments to formatting function Fix code scanning alert no. 68: Wrong type of arguments to formatting function (#46) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- debug/debugFlags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debug/debugFlags.c b/debug/debugFlags.c index 7e759569..12e00f32 100644 --- a/debug/debugFlags.c +++ b/debug/debugFlags.c @@ -121,7 +121,7 @@ DebugAddFlag(clientID, name) if (id < 0 || id >= debugNumClients) { - TxError("DebugAddFlag: bad client id %d (flag %s)\n", clientID, name); + TxError("DebugAddFlag: bad client id %lu (flag %s)\n", clientID, name); return (0); } @@ -165,7 +165,7 @@ DebugShow(clientID) if (id < 0 || id >= debugNumClients) { - TxError("DebugShow: bad client id %d\n", clientID); + TxError("DebugShow: bad client id %lu\n", clientID); return; } dc = &debugClients[id]; From d8b886aa1dbe4b58e9b5c3cece9c4ed77d77b820 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:16:10 +0100 Subject: [PATCH 077/206] debug/debugFlags.c: Wrong type of arguments to formatting function Fix code scanning alert no. 67: Wrong type of arguments to formatting function (#45) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- debug/debugFlags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/debugFlags.c b/debug/debugFlags.c index 12e00f32..9a71b392 100644 --- a/debug/debugFlags.c +++ b/debug/debugFlags.c @@ -208,7 +208,7 @@ DebugSet(clientID, argc, argv, value) if (id < 0 || id >= debugNumClients) { - TxError("DebugSet: bad client id %d\n", clientID); + TxError("DebugSet: bad client id %lu\n", (unsigned long)clientID); return; } dc = &debugClients[id]; From 1fb82e72252fbe4dc337e243ea940d54ec3032a2 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:17:16 +0100 Subject: [PATCH 078/206] database/DBtiles.c: Multiplication result converted to larger type Fix code scanning alert no. 30: Multiplication result converted to larger type (#55) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- database/DBtiles.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/database/DBtiles.c b/database/DBtiles.c index 1996b6bd..cfd8f8aa 100644 --- a/database/DBtiles.c +++ b/database/DBtiles.c @@ -565,15 +565,15 @@ enumerate: theight = TOP(tp) - BOTTOM(tp); twidth = RIGHT(tp) - LEFT(tp); f1 = (rect->r_ybot > MINFINITY + 2) ? - (TOP(tp) - rect->r_ybot) * twidth : DLONG_MAX; + (dlong)(TOP(tp) - rect->r_ybot) * (dlong)twidth : DLONG_MAX; f2 = (rect->r_ytop < INFINITY - 2) ? - (rect->r_ytop - BOTTOM(tp)) * twidth : DLONG_MAX; + (dlong)(rect->r_ytop - BOTTOM(tp)) * (dlong)twidth : DLONG_MAX; if (TTMaskHasType(mask, SplitLeftType(tp))) { /* !Outside-of-triangle check */ f4 = (rect->r_xbot > MINFINITY + 2) ? - (rect->r_xbot - LEFT(tp)) * theight : DLONG_MIN; + (dlong)(rect->r_xbot - LEFT(tp)) * (dlong)theight : DLONG_MIN; if (SplitDirection(tp) ? (f1 > f4) : (f2 > f4)) { TiSetBody(tp, (ClientData)((TileType)TiGetBody(tp) @@ -587,7 +587,7 @@ enumerate: { /* !Outside-of-triangle check */ f3 = (rect->r_xtop < INFINITY - 2) ? - (RIGHT(tp) - rect->r_xtop) * theight : DLONG_MIN; + (dlong)(RIGHT(tp) - rect->r_xtop) * (dlong)theight : DLONG_MIN; if (SplitDirection(tp) ? (f2 > f3) : (f1 > f3)) { TiSetBody(tp, (ClientData)((TileType)TiGetBody(tp) From 691c27081ff6d79deded3660d1dee945f7375fe5 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:17:51 +0100 Subject: [PATCH 079/206] drc/DRCcif.c: Multiplication result converted to larger type Fix code scanning alert no. 34: Multiplication result converted to larger type (#54) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- drc/DRCcif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drc/DRCcif.c b/drc/DRCcif.c index 3a170ff6..d597ec57 100644 --- a/drc/DRCcif.c +++ b/drc/DRCcif.c @@ -1076,7 +1076,7 @@ areaCifCheck(tile, arg) unsigned int i; int sqx, sqy; int sdist = arg->dCD_radial & 0xfff; - long sstest, ssdist = sdist * sdist; + long sstest, ssdist = (long) sdist * sdist; if ((arg->dCD_radial & RADIAL_NW) != 0) { From 82bec60ccf8b81c528e383ff3342b15812271513 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:30:37 +0100 Subject: [PATCH 080/206] ext2spice/ext2hier.c: Multiplication result converted to larger type Fix code scanning alert no. 36: Multiplication result converted to larger type (#57) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2hier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index 0fe10f25..ed44062a 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -167,13 +167,13 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) fprintf(esSpiceF, " %s=", plist->parm_name); parmval = dev->dev_area; if (esScale < 0) - fprintf(esSpiceF, "%g", parmval * scale * scale); + fprintf(esSpiceF, "%g", (double)parmval * scale * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale * scale + fprintf(esSpiceF, "%g", (double)parmval * scale * scale * esScale * esScale * plist->parm_scale * 1E-12); else - esSIvalue(esSpiceF, 1.0E-12 * (parmval + plist->parm_offset) + esSIvalue(esSpiceF, 1.0E-12 * ((double)parmval + plist->parm_offset) * scale * scale * esScale * esScale); } else From 86a6551f9b932ffd3b835d09f536c01fb0527192 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:30:52 +0100 Subject: [PATCH 081/206] ext2spice/ext2hier.c: Multiplication result converted to larger type Fix code scanning alert no. 37: Multiplication result converted to larger type (#58) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2hier.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index ed44062a..f066f672 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -217,11 +217,11 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", parmval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)parmval * (double)scale + * (double)esScale * (double)plist->parm_scale * 1E-6); else - esSIvalue(esSpiceF, (parmval + plist->parm_offset) - * scale * esScale * 1.0E-6); + esSIvalue(esSpiceF, ((double)parmval + (double)plist->parm_offset) + * (double)scale * (double)esScale * 1.0E-6); } else { From fe39d889f0ba764864110d1db6a4bf5ee9a7ef3b Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:31:06 +0100 Subject: [PATCH 082/206] plot/plotRutils.c: Multiplication result converted to larger type Fix code scanning alert no. 54: Multiplication result converted to larger type (#56) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- plot/plotRutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plot/plotRutils.c b/plot/plotRutils.c index 821567a5..35fcce50 100644 --- a/plot/plotRutils.c +++ b/plot/plotRutils.c @@ -519,7 +519,7 @@ PlotDumpRaster(raster, file) int count; count = write(fileno(file), (char *) raster->ras_bits, - raster->ras_bytesPerLine*raster->ras_height); + (size_t)raster->ras_bytesPerLine * raster->ras_height); if (count < 0) { TxError("I/O error in writing raster file: %s.\n", From 147ca7a61fd4d245d44e0c1f9e96dc9c49d8319b Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:46:06 +0100 Subject: [PATCH 083/206] ext2spice/ext2hier.c: Multiplication result converted to larger type Fix code scanning alert no. 40: Multiplication result converted to larger type (#64) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2hier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index f066f672..e03b647a 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -304,7 +304,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", w * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", w * scale * esScale + fprintf(esSpiceF, "%g", (double)w * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (w + plist->parm_offset) From 9327388ae0a5a520ae30b2f89c147659f4012cb1 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:46:19 +0100 Subject: [PATCH 084/206] ext2spice/ext2hier.c: Multiplication result converted to larger type Fix code scanning alert no. 42: Multiplication result converted to larger type (#65) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2hier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index e03b647a..fbde50e0 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -332,8 +332,8 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_ybot * (double)scale + * (double)esScale * (double)plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_ybot + plist->parm_offset) * scale * esScale * 1.0E-6); From cde5418e7d589c063bfe40b21a13d65da5b3898e Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:46:35 +0100 Subject: [PATCH 085/206] ext2spice/ext2spice.c: Multiplication result converted to larger type Fix code scanning alert no. 43: Multiplication result converted to larger type (#59) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2spice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index d57f27bc..54dff3d7 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -2011,8 +2011,8 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", parmval * scale * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale * scale - * esScale * esScale * plist->parm_scale + fprintf(esSpiceF, "%g", (double)parmval * (double)scale * (double)scale + * (double)esScale * (double)esScale * plist->parm_scale * 1E-12); else esSIvalue(esSpiceF, 1.0E-12 * (parmval + plist->parm_offset) From 7e0408987293c9dc87ab9c63d2faf241f886f1d0 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:46:50 +0100 Subject: [PATCH 086/206] ext2spice/ext2spice.c: Multiplication result converted to larger type Fix code scanning alert no. 44: Multiplication result converted to larger type (#60) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2spice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 54dff3d7..5605dfa5 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -2078,7 +2078,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", parmval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale + fprintf(esSpiceF, "%g", (double)parmval * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-12 * (parmval + plist->parm_offset) From a6db54c0b75c48b7adca754c6409a7bdca58e0c7 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:47:05 +0100 Subject: [PATCH 087/206] ext2spice/ext2spice.c: Multiplication result converted to larger type Fix code scanning alert no. 45: Multiplication result converted to larger type (#61) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2spice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 5605dfa5..60b9022f 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -2142,7 +2142,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", l * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", l * scale * esScale + fprintf(esSpiceF, "%g", (double)l * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (l + plist->parm_offset) From 3becc0e03f42cfa35eb0ccbfc895c24a6947b1c5 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:47:20 +0100 Subject: [PATCH 088/206] ext2spice/ext2spice.c: Multiplication result converted to larger type Fix code scanning alert no. 47: Multiplication result converted to larger type (#62) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2spice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 60b9022f..3f877444 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -2184,7 +2184,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", w * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", w * scale * esScale + fprintf(esSpiceF, "%g", (double)w * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (w + plist->parm_offset) From 98b5f57ea0004907e94788cea46add450b631a3c Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 07:47:40 +0100 Subject: [PATCH 089/206] ext2spice/ext2spice.c: Multiplication result converted to larger type Fix code scanning alert no. 48: Multiplication result converted to larger type (#63) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- ext2spice/ext2spice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 3f877444..50c2ee93 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -2201,7 +2201,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_xbot * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_xbot + plist->parm_offset) From 4dc708aea26377b639a6fc4f2df29f44ff01487c Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 090/206] ext2spice/ext2spice.c: Multiplication result converted to larger type Applying similat fix to others in the file, promote to double ASAP. Copilot Autofix: Retry and if the problem persists contact support. CodeQL: https://github.com/dlmiles/magic/security/code-scanning/46 --- ext2spice/ext2spice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 50c2ee93..09cef4ee 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -2166,7 +2166,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dval * scale * esScale + fprintf(esSpiceF, "%g", (double)dval * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dval + plist->parm_offset) From 14a1b21fb6c0acfd86533ca3577a0e61fe501f9b Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 08:03:22 +0100 Subject: [PATCH 091/206] extract/ExtHier.c: Wrong type of arguments to formatting function Fix code scanning alert no. 159: Wrong type of arguments to formatting function (#66) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- extract/ExtHier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtHier.c b/extract/ExtHier.c index 3f8c04f5..e886267b 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -854,7 +854,7 @@ extOutputConns(table, outf) fprintf(outf, "merge \"%s\" \"%s\" %lg", nn->nn_name, nnext->nn_name, c); for (n = 0; n < ExtCurStyle->exts_numResistClasses; n++) - fprintf(outf, " %ld %ld", + fprintf(outf, " %ld %d", node->node_pa[n].pa_area, node->node_pa[n].pa_perim); fprintf(outf, "\n"); From 2c8c60510b1641da363bf0c26ad84f8359528719 Mon Sep 17 00:00:00 2001 From: Darryl Miles Date: Mon, 30 Sep 2024 08:04:03 +0100 Subject: [PATCH 092/206] plot/plotRutils.c: Multiplication result converted to larger type Fix code scanning alert no. 56: Multiplication result converted to larger type (#67) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- plot/plotRutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plot/plotRutils.c b/plot/plotRutils.c index 35fcce50..ec0e2485 100644 --- a/plot/plotRutils.c +++ b/plot/plotRutils.c @@ -231,7 +231,7 @@ PlotClearRaster(raster, area) if (area == NULL) { bzero((char *) raster->ras_bits, - raster->ras_bytesPerLine * raster->ras_height); + (size_t)raster->ras_bytesPerLine * raster->ras_height); return; } From 7509802b3d18196bbc50b96e3a28a68b80b273a1 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 093/206] mzrouter/mzDebug.c: (intmax_t) %lx Wrong type of arguments to formatting function Copilot Autofix rejected: TxPrintf("tile %p (x: %d to %d, y: %d to %d)\n" CodeQL: https://github.com/dlmiles/magic/security/code-scanning/101 --- mzrouter/mzDebug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mzrouter/mzDebug.c b/mzrouter/mzDebug.c index 2b440a1f..5f32f0ff 100644 --- a/mzrouter/mzDebug.c +++ b/mzrouter/mzDebug.c @@ -22,6 +22,7 @@ static char rcsid[] __attribute__ ((unused)) = "$$"; #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/signals.h" @@ -540,8 +541,8 @@ mzDumpTagsFunc(tile, cxp) TITORECT(tile, &r); /* print tile bounds */ - TxPrintf("tile %x (x: %d to %d, y: %d to %d)\n", - (pointertype) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); + TxPrintf("tile %lx (x: %d to %d, y: %d to %d)\n", + (intmax_t) (pointertype) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); /* dump rects attached to client field */ { From 62ebf49758a5af2cb82909e586fd638515b6f69e Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 094/206] mzrouter/mzEstimate.c: (intmax_t) %lx Wrong type of arguments to formatting function Copilot Autofix rejected: TxPrintf("\ntile %p\t\t (x: %d to %d, y: %d to %d)\n", CodeQL: https://github.com/dlmiles/magic/security/code-scanning/102 --- mzrouter/mzEstimate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mzrouter/mzEstimate.c b/mzrouter/mzEstimate.c index 2f014f44..d32e8fd7 100644 --- a/mzrouter/mzEstimate.c +++ b/mzrouter/mzEstimate.c @@ -91,6 +91,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" @@ -1998,8 +1999,8 @@ mzDumpEstFunc(tile, fd) } else { - TxPrintf("\ntile %x\t\t (x: %d to %d, y: %d to %d)\n", - (pointertype) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); + TxPrintf("\ntile %lx\t\t (x: %d to %d, y: %d to %d)\n", + (intmax_t) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); TxPrintf("\thcost = %d, ", tilec->tc_hCost); TxPrintf("vcost = %d \n", From 290887912f40ae864f2100d2056f03ac3bdd1af2 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 095/206] ext2spice/ext2hier.c: Wrong type of arguments to formatting function Applied the same fixes as other commits already merged into file. Copilot Autofix: Error contact support... CodeQL: https://github.com/dlmiles/magic/security/code-scanning/38 https://github.com/dlmiles/magic/security/code-scanning/39 https://github.com/dlmiles/magic/security/code-scanning/41 --- ext2spice/ext2hier.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index fbde50e0..725374b1 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -262,7 +262,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", l * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", l * scale * esScale + fprintf(esSpiceF, "%g", (double)l * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (l + plist->parm_offset) @@ -286,7 +286,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dval * scale * esScale + fprintf(esSpiceF, "%g", (double)dval * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dval + plist->parm_offset) @@ -321,8 +321,8 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_xbot * (double)scale + * (double)esScale * (double)plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_xbot + plist->parm_offset) * scale * esScale * 1.0E-6); From 48853b98a3b346043144e79a6173b1a2492eca3d Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 096/206] calma/CalmaRead.c missing initialization An FEOF exit path exists in READRH() which causes the output variable(s) to not be assigned a value, then the code makes a decision (branch) based on uninitialized data. SonarCloud detection CalmaRead.c:359:The left operand of '!=' is a garbage value https://sonarcloud.io/project/issues?open=AZJB17gSNGfDNup0Rkp5&id=dlmiles_magic --- calma/CalmaRead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calma/CalmaRead.c b/calma/CalmaRead.c index d8db3fdf..08b0c0b6 100644 --- a/calma/CalmaRead.c +++ b/calma/CalmaRead.c @@ -345,7 +345,7 @@ done: bool calmaParseUnits() { - int nbytes, rtype; + int nbytes, rtype = 0; double metersPerDBUnit; double userUnitsPerDBUnit; double cuPerDBUnit; From 973c9a4d1a66f09169d0437a52ff269ed18739b9 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 097/206] database/DBio.c read of variable before initialization Due to FEOF condition and handling it is possible local variable 'c' is not initialized before being read and compared. SonarCloud retails DBio.c:3049 The left operand of '==' is a garbage value https://sonarcloud.io/project/issues?open=AZJB16rxNGfDNup0Ribf&id=dlmiles_magic --- database/DBio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBio.c b/database/DBio.c index 330afcda..c30dff12 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -3034,7 +3034,7 @@ dbFgets(line, len, f) { char *cs; int l; - int c; + int c = EOF; do { From 543bd5a5b85259f93a9d6cc095089dbd107c5a69 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 098/206] ext2sim/sim2simp.c ParseAttr does not return a value SonarCloud ext2sim/sim2simp.c:43 non-void function 'parseAttr' should return a value https://sonarcloud.io/project/issues?open=AZJB17kzNGfDNup0RkzS&id=dlmiles_magic --- ext2sim/sim2simp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2sim/sim2simp.c b/ext2sim/sim2simp.c index 59a65739..b3029d53 100644 --- a/ext2sim/sim2simp.c +++ b/ext2sim/sim2simp.c @@ -31,7 +31,7 @@ char *s; return p; } -int parseAttr(str, a, p) +void parseAttr(str, a, p) char *str; int *a, *p; { From a9b707460b20b5e2d78dfe0d91cfd9ecfbddc5ee Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 099/206] garouter/gaChannel.c use of unintialized or incorrect variable This resolution assumes that all records and values of ch->gcr_type are expected to be one of the 3 cases in the switch. The bug it on the first iteration it is possible 'tot' and 'clear' is just not initializaed and on a subsequent iteration it is possible it ot setup to the previous interation values. SonarCloud garouter/gaChannel.c:385:3rd function call argument is an uninitialized value https://sonarcloud.io/project/issues?open=AZJB17fFNGfDNup0RkoE&id=dlmiles_magic --- garouter/gaChannel.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/garouter/gaChannel.c b/garouter/gaChannel.c index 718631d9..a7b9a584 100644 --- a/garouter/gaChannel.c +++ b/garouter/gaChannel.c @@ -381,11 +381,17 @@ gaChannelStats(list) tot = &gaTotRiverCross; clear = &gaClearRiverCross; break; + default: /* otherwise tot and clear is not intialized */ + tot = NULL; + clear = NULL; + break; + } + if(tot && clear) { + gaPinStats(ch->gcr_tPins, ch->gcr_length, tot, clear); + gaPinStats(ch->gcr_bPins, ch->gcr_length, tot, clear); + gaPinStats(ch->gcr_lPins, ch->gcr_width, tot, clear); + gaPinStats(ch->gcr_rPins, ch->gcr_width, tot, clear); } - gaPinStats(ch->gcr_tPins, ch->gcr_length, tot, clear); - gaPinStats(ch->gcr_bPins, ch->gcr_length, tot, clear); - gaPinStats(ch->gcr_lPins, ch->gcr_width, tot, clear); - gaPinStats(ch->gcr_rPins, ch->gcr_width, tot, clear); } numTot = gaTotRiverCross + gaTotNormCross; From 5e00e3fe1bb18433b248ac48870f120f78301cb2 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 100/206] graphics/cairo_orig/grTCairo3.c uninitialized value Looks like old code. Looks like local variable 'j' could be removed. Initialization lowers the severity of concern in this area. The 'j' variable is now written but never read. SonarCloud graphics/cairo_orig/grTCairo3.c:492 The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage https://sonarcloud.io/project/issues?open=AZJB16voNGfDNup0Rig_&id=dlmiles_magic --- graphics/cairo_orig/grTCairo3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/cairo_orig/grTCairo3.c b/graphics/cairo_orig/grTCairo3.c index d86d3f0f..387fce35 100644 --- a/graphics/cairo_orig/grTCairo3.c +++ b/graphics/cairo_orig/grTCairo3.c @@ -478,7 +478,7 @@ int pixsize; { Point *tp; int np, nptotal; - int i, j; + int i, j = 0; static int maxnp = 0; FontChar *ccur; From 10442b65345a3d36bcdb9a1b6c7998cc55f9bfda Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 101/206] graphics/cairo_orig/grTCairo5.c uninitialized local variable Looks like old code. Based on cairo_fill() action state this is initialized to no-op by default. SonarCloud graphics/cairo_orig/grTCairo5.c:107 The left operand of '!=' is a garbage value https://sonarcloud.io/project/issues?open=AZJB16wANGfDNup0RiiZ&id=dlmiles_magic --- graphics/cairo_orig/grTCairo5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/cairo_orig/grTCairo5.c b/graphics/cairo_orig/grTCairo5.c index 88ba9a64..903cf8e1 100644 --- a/graphics/cairo_orig/grTCairo5.c +++ b/graphics/cairo_orig/grTCairo5.c @@ -73,7 +73,7 @@ Point *p; /* screen pos of lower left corner */ } } if ((!anyObscure) && (GEO_SURROUND(&grCurClip, &bBox)) ) { - int *pixelp, x, y, thisp, lastp; + int *pixelp, x, y, thisp, lastp = -1; int color, red, green, blue, mask; /* no clipping, try to go quickly */ From ae0cdd9fea03e3ac56e923aa711617bb2cec1dc2 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 102/206] graphics/grClip.c Branch condition evaluates to a garbage value This is technically a false positive as grClipPoints() will always initializes a value to ok1 and ok2 when called. The function is in the same compile unit, so probably the compiler can see this as well and potentially not perform the initiailization begin performed in this commit. But to quieten and remove this item from the analysis report assigning an initialization value. SonarCloud graphics/grClip.c:451 Branch condition evaluates to a garbage value https://sonarcloud.io/project/issues?open=AZJB160MNGfDNup0Rit4&id=dlmiles_magic --- graphics/grClip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/grClip.c b/graphics/grClip.c index 7631ba75..d90b5500 100644 --- a/graphics/grClip.c +++ b/graphics/grClip.c @@ -434,7 +434,7 @@ GrClipLine(x1, y1, x2, y2) { Point p1, p2; Rect c; - bool ok1, ok2; + bool ok1 = FALSE, ok2 = FALSE; c = ob->r_r; c.r_xbot--; c.r_ybot--; c.r_xtop++; c.r_ytop++; From be258c655701b249e741bbe676dc7cba6bd0e836 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 103/206] graphics/grOGL1.c: non-void function does not return a value Making oglSetProjection() return void, like toglSetProjection() SonarCloud graphics/grOGL1.c:408 non-void function does not return a value https://sonarcloud.io/project/issues?open=AZJB16z6NGfDNup0Riro&id=dlmiles_magic --- graphics/grOGL1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/grOGL1.c b/graphics/grOGL1.c index ab505b9f..ae18c04e 100644 --- a/graphics/grOGL1.c +++ b/graphics/grOGL1.c @@ -375,7 +375,7 @@ glTransYs(int wy) * Set the OpenGL viewport (projection matrix) for the current window *---------------------------------------------------------------------- */ -int +void oglSetProjection(llx, lly, width, height) int llx, lly, width, height; { From 29ee09407413727007b5aa4290625ad57b16a106 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 104/206] graphics/grOGL1.c Dereference of null pointer Looks like the code below requires mw!=NULL to do anything useful. So when mw==NULL we don't continue processing X11 Event. SonarCloud graphics/grOGL1.c:563 Dereference of null pointer https://sonarcloud.io/project/issues?open=AZJB16z6NGfDNup0Riss&id=dlmiles_magic --- graphics/grOGL1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphics/grOGL1.c b/graphics/grOGL1.c index ae18c04e..db1754a9 100644 --- a/graphics/grOGL1.c +++ b/graphics/grOGL1.c @@ -557,6 +557,8 @@ pipehandler() entry = HashLookOnly(&grOGLWindowTable, ExposeEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; + if(!mw) + break; screenRect.r_xbot = ExposeEvent->x; screenRect.r_xtop = ExposeEvent->x + ExposeEvent->width; From a0aea2aa2e81077612ddc05d3fb552ee5908fd15 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 105/206] gcr/gcrDebug.c Add a field width specifier to this "%s" placeholder. Unbounded local buffer used in fscanf() string extraction call. Add width to specified to ensure truncation as 24 character instead of buffer overflow. SonarCloud https://sonarcloud.io/project/issues?open=AZJB17OzNGfDNup0Rj9x&id=dlmiles_magic --- gcr/gcrDebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcr/gcrDebug.c b/gcr/gcrDebug.c index dfb02ece..0af716b6 100644 --- a/gcr/gcrDebug.c +++ b/gcr/gcrDebug.c @@ -195,7 +195,7 @@ gcrMakeChannel(ch, fp) * p and P mean poly is blocked. Upper case means vacate the * column, lower case means vacate the track. */ - if (fscanf(fp, "%s", s) != 1) + if (fscanf(fp, "%24s", s) != 1) { TxError("Format error in router input file\n"); return (FALSE); From 0cea17e8015c759182424236eea7d669b2f25676 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 106/206] utils/magic.h pointertype prefer use of 'long' instead of 'int' It is usual for a pointer to require the largest width, while some platforms might have an 'int' that is smaller than a pointer width. This reverses the detection order to find. Note since C99 there is with type 'intmax_t' which serves a similar purpose. SonarCloud reports a concern with this on many lines where used. "An integral type is too small to hold a pointer value." https://sonarcloud.io/project/issues?open=AZJB17ZoNGfDNup0RkY_&id=dlmiles_magic --- utils/magic.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/magic.h b/utils/magic.h index d0b78e67..ca9e1eec 100644 --- a/utils/magic.h +++ b/utils/magic.h @@ -36,12 +36,12 @@ #define SIZEOF_VOID_P SIZEOF_UNSIGNED_INT #endif -#if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT -typedef unsigned int pointertype; -typedef signed int spointertype; -#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG +#if SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG typedef unsigned long pointertype; typedef signed long spointertype; +#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT +typedef unsigned int pointertype; +typedef signed int spointertype; #else ERROR: Cannot compile without knowing the size of a pointer. See utils/magic.h #endif From 8b2efd5d7d745d7a1ad691b6ba5302b8e546c5e1 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 107/206] gcr/gcrDebug.c Opened stream never closed. Potential resource leak A false positive in practice, made clearer by using a 2nd variable with attention drawing name. SonarCloud gcr/gcrDebug.c:429 Opened stream never closed. Potential resource leak https://sonarcloud.io/project/issues?open=AZJB17OzNGfDNup0Rj-t&id=dlmiles_magic --- gcr/gcrDebug.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gcr/gcrDebug.c b/gcr/gcrDebug.c index 0af716b6..de233897 100644 --- a/gcr/gcrDebug.c +++ b/gcr/gcrDebug.c @@ -373,14 +373,13 @@ gcrPrDensity(ch, chanDensity) { int i, diff; char name[256]; - FILE *fp; + FILE *fp, *fp_always_close; (void) sprintf(name, "dens.%d.%d.%d.%d", ch->gcr_area.r_xbot, ch->gcr_area.r_ybot, ch->gcr_area.r_xtop, ch->gcr_area.r_ytop); - fp = fopen(name, "w"); - if (fp == NULL) - fp = stdout; + fp_always_close = fopen(name, "w"); + fp = fp_always_close ? fp_always_close : stdout; fprintf(fp, "Chan width: %d\n", ch->gcr_width); fprintf(fp, "Chan length: %d\n", ch->gcr_length); @@ -424,8 +423,8 @@ gcrPrDensity(ch, chanDensity) } (void) fflush(fp); - if (fp != stdout) - (void) fclose(fp); + if (fp_always_close != NULL) + (void) fclose(fp_always_close); } /* From ab747a0f8c1f9307326a97e4da341bcbc7c29671 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 108/206] grouter/groutePin.c: multiple: non-void function does not return a value Multiple reports exists in this file Affected functions: GLInitPins() now returns void glPinArrayInit() now returns void GLLinkPins() now returns void glPinArrayLink() now returns void GLFixStemPins() now returns void glPinArrayFixStems() now returns void SonarCloud https://sonarcloud.io/project/issues?open=AZJB17L0NGfDNup0Rj0D&id=dlmiles_magic --- grouter/groutePin.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/grouter/groutePin.c b/grouter/groutePin.c index f286ad15..5384d109 100644 --- a/grouter/groutePin.c +++ b/grouter/groutePin.c @@ -130,7 +130,7 @@ glPointToPin(ch, side, point) * ---------------------------------------------------------------------------- */ -int +void GLInitPins(ch) GCRChannel *ch; { @@ -140,7 +140,7 @@ GLInitPins(ch) glPinArrayInit(ch, GEO_EAST, ch->gcr_rPins, ch->gcr_width); } -int +void glPinArrayInit(ch, side, pins, nPins) GCRChannel *ch; GCRPin *pins; @@ -352,7 +352,7 @@ glPinArrayBlock(ch, pins, opins, nPins) * ---------------------------------------------------------------------------- */ -int +void GLLinkPins(ch) GCRChannel *ch; { @@ -362,7 +362,7 @@ GLLinkPins(ch) glPinArrayLink(ch->gcr_rPins, ch->gcr_width); } -int +void glPinArrayLink(pins, nPins) GCRPin *pins; int nPins; @@ -452,7 +452,7 @@ glShowPin(pin) * ---------------------------------------------------------------------------- */ -int +void GLFixStemPins(ch) GCRChannel *ch; { @@ -462,7 +462,7 @@ GLFixStemPins(ch) glPinArrayFixStems(ch->gcr_rPins, ch->gcr_width); } -int +void glPinArrayFixStems(pins, nPins) GCRPin *pins; int nPins; From bfd818fbd333339de45fb84f896557f91cfcea61 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 109/206] textio/txInput.c non-void function does not return a value This function is related to libreadline rl_pre_input_hook callback which is invoked as (not making use of any function return value): readline.c: (*rl_pre_input_hook) (); The general prototype for this function is: rltypedefs.h:typedef int rl_hook_func_t PARAMS((void)); So the resolution is to provide a known value as the return value, which resolves the concern. SonarCloud textio/txInput.c:550 non-void function does not return a value https://sonarcloud.io/project/issues?open=AZJB17NwNGfDNup0Rj5G&id=dlmiles_magic --- textio/txInput.c | 1 + 1 file changed, 1 insertion(+) diff --git a/textio/txInput.c b/textio/txInput.c index e8756c5c..7a22eafb 100644 --- a/textio/txInput.c +++ b/textio/txInput.c @@ -547,6 +547,7 @@ TxPrefix(void) if (_rl_prefix != NULL) rl_insert_text(_rl_prefix); rl_redisplay(); + return 0; } /* From cb3167517471f98a33c432740aa9204647449446 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 110/206] utils/geometry.c: non-void function does not return a value in all control paths Had to pick a value to return by default. This is a probably should never happen ? SonarCloud utils/geometry.c:589 non-void function does not return a value in all control paths https://sonarcloud.io/project/issues?open=AZJB16DGNGfDNup0Rg7u&id=dlmiles_magic --- utils/geometry.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/geometry.c b/utils/geometry.c index 791f390b..cfa985ab 100644 --- a/utils/geometry.c +++ b/utils/geometry.c @@ -586,6 +586,8 @@ GeoTransOrient(t) return ORIENT_FLIPPED_WEST; } } + + return ORIENT_NORTH; } From 01f9f2246b1e55c64284a3fe6d5f30de3889c193 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 111/206] graphics/grX11su1.c: Dereference of null pointer Looks like the code below requires w!=NULL to do anything useful. So when w==NULL we don't continue processing X11 Event. SonarCloud graphics/grX11su1.c:842 Dereference of null pointer https://sonarcloud.io/project/issues?open=AZJB163RNGfDNup0Ri4o&id=dlmiles_magic --- graphics/grX11su1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphics/grX11su1.c b/graphics/grX11su1.c index e4485698..560ec71e 100644 --- a/graphics/grX11su1.c +++ b/graphics/grX11su1.c @@ -835,6 +835,8 @@ grX11Stdin() entry = HashLookOnly(&grX11WindowTable,grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; grCurrent.mw=w; + if(!w) + break; screenRect.r_xbot = ExposeEvent->x; screenRect.r_xtop = ExposeEvent->x+ExposeEvent->width; From 60fe6427da0131438086ba4da63b67a4aa32c035 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 112/206] graphics/grX11su1.c: Dereference of null pointer Looks like the code below requires w!=NULL to do anything useful. So when w==NULL we don't continue processing X11 Event. SonarCloud graphics/grX11su1.c:895 Dereference of null pointer https://sonarcloud.io/project/issues?open=AZJB163RNGfDNup0Ri4p&id=dlmiles_magic --- graphics/grX11su1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphics/grX11su1.c b/graphics/grX11su1.c index 560ec71e..181143ba 100644 --- a/graphics/grX11su1.c +++ b/graphics/grX11su1.c @@ -890,6 +890,8 @@ grX11Stdin() entry = HashLookOnly(&grX11WindowTable, VisEvent->window); w = (entry)?(MagWindow *)HashGetValue(entry):0; + if(!w) + break; switch(VisEvent->state) { From 8e0f34c6f1e079aabf8a4e55c242351fd50a1f93 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 29 Sep 2024 23:00:00 +0100 Subject: [PATCH 113/206] debug/hist.c Access .. results in a dereference of a null Maybe this is only a bug if a call to HistAdd() is made before HistCreate(). SonarCloud debug/hist.c:147 Access to field 'hi_cum' results in a dereference of a null pointer (loaded from variable 'h') https://sonarcloud.io/project/issues?open=AZJB17kdNGfDNup0RkzB&id=dlmiles_magic --- debug/hist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debug/hist.c b/debug/hist.c index d112bd2e..9cf07910 100644 --- a/debug/hist.c +++ b/debug/hist.c @@ -141,8 +141,10 @@ HistAdd(name, ptrKeys, value) { Histogram * h; - if((h=histFind(name, ptrKeys))==(Histogram *) NULL) + if((h=histFind(name, ptrKeys))==(Histogram *) NULL) { HistCreate(name, ptrKeys, 0, 20, 10); + h=histFind(name, ptrKeys); + } h->hi_cum+=value; if(value < h->hi_lo) From 1ca23ca0a21d994f264325e508a18625f5f636bd Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Tue, 4 Jun 2024 15:01:33 +0100 Subject: [PATCH 114/206] fix: Accessing uninitialized variable Trigger condition maybe that no labels exist in the project, so the loop never iterates. --- calma/CalmaWrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index a9bb6fe2..44ea65a2 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -1440,7 +1440,7 @@ calmaOutFunc(def, f, cliprect) numports++; } } - if (newll != NULL) + if (ll != NULL) { /* Turn linked list into an array, then run qsort on it */ /* to sort by port number. */ From 18a4dddc2b83781f63606e629029059d5cc88965 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Tue, 4 Jun 2024 15:03:17 +0100 Subject: [PATCH 115/206] fix: read of uninitialized data at inChar[0] This is a defensive fix, might cause unexpected program exit if triggered. The loop will iterate at least once when nbytes==0, but this value indicates XLookupString did not fill in any data, so the entire buffer is undefined. Using memset() before or inChar[0]=0 after XLookupString did not fix the issue. Using inChar[0]=0 immediately before the loop did fix as well. But this patch seems to be the best approach. --- graphics/grTOGL1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/grTOGL1.c b/graphics/grTOGL1.c index 509a47ca..2feccdf1 100644 --- a/graphics/grTOGL1.c +++ b/graphics/grTOGL1.c @@ -599,7 +599,7 @@ keys_and_buttons: idxmax = (nbytes == 0) ? 1 : nbytes; for (idx = 0; idx < idxmax; idx++) { - if (inChar[idx] == 3) /* Ctrl-C interrupt */ + if (nbytes > 0 && inChar[idx] == 3) /* Ctrl-C interrupt */ { if (SigInterruptPending) MainExit(0); /* double Ctrl-C */ From 3638d382d66dbcdada442889dbb884a171509da4 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Tue, 4 Jun 2024 15:07:43 +0100 Subject: [PATCH 116/206] fix: lef write crash (when cells with labels in space pNum==-1) The issue here is can pNum==-1 which causes a crash. --- lef/lefWrite.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 93657b18..b88385af 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -1591,8 +1591,10 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) /* disappear by being inside the setback area. */ pNum = DBPlane(lab->lab_type); - DBPaintPlane(SelectDef->cd_planes[pNum], &labr, - DBStdPaintTbl(lab->lab_type, pNum), (PaintUndoInfo *) NULL); + if (pNum >= 0) // ignore labels in space + DBPaintPlane(SelectDef->cd_planes[pNum], &labr, + DBStdPaintTbl(lab->lab_type, pNum), + (PaintUndoInfo *) NULL); } else { @@ -1607,8 +1609,10 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) /* disappear by being inside the setback area. */ pNum = DBPlane(lab->lab_type); - DBPaintPlane(SelectDef->cd_planes[pNum], &labr, - DBStdPaintTbl(lab->lab_type, pNum), (PaintUndoInfo *) NULL); + if (pNum >= 0) // ignore labels in space + DBPaintPlane(SelectDef->cd_planes[pNum], &labr, + DBStdPaintTbl(lab->lab_type, pNum), + (PaintUndoInfo *) NULL); } } From e119188f234f7aefe8d672dbc9adc40a2305794a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Tue, 4 Jun 2024 15:14:30 +0100 Subject: [PATCH 117/206] fix: findUse can return NULL crash The main cause of the crash was the path for UNDO_CELL_PLACE this was trigged by performing a number of cell create/move operations (unknown exactly what sequence). Then a large number of "undo" operations. There is an ASSERT in findUse() but that does not seem built into the release (or debug CFLAGS=-g3) builds. --- database/DBundo.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/database/DBundo.c b/database/DBundo.c index 255c3af8..84c9a172 100644 --- a/database/DBundo.c +++ b/database/DBundo.c @@ -788,9 +788,11 @@ dbUndoCellBack(up) break; case UNDO_CELL_PLACE: use = findUse(up, TRUE); - DBUnLinkCell(use, up->cue_parent); - DBDeleteCell(use); - (void) DBCellDeleteUse(use); + if(use) { + DBUnLinkCell(use, up->cue_parent); + DBDeleteCell(use); + (void) DBCellDeleteUse(use); + } DBReComputeBbox(up->cue_parent); DBWAreaChanged(up->cue_parent, &up->cue_bbox, DBW_ALLWINDOWS, (TileTypeBitMask *) NULL); @@ -804,9 +806,11 @@ dbUndoCellBack(up) */ case UNDO_CELL_CLRID: use = findUse(up, FALSE); /* Find it with a NULL id */ - (void) DBReLinkCell(use, up->cue_id); - DBWAreaChanged(up->cue_parent, &up->cue_bbox, - (int) ~use->cu_expandMask, &DBAllButSpaceBits); + if(use) { + (void) DBReLinkCell(use, up->cue_id); + DBWAreaChanged(up->cue_parent, &up->cue_bbox, + (int) ~use->cu_expandMask, &DBAllButSpaceBits); + } break; /* * The following is a hack. @@ -817,16 +821,20 @@ dbUndoCellBack(up) */ case UNDO_CELL_SETID: use = findUse(up, TRUE); /* Find it with current id */ - DBUnLinkCell(use, up->cue_parent); - freeMagic(use->cu_id); - use->cu_id = (char *) NULL; + if(use) { + DBUnLinkCell(use, up->cue_parent); + freeMagic(use->cu_id); + use->cu_id = (char *) NULL; + } break; case UNDO_CELL_LOCKDOWN: use = findUse(up, TRUE); - use->cu_flags = up->cue_flags; - DBWAreaChanged(up->cue_parent, &up->cue_bbox, + if(use) { + use->cu_flags = up->cue_flags; + DBWAreaChanged(up->cue_parent, &up->cue_bbox, (int) ~use->cu_expandMask, &DBAllButSpaceBits); + } break; } } From dba6f99d938e2a3350fe8f7cd15bd348de634cdf Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 1 Oct 2024 12:56:31 -0400 Subject: [PATCH 118/206] Updated the revision number to go along with the merge of pull request #325 from Daryl Miles. Made a few simple style changes to conform to (what is vaguely defined as) the overall programming style for magic (passed down from John Ousterhout). --- VERSION | 2 +- database/DBundo.c | 8 ++++---- extract/ExtBasic.c | 20 ++++++++++---------- garouter/gaChannel.c | 2 +- graphics/grOGL1.c | 8 +++++--- graphics/grX11su1.c | 14 +++++++------- resis/ResBasic.c | 2 +- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/VERSION b/VERSION index a5586930..f36d4375 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.492 +8.3.493 diff --git a/database/DBundo.c b/database/DBundo.c index 84c9a172..56a6bc94 100644 --- a/database/DBundo.c +++ b/database/DBundo.c @@ -788,7 +788,7 @@ dbUndoCellBack(up) break; case UNDO_CELL_PLACE: use = findUse(up, TRUE); - if(use) { + if (use) { DBUnLinkCell(use, up->cue_parent); DBDeleteCell(use); (void) DBCellDeleteUse(use); @@ -806,7 +806,7 @@ dbUndoCellBack(up) */ case UNDO_CELL_CLRID: use = findUse(up, FALSE); /* Find it with a NULL id */ - if(use) { + if (use) { (void) DBReLinkCell(use, up->cue_id); DBWAreaChanged(up->cue_parent, &up->cue_bbox, (int) ~use->cu_expandMask, &DBAllButSpaceBits); @@ -821,7 +821,7 @@ dbUndoCellBack(up) */ case UNDO_CELL_SETID: use = findUse(up, TRUE); /* Find it with current id */ - if(use) { + if (use) { DBUnLinkCell(use, up->cue_parent); freeMagic(use->cu_id); use->cu_id = (char *) NULL; @@ -830,7 +830,7 @@ dbUndoCellBack(up) case UNDO_CELL_LOCKDOWN: use = findUse(up, TRUE); - if(use) { + if (use) { use->cu_flags = up->cue_flags; DBWAreaChanged(up->cue_parent, &up->cue_bbox, (int) ~use->cu_expandMask, &DBAllButSpaceBits); diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index ad15e8bd..7515b9ba 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -1078,15 +1078,15 @@ ExtSortTerminals(tran, ll) { p1 = &(tran->tr_termpos[nsd]); p2 = &(tran->tr_termpos[nsd+1]); - if( p2->pnum > p1->pnum ) + if (p2->pnum > p1->pnum) continue; - else if( p2->pnum == p1->pnum ) + else if (p2->pnum == p1->pnum) { - if( p2->pt.p_x > p1->pt.p_x ) + if (p2->pt.p_x > p1->pt.p_x) continue; - else if( p2->pt.p_x == p1->pt.p_x && p2->pt.p_y > p1->pt.p_y ) + else if (p2->pt.p_x == p1->pt.p_x && p2->pt.p_y > p1->pt.p_y) continue; - else if( p2->pt.p_x == p1->pt.p_x && p2->pt.p_y == p1->pt.p_y ) + else if (p2->pt.p_x == p1->pt.p_x && p2->pt.p_y == p1->pt.p_y) { TxPrintf("Extract error: Duplicate tile position, ignoring\n"); continue; @@ -3476,17 +3476,17 @@ extTransPerimFunc(bp) /* update the region tile position */ - if( DBPlane(TiGetType(otile)) < pos->pnum ) + if (DBPlane(TiGetType(otile)) < pos->pnum) { pos->pnum = DBPlane(TiGetType(otile)); pos->pt = otile->ti_ll; } - else if( DBPlane(TiGetType(otile)) == pos->pnum ) + else if (DBPlane(TiGetType(otile)) == pos->pnum) { - if( LEFT(otile) < pos->pt.p_x ) + if (LEFT(otile) < pos->pt.p_x) pos->pt = otile->ti_ll; - else if( LEFT(otile) == pos->pt.p_x && - BOTTOM(otile) < pos->pt.p_y ) + else if (LEFT(otile) == pos->pt.p_x && + BOTTOM(otile) < pos->pt.p_y) pos->pt.p_y = BOTTOM(otile); } } diff --git a/garouter/gaChannel.c b/garouter/gaChannel.c index a7b9a584..56e4432e 100644 --- a/garouter/gaChannel.c +++ b/garouter/gaChannel.c @@ -386,7 +386,7 @@ gaChannelStats(list) clear = NULL; break; } - if(tot && clear) { + if (tot && clear) { gaPinStats(ch->gcr_tPins, ch->gcr_length, tot, clear); gaPinStats(ch->gcr_bPins, ch->gcr_length, tot, clear); gaPinStats(ch->gcr_lPins, ch->gcr_width, tot, clear); diff --git a/graphics/grOGL1.c b/graphics/grOGL1.c index db1754a9..a1e69138 100644 --- a/graphics/grOGL1.c +++ b/graphics/grOGL1.c @@ -557,7 +557,7 @@ pipehandler() entry = HashLookOnly(&grOGLWindowTable, ExposeEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; - if(!mw) + if (!mw) break; screenRect.r_xbot = ExposeEvent->x; @@ -720,14 +720,16 @@ oglSetDisplay (dispType, outFileName, mouseFileName) grSetCharSizePtr = groglSetCharSize; grFillPolygonPtr = groglFillPolygon; - if (execFailed) { + if (execFailed) + { TxError("Execution failed!\n"); return FALSE; } TxAdd1InputDevice(fileno(stdin), grOGLWStdin, (ClientData) NULL); - if(!GrOGLInit()){ + if (!GrOGLInit()) + { return FALSE; } GrScreenRect.r_xbot = 0; diff --git a/graphics/grX11su1.c b/graphics/grX11su1.c index 181143ba..3720e21c 100644 --- a/graphics/grX11su1.c +++ b/graphics/grX11su1.c @@ -143,7 +143,7 @@ grx11SetWMandC (mask, c) static int oldM = -1; c = grPixels[c]; - if(grDisplay.depth <= 8) { + if (grDisplay.depth <= 8) { mask = grPlanes[mask]; if (mask == -65) mask = AllPlanes; } @@ -413,7 +413,7 @@ GrX11Init(dispType) grtemplate.screen = grXscrn; grtemplate.depth = 0; grvisual_get = XGetVisualInfo(grXdpy, VisualScreenMask, &grtemplate, &gritems); - if(grvisual_get == NULL) + if (grvisual_get == NULL) { TxPrintf("Could not obtain Visual Info from Server %s. " "Will attempt default.\n", getenv("DISPLAY")); @@ -835,7 +835,7 @@ grX11Stdin() entry = HashLookOnly(&grX11WindowTable,grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; grCurrent.mw=w; - if(!w) + if (!w) break; screenRect.r_xbot = ExposeEvent->x; @@ -890,7 +890,7 @@ grX11Stdin() entry = HashLookOnly(&grX11WindowTable, VisEvent->window); w = (entry)?(MagWindow *)HashGetValue(entry):0; - if(!w) + if (!w) break; switch(VisEvent->state) @@ -927,7 +927,7 @@ grX11Stdin() exception. Why X11 is generating an event for a non-existent window is another question... ***mdg*** */ - if(w == 0) {printf("CreateNotify: w = %d.\n", w); break;} + if (w == 0) {printf("CreateNotify: w = %d.\n", w); break;} SigDisableInterrupts(); WindView(w); SigEnableInterrupts(); @@ -1183,13 +1183,13 @@ GrX11Create(w, name) grAttributes.border_pixel = BlackPixel(grXdpy,grXscrn); grAttributes.colormap = grXcmap; grDepth = grDisplay.depth; - if(grClass == 3) grDepth = 8; /* Needed since grDisplay.depth is reset + if (grClass == 3) grDepth = 8; /* Needed since grDisplay.depth is reset to 7 if Pseudocolor */ #ifdef HIRESDB TxPrintf("x %d y %d width %d height %d depth %d class %d mask %d\n", x,y,width,height, grDepth, grClass, attribmask); #endif /* HIRESDB */ - if ( wind = XCreateWindow(grXdpy, XDefaultRootWindow(grXdpy), + if (wind = XCreateWindow(grXdpy, XDefaultRootWindow(grXdpy), x, y, width, height, 0, grDepth, InputOutput, grVisual, attribmask, &grAttributes)) { diff --git a/resis/ResBasic.c b/resis/ResBasic.c index 020a9ace..98c8d282 100644 --- a/resis/ResBasic.c +++ b/resis/ResBasic.c @@ -353,7 +353,7 @@ ResEachTile(tile, startpoint) { for (i = 0; i < devptr->exts_deviceSDCount; i++) { - if(TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) + if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) { /* found device */ yj = TOP(tile); From 3e0ad4ff58887b9034dc2d483afcd6d384c89776 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 1 Oct 2024 16:01:28 -0400 Subject: [PATCH 119/206] Finally got around to restoring the behavior of the toolbar with respect to using the 3rd mouse button to hide a layer, and indicating the layer is hidden by blanking the icon (which works better with the new scrollable icon list, but got broken by the same). Also: Added a previously missing behavior, which is to correctly update the icon settings based on using the command "see" and "see no" with layer aliases (e.g., "allm1"). --- tcltk/toolbar.tcl | 76 ++++++++++++++++++++++++++++++----------------- tcltk/wrapper.tcl | 16 ++++++---- 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/tcltk/toolbar.tcl b/tcltk/toolbar.tcl index a587dac3..d8f68e22 100644 --- a/tcltk/toolbar.tcl +++ b/tcltk/toolbar.tcl @@ -121,26 +121,46 @@ proc createLayerFrame {framename layername i} { # Place the layer button, checking if it is locked or not set locklist [tech locked] - # Locked button bindings if {[lsearch $locklist $layername] != -1} { + # Locked button bindings + set toolbar_button ${layer_frame}.p + button $toolbar_button -image pale_$layername + + # Bind keypresses when mouse if over layer frame + bind $layer_frame \ + "$win tech unlock $layername ; \ + grid forget $toolbar_button ; \ + grid ${layer_frame}.b -row $i -column 0 -sticky w" + + # Bindings for painiting, erasing and seeing layers, + # which are bound both to the layer button, as well + # as the layer label + set childrenList [winfo children $layer_frame] + + foreach child $childrenList { + # 3rd mouse button makes layer invisible; 1st mouse button restores it. + # 2nd mouse button paints the layer color. Key "p" also does paint, esp. + # for users with 2-button mice. Key "e" erases, as does Shift-Button-2. + bind $child "$win see $layername" + bind $child "$win see no $layername" + + # Intercept mousewheel on the layer/button as well + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + } + + # Bind the mouse enter event to highlight the label + bind $toolbar_label "$toolbar_label configure -background yellow" - button $toolbar_button -image pale_$layername -command \ - "$win see $layername" bind $layer_frame \ - [subst {focus %W ; ${framename}.titlebar.message configure \ - -text "$layername (locked)"}] + [subst {focus %W ; ${framename}.titlebar.message configure \ + -text "$layername (locked)"}] - bind $layer_frame \ - "$win see no $layername" - - bind $layer_frame \ - "$win tech unlock $layername ; \ - grid forget $toolbar_button ; \ - grid ${layer_frame}.b -row $i -column 0 -sticky w" - - # Unlocked button bindings } else { + # Unlocked button bindings set toolbar_button ${layer_frame}.b button $toolbar_button -image img_$layername @@ -162,21 +182,21 @@ proc createLayerFrame {framename layername i} { # as the layer label set childrenList [winfo children $layer_frame] - foreach child $childrenList { - # 3rd mouse button makes layer invisible; 1st mouse button restores it. - # 2nd mouse button paints the layer color. Key "p" also does paint, esp. - # for users with 2-button mice. Key "e" erases, as does Shift-Button-2. - bind $child "$win see $layername" - bind $child "$win paint $layername" - bind $child "$win erase $layername" - bind $child "$win see no $layername" + foreach child $childrenList { + # 3rd mouse button makes layer invisible; 1st mouse button restores it. + # 2nd mouse button paints the layer color. Key "p" also does paint, esp. + # for users with 2-button mice. Key "e" erases, as does Shift-Button-2. + bind $child "$win see $layername" + bind $child "$win paint $layername" + bind $child "$win erase $layername" + bind $child "$win see no $layername" - # Intercept mousewheel on the layer/button as well - bind $child \ - [subst { event generate ${framename}.toolbar.canvas }] - bind $child \ - [subst { event generate ${framename}.toolbar.canvas }] - } + # Intercept mousewheel on the layer/button as well + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + } # Bind the mouse enter event to highlight the label bind $toolbar_label "$toolbar_label configure -background yellow" diff --git a/tcltk/wrapper.tcl b/tcltk/wrapper.tcl index bd99d48e..73f18ae9 100644 --- a/tcltk/wrapper.tcl +++ b/tcltk/wrapper.tcl @@ -760,12 +760,16 @@ proc magic::toolupdate {win {yesno "yes"} {layerlist "none"}} { # "hidespecial" is used, so catch each configure command. if {$canon != ""} { - if {$yesno == "yes"} { - catch {${framename}.toolbar.b$canon configure -image img_$canon} - catch {${framename}.toolbar.p$canon configure -image pale_$canon} - } else { - catch {${framename}.toolbar.b$canon configure -image img_space} - catch {${framename}.toolbar.p$canon configure -image img_space} + # Layer aliases like "allm1" expand into multiple layers + foreach clayer $canon { + set toolframe ${framename}.toolbar.canvas.frame.f${clayer} + if {$yesno == "yes"} { + catch {${toolframe}.b configure -image img_$clayer} + catch {${toolframe}.p configure -image pale_$clayer} + } else { + catch {${toolframe}.b configure -image img_space} + catch {${toolframe}.p configure -image img_space} + } } } } From e2c3eb3e20c2227099fbcece6c354eec3772aa75 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 1 Oct 2024 21:14:12 -0400 Subject: [PATCH 120/206] Corrected the previous commit, which did not fix the problem that it claimed to fix, but caused an incorrect DRC maxwidth check instead. The problem appears to be correctly resolved now. Also: Tracked down a recently-introduced minor issue in which the interactive DRC stops running after issuing "drc check" and does not resume until another key or mouse even occurs. This turned out to be caused by the work on the "logcommands" command, which should have used "*bypass" before "logcommands suspend" and "logcommands resume", since the "*bypass" indicates that the command has no impact on layout and should not interrupt the DRC checker. --- INSTALL | 6 ++++++ database/DBio.c | 5 +++-- drc/DRCbasic.c | 12 ++++++++++++ tcltk/wrapper.tcl | 32 ++++++++++++++++---------------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/INSTALL b/INSTALL index 0543faba..a80553fc 100644 --- a/INSTALL +++ b/INSTALL @@ -47,6 +47,12 @@ Autoconf Capsule Summary: Disable threaded X11 and OpenGL graphics. Normally enabled. + --disable-compression + Disable reading and writing of compressed + (gzipped) GDS files and reading of compressed + .mag files. Normally enabled, if the zlib + development package is installed. + Notes to Magic maintainers: -------------------------- diff --git a/database/DBio.c b/database/DBio.c index c30dff12..27a03b3a 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -2017,6 +2017,7 @@ badTransform: char argstr[1024]; githash1[0] = '\0'; + githash2[0] = '\0'; /* Remove the file component */ sl1ptr = strrchr(pathptr, '/'); @@ -2487,8 +2488,8 @@ dbReadProperties(cellDef, line, len, f, scalen, scaled) /* Skip forward four values in pvalueptr */ for (n = 0; n < 4; n++) { - while (!isspace(*pptr)) pptr++; - while (isspace(*pptr) && (*pptr != '\0')) pptr++; + while ((*pptr != '\0') && !isspace(*pptr)) pptr++; + while ((*pptr != '\0') && isspace(*pptr)) pptr++; } } } diff --git a/drc/DRCbasic.c b/drc/DRCbasic.c index 0a6e1fdb..d56f5185 100644 --- a/drc/DRCbasic.c +++ b/drc/DRCbasic.c @@ -692,9 +692,15 @@ drcTile (tile, arg) cptr->drcc_dist++; if (cptr->drcc_flags & DRC_REVERSE) + { mrd = drcCanonicalMaxwidth(tpleft, GEO_WEST, arg, cptr); + triggered = 0; + } else if (firsttile) + { mrd = drcCanonicalMaxwidth(tile, GEO_EAST, arg, cptr); + triggered = 0; + } if (!trigpending || (DRCCurStyle->DRCFlags & DRC_FLAGS_WIDEWIDTH_NONINCLUSIVE)) cptr->drcc_dist--; @@ -1089,9 +1095,15 @@ drcTile (tile, arg) cptr->drcc_dist++; if (cptr->drcc_flags & DRC_REVERSE) + { mrd = drcCanonicalMaxwidth(tpbot, GEO_SOUTH, arg, cptr); + triggered = 0; + } else if (firsttile) + { mrd = drcCanonicalMaxwidth(tile, GEO_NORTH, arg, cptr); + triggered = 0; + } if (!trigpending || (DRCCurStyle->DRCFlags & DRC_FLAGS_WIDEWIDTH_NONINCLUSIVE)) cptr->drcc_dist--; diff --git a/tcltk/wrapper.tcl b/tcltk/wrapper.tcl index 73f18ae9..18ea23ed 100644 --- a/tcltk/wrapper.tcl +++ b/tcltk/wrapper.tcl @@ -243,12 +243,12 @@ proc magic::drcupdate { option } { } proc magic::drcstate { status } { - logcommands suspend + *bypass logcommands suspend set winlist [*bypass windownames layout] foreach lwin $winlist { set framename [winfo parent $lwin] if {$framename == "."} { - logcommands resume + *bypass logcommands resume return } switch $status { @@ -264,7 +264,7 @@ proc magic::drcstate { status } { busy { ${framename}.titlebar.drcbutton configure -selectcolor yellow } } } - logcommands resume + *bypass logcommands resume } # Create the menu of windows. This is kept separate from the cell manager, @@ -515,7 +515,7 @@ proc magic::captions {{subcommand {}}} { if {$subcommand != {} && $subcommand != "writeable" && $subcommand != "load"} { return } - logcommands suspend + *bypass logcommands suspend set winlist [magic::windownames layout] foreach winpath $winlist { set framename [winfo parent $winpath] @@ -535,7 +535,7 @@ proc magic::captions {{subcommand {}}} { "Loaded: ${subcaption1} Editing: ${subcaption2} Tool: $Opts(tool) \ Technology: ${techname}" } - logcommands resume + *bypass logcommands resume } # Allow captioning in the title window by tagging the "load" and "edit" commands @@ -670,10 +670,10 @@ proc magic::cursorview {win} { if {$win == {}} { return } - logcommands suspend + *bypass logcommands suspend set framename [winfo parent $win] if {[catch {set cr [*bypass cif scale out]}]} { - logcommands resume + *bypass logcommands resume return } if {$cr == 0} {return} @@ -691,7 +691,7 @@ proc magic::cursorview {win} { set olstx [expr {$olstx * $cr}] set olsty [expr {$olsty * $cr}] }]} { - logcommands resume + *bypass logcommands resume return } @@ -707,24 +707,24 @@ proc magic::cursorview {win} { set titletext [format "(%+g %+g) microns" $olstx $olsty] ${framename}.titlebar.pos configure -text $titletext } - logcommands resume + *bypass logcommands resume } proc magic::toolupdate {win {yesno "yes"} {layerlist "none"}} { global Winopts if {[magic::display] == "NULL"} {return} - logcommands suspend + *bypass logcommands suspend if {$win == {}} { set win [magic::windownames] } # Wind3d has a "see" function, so make sure this is not a 3d window if {$win == [magic::windownames wind3d]} { - logcommands resume + *bypass logcommands resume return } - logcommands resume + *bypass logcommands resume set topname [winfo toplevel $win] set framename [winfo parent $win] @@ -831,13 +831,13 @@ proc magic::techrebuild {winpath {cmdstr ""}} { proc magic::setscrollvalues {win} { global Opts - logcommands suspend + *bypass logcommands suspend set svalues [${win} view get] set bvalues [${win} view bbox] set framename [winfo parent ${win}] if {$framename == "."} { - logcommands resume + *bypass logcommands resume return } @@ -881,7 +881,7 @@ proc magic::setscrollvalues {win} { proc magic::scrollupdate {win} { - logcommands suspend + *bypass logcommands suspend if {[magic::display] == "NULL"} {return} if {[info level] <= 1} { @@ -898,7 +898,7 @@ proc magic::scrollupdate {win} { magic::setscrollvalues $win } } - logcommands resume + *bypass logcommands resume } # scrollview: update the magic display to match the From a467154fec33d03cc9e77cc3bd378d57006d752a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 30 Sep 2024 23:00:00 +0100 Subject: [PATCH 121/206] Update appimage.yml (rename job) --- .github/workflows/appimage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index c9dc9cce..8a0a6e1e 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -3,7 +3,7 @@ on: tags: - "*" -name: CI +name: CI-appimage jobs: build_appimage: From 08affbe032c85a33357d522a1bfde0826661400d Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 30 Sep 2024 23:00:00 +0100 Subject: [PATCH 122/206] GHA: BUMP actions/checkout@v4 (from v2) --- .github/workflows/appimage.yml | 2 +- .github/workflows/main.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 8a0a6e1e..f855e3cc 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get the version id: get_version run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb6c1b93..17459337 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: simple_build_linux: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Get Dependencies run: | sudo apt-get install -y tcl-dev tk-dev libcairo-dev @@ -38,7 +38,7 @@ jobs: simple_build_wasm: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Get Dependencies run: | git clone https://github.com/emscripten-core/emsdk.git @@ -59,7 +59,7 @@ jobs: # simple_build_mac: # runs-on: macos-11 # steps: - # - uses: actions/checkout@v2 + # - uses: actions/checkout@v4 # - name: Get Dependencies # run: | # brew install --cask xquartz From 7589bdba1021dcd39750fc38116562a3367876a4 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 30 Sep 2024 23:00:00 +0100 Subject: [PATCH 123/206] GHA: BUMP actions/upload-artifact@v4 (from v3) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17459337..055bd2ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,7 +51,7 @@ jobs: emconfigure ./configure --without-cairo --without-opengl --without-x --disable-readline --target=asmjs-unknown-emscripten emmake make - name: archive wasm bundle - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: magic-wasm-bundle path: | From 80f051f79d8b97aaf05af03b3bdeec9cc1e1f168 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 30 Sep 2024 23:00:00 +0100 Subject: [PATCH 124/206] GHA: CI WASM build use --disable-compression I assume it can't link to libz anyway, you'd need to rebuild libz for WASM target (or use a the Web API for GZIP). --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 055bd2ef..50ae1261 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: - name: Build run: | source ./emsdk/emsdk_env.sh - emconfigure ./configure --without-cairo --without-opengl --without-x --disable-readline --target=asmjs-unknown-emscripten + emconfigure ./configure --without-cairo --without-opengl --without-x --disable-readline --disable-compression --target=asmjs-unknown-emscripten emmake make - name: archive wasm bundle uses: actions/upload-artifact@v4 From 6162a9f4597925b23a74ffdc8c4ca66e374764e6 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 3 Oct 2024 20:37:43 -0400 Subject: [PATCH 125/206] Corrected the "bloat-all" function so that it behaves properly on angled edges. This is a rare case and so has never come up before, but can happen especially on transistors with gate or diffusion with 45 degree chamfers or flanges. Thanks to Mark Martin for providing the use case. --- VERSION | 2 +- cif/CIFgen.c | 21 +++++++++++++++++++-- ext2spice/ext2hier.c | 10 ++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index f36d4375..9a3e9689 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.493 +8.3.494 diff --git a/cif/CIFgen.c b/cif/CIFgen.c index 0d9e04b3..8707f2d9 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -1379,8 +1379,24 @@ cifBloatAllFunc(tile, bls) area.r_xtop *= locScale; area.r_ytop *= locScale; - DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, - CIFPaintTable, (PaintUndoInfo *) NULL); + /* Diagonal: If expanding across the edge of a diagonal, */ + /* then just fill the whole tile. */ + + if (IsSplit(t)) + { + TileType tt; + tt = TiGetTypeExact(t); + if ((tt & TT_SIDE) && (TTMaskHasType(connect, TiGetLeftType(t)))) + DBPaintPlane(cifPlane, &area, CIFPaintTable, (PaintUndoInfo *) NULL); + else if (!(tt & TT_SIDE) && (TTMaskHasType(connect, TiGetRightType(t)))) + DBPaintPlane(cifPlane, &area, CIFPaintTable, (PaintUndoInfo *) NULL); + else + DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, + CIFPaintTable, (PaintUndoInfo *) NULL); + } + else + DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, + CIFPaintTable, (PaintUndoInfo *) NULL); /* Top */ for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp)) @@ -1401,6 +1417,7 @@ cifBloatAllFunc(tile, bls) for (tp = TR(t); TOP(tp) > BOTTOM(t); tp = LB(tp)) if (TTMaskHasType(connect, TiGetLeftType(tp))) PUSHTILE(tp, BloatStack); + } /* Clear the tiles that were processed */ diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index 725374b1..9c4a1c64 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -1874,11 +1874,13 @@ esMakePorts(hc, cdata) { nn->efnn_node->efnode_flags |= EF_PORT; nn->efnn_port = -1; // Will be sorted later - } - // Diagnostic - // TxPrintf("Port connection in %s from net %s to net %s (%s)\n", - // def->def_name, locname, name, portname); + // Diagnostic + /* TxPrintf("Port connection in %s from net %s to " + * "net %s (%s)\n", + * def->def_name, locname, name, portname); + */ + } } /* Propagate the EF_SUBS_PORT flag */ From a3b61abe2b6a7574ad42dbde6799a1b874570708 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 7 Oct 2024 11:48:27 -0400 Subject: [PATCH 126/206] Corrected an error in which "extract unique noports" and "extract unique notopports" both fail to work correctly because an attempt some time ago to avoid issuing warnings about shorted port names when using those options was changed in the wrong line. --- VERSION | 2 +- bplane/bpBins.c | 2 +- ext2spice/ext2hier.c | 2 +- extract/ExtUnique.c | 10 +++++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 9a3e9689..0f06d4df 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.494 +8.3.495 diff --git a/bplane/bpBins.c b/bplane/bpBins.c index 54f355a9..141cd886 100644 --- a/bplane/bpBins.c +++ b/bplane/bpBins.c @@ -569,7 +569,7 @@ BinArray *bpBinArrayBuild(Rect bbox, /* Added by Tim, 2/19/2024 */ /* This line is not supposed to be needed? */ - if ((!subbin) && ((int)elements & BT_ARRAY)) return NULL; + if ((!subbin) && ((pointertype)elements & BT_ARRAY)) return NULL; if(BPD) DumpRect("#### bpBinArrayBuild, TOP bbox= ", &bbox); diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index 9c4a1c64..543d3dbf 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -1816,8 +1816,8 @@ esMakePorts(hc, cdata) /* matches a use. If not, then check if the part */ /* the last opening bracket matches a known use. */ - aptr = strrchr(portname, '['); *tptr = '\0'; + aptr = strrchr(portname, '['); is_array = FALSE; if (aptr != NULL) { diff --git a/extract/ExtUnique.c b/extract/ExtUnique.c index 2e2a716c..028a6e49 100644 --- a/extract/ExtUnique.c +++ b/extract/ExtUnique.c @@ -221,16 +221,20 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option) text = ll->ll_label->lab_text; if (option == EXT_UNIQ_ALL) goto makeUnique; - else if ((option == EXT_UNIQ_NOPORTS || option == EXT_UNIQ_NOTOPPORTS) && - (ll->ll_label->lab_flags & PORT_DIR_MASK)) + else if ((option == EXT_UNIQ_NOPORTS || option == EXT_UNIQ_NOTOPPORTS) + && !(ll->ll_label->lab_flags & PORT_DIR_MASK)) goto makeUnique; cpend = strchr(text, '\0'); if (cpend > text) cpend--; if (*cpend == '#') goto makeUnique; if (*cpend == '!') return 0; + + /* Don't generate warnings about ports when given the "noports" or + * "notopports" options. + */ if (((option == EXT_UNIQ_NOPORTS) || (option == EXT_UNIQ_NOTOPPORTS)) - && !(ll->ll_label->lab_flags & PORT_DIR_MASK)) + && (ll->ll_label->lab_flags & PORT_DIR_MASK)) return 0; /* Generate a warning for each occurrence of this label */ From de5c54e20b6de6dd5fb77631ec7408bc6665c5c6 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 9 Oct 2024 20:34:08 -0400 Subject: [PATCH 127/206] Added a missing description of the "flatten" property, which is documented briefly in the "flatten" command reference page, but no in the "property" command reference page. --- doc/html/property.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/html/property.html b/doc/html/property.html index 281db7db..0d233d11 100644 --- a/doc/html/property.html +++ b/doc/html/property.html @@ -105,6 +105,10 @@ Attach a "property" (string key and value pair) to the edit cell are required to accommodate pins). Any set-back applied by the "lef write -hide " option will be applied to this obstruction box. +
flatten +
This property is used in conjunction with the "flatten -doproperty" + command option and marks the cell for flattening. Cells without + this property defined will not be flattened.
device
This property declares that the cell is a device or contains a single device that is not a known extractable device defined in From 0a4e2a5a2781de88944f9588e2e3ebb44b66d360 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 128/206] HashGetValue: warning: comparison between pointer and integer GCC14 --without-tk --without-tcl Related issue: https://github.com/RTimothyEdwards/magic/issues/323 --- database/DBcellname.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/DBcellname.c b/database/DBcellname.c index b554b5af..4f56a190 100644 --- a/database/DBcellname.c +++ b/database/DBcellname.c @@ -1700,7 +1700,7 @@ DBCellNewDef(cellName) cellName = UNNAMED; entry = HashFind(&dbCellDefTable, cellName); - if (HashGetValue(entry) != (ClientData) NULL) + if (HashGetValue(entry) != NULL) return ((CellDef *) NULL); cellDef = DBCellDefAlloc(); @@ -1861,7 +1861,7 @@ DBCellRenameDef(cellDef, newName) ASSERT(HashGetValue(oldEntry) == (ClientData) cellDef, "DBCellRenameDef"); newEntry = HashFind(&dbCellDefTable, newName); - if (HashGetValue(newEntry) != (ClientData) NULL) + if (HashGetValue(newEntry) != NULL) return (FALSE); HashSetValue(oldEntry, (ClientData) NULL); From 8994a68e618811019c3e8c4ec7475f0f9a9e9319 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 129/206] DBPropGet(): error: assignment to 'char *' from 'ClientData' GCC14 --without-tk --without-tcl Related issue: https://github.com/RTimothyEdwards/magic/issues/323 --- database/DBcellname.c | 2 +- lef/defRead.c | 2 +- lef/defWrite.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/database/DBcellname.c b/database/DBcellname.c index 4f56a190..b9eedd1c 100644 --- a/database/DBcellname.c +++ b/database/DBcellname.c @@ -1603,7 +1603,7 @@ dbAbutmentUseFunc(selUse, use, transform, data) } trans = &use->cu_transform; - propvalue = DBPropGet(use->cu_def, "FIXED_BBOX", &found); + propvalue = (char *)DBPropGet(use->cu_def, "FIXED_BBOX", &found); if (!found) bbox = use->cu_def->cd_bbox; else diff --git a/lef/defRead.c b/lef/defRead.c index 6f0f9eb3..c2753d1b 100644 --- a/lef/defRead.c +++ b/lef/defRead.c @@ -1357,7 +1357,7 @@ DefReadLocation(use, f, oscale, tptr, noplace) char *propval; bool found; - propval = DBPropGet(use->cu_def, "FIXED_BBOX", &found); + propval = (char *)DBPropGet(use->cu_def, "FIXED_BBOX", &found); if (found) { if (sscanf(propval, "%d %d %d %d", &rect.r_xbot, &rect.r_ybot, diff --git a/lef/defWrite.c b/lef/defWrite.c index 96896a90..95835752 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -2772,7 +2772,7 @@ arrayDefFunc(use, transform, x, y, defdata) char *propval; bool found; - propval = DBPropGet(use->cu_def, "FIXED_BBOX", &found); + propval = (char *)DBPropGet(use->cu_def, "FIXED_BBOX", &found); if (found) { if (sscanf(propval, "%d %d %d %d", &rect.r_xbot, &rect.r_ybot, @@ -2830,7 +2830,7 @@ defComponentFunc(cellUse, defdata) char *propval; bool found; - propval = DBPropGet(cellUse->cu_def, "FIXED_BBOX", &found); + propval = (char *)DBPropGet(cellUse->cu_def, "FIXED_BBOX", &found); if (found) { if (sscanf(propval, "%d %d %d %d", &rect.r_xbot, &rect.r_ybot, From 23930909b18f097e8cf3c693b5f9f4389071f054 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 130/206] database/DBio.c: error: assignment to 'char *' from 'ClientData' GCC14 --without-tk --without-tcl Related issue: https://github.com/RTimothyEdwards/magic/issues/323 --- database/DBio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBio.c b/database/DBio.c index 27a03b3a..0039d6f4 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -3334,7 +3334,7 @@ dbGetPropFunc(key, value, propRec) propRec->keyValueList[propRec->idx] = (struct keyValuePair *)mallocMagic(sizeof(struct keyValuePair)); propRec->keyValueList[propRec->idx]->key = key; - propRec->keyValueList[propRec->idx]->value = value; + propRec->keyValueList[propRec->idx]->value = (char *)value; propRec->idx++; return 0; From c90bde496190349fe7eecaf749362da49a8db2e6 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 131/206] DBWelement.c: passing argument 1 of 'TxPrintf' from incompatible pointer type GCC14 --without-tk --without-tcl Related issue: https://github.com/RTimothyEdwards/magic/issues/323 --- dbwind/DBWelement.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dbwind/DBWelement.c b/dbwind/DBWelement.c index e6e1ff19..6172f047 100644 --- a/dbwind/DBWelement.c +++ b/dbwind/DBWelement.c @@ -630,7 +630,7 @@ DBWElementNames() HashEntry *he; #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "Known elements:"); + TxPrintf("Known elements:"); #endif HashStartSearch(&hs); @@ -641,13 +641,13 @@ DBWElementNames() #ifdef MAGIC_WRAPPER Tcl_AppendElement(magicinterp, he->h_key.h_name); #else - TxPrintf(stdout, " %s", he->h_key.h_name); + TxPrintf(" %s", he->h_key.h_name); #endif } } #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "/n"); + TxPrintf("/n"); #endif } @@ -672,7 +672,7 @@ DBWElementInbox(area) int sqdist; #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "Element(s) inside box: "); + TxPrintf("Element(s) inside box: "); #endif HashStartSearch(&hs); @@ -685,14 +685,14 @@ DBWElementInbox(area) #ifdef MAGIC_WRAPPER Tcl_AppendElement(magicinterp, he->h_key.h_name); #else - TxPrintf(stdout, " %s", he->h_key.h_name); + TxPrintf(" %s", he->h_key.h_name); #endif } } } #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "/n"); + TxPrintf("/n"); #endif } From e5c3e703c3351223a28c4777d65baa874a2c6bf6 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 132/206] HashLookOnly(): passing argument 2 of 'HashLookOnly' makes pointer from integer without a cast Also HashFind() GCC14 --without-tk --without-tcl Related issue: https://github.com/RTimothyEdwards/magic/issues/323 --- graphics/grOGL1.c | 16 ++++++++-------- graphics/grX11su1.c | 16 ++++++++-------- windows/windCmdAM.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/graphics/grOGL1.c b/graphics/grOGL1.c index a1e69138..bf2bf3cb 100644 --- a/graphics/grOGL1.c +++ b/graphics/grOGL1.c @@ -434,7 +434,7 @@ pipehandler() int key; XKeyPressedEvent *KeyPressedEvent = (XKeyPressedEvent *) &xevent; - entry = HashLookOnly(&grOGLWindowTable, KeyPressedEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)KeyPressedEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; event = TxNewEvent(); @@ -457,7 +457,7 @@ pipehandler() XButtonEvent *ButtonEvent = (XButtonEvent *) &xevent; - entry = HashLookOnly(&grOGLWindowTable, ButtonEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)ButtonEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; event = TxNewEvent(); @@ -504,7 +504,7 @@ pipehandler() width = ConfigureEvent->width; height = ConfigureEvent->height; - entry = HashLookOnly(&grOGLWindowTable, ConfigureEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)ConfigureEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; screenRect.r_xbot = ConfigureEvent->x; @@ -525,7 +525,7 @@ pipehandler() case VisibilityNotify: { XVisibilityEvent *VisEvent = (XVisibilityEvent*) &xevent; - entry = HashLookOnly(&grOGLWindowTable, VisEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)VisEvent->window); mw = (entry)?(MagWindow *)HashGetValue(entry):0; switch(VisEvent->state) @@ -555,7 +555,7 @@ pipehandler() XEvent discard; XExposeEvent *ExposeEvent = (XExposeEvent*) &xevent; - entry = HashLookOnly(&grOGLWindowTable, ExposeEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)ExposeEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; if (!mw) break; @@ -586,7 +586,7 @@ pipehandler() XAnyEvent *AnyEvent = (XAnyEvent *) &xevent; - entry = HashLookOnly(&grOGLWindowTable, AnyEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)AnyEvent->window); mw = (entry)?(MagWindow *)HashGetValue(entry):0; SigDisableInterrupts(); @@ -852,7 +852,7 @@ GrOGLCreate(w, name) glXMakeCurrent(grXdpy, (GLXDrawable)wind, grXcontext); w->w_grdata = (ClientData) wind; - entry = HashFind(&grOGLWindowTable, wind); + entry = HashFind(&grOGLWindowTable, (char *)wind); HashSetValue(entry,w); XDefineCursor(grXdpy, wind, oglCurrent.cursor); GrOGLIconUpdate(w, w->w_caption); @@ -914,7 +914,7 @@ GrOGLDelete(w) HashEntry *entry; xw = (Window) w->w_grdata; - entry = HashLookOnly(&grOGLWindowTable,xw); + entry = HashLookOnly(&grOGLWindowTable, (char *)xw); HashSetValue(entry,NULL); XDestroyWindow(grXdpy, xw); diff --git a/graphics/grX11su1.c b/graphics/grX11su1.c index 3720e21c..68deaee7 100644 --- a/graphics/grX11su1.c +++ b/graphics/grX11su1.c @@ -794,7 +794,7 @@ grX11Stdin() } grCurrent.window = ButtonEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); grCurrent.mw= (entry)?(MagWindow *)HashGetValue(entry):0; event->txe_p.p_x = ButtonEvent->x; @@ -811,7 +811,7 @@ grX11Stdin() event = TxNewEvent(); grCurrent.window = KeyPressedEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); grCurrent.mw= (entry)?(MagWindow *)HashGetValue(entry):0; read(pipeRead, &c, sizeof(int)); @@ -832,7 +832,7 @@ grX11Stdin() MagWindow *w; grCurrent.window = ExposeEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; grCurrent.mw=w; if (!w) @@ -867,7 +867,7 @@ grX11Stdin() MagWindow *w; grCurrent.window = ConfigureEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; grCurrent.mw=w; @@ -888,7 +888,7 @@ grX11Stdin() XVisibilityEvent *VisEvent = (XVisibilityEvent*) &xevent; MagWindow *w; - entry = HashLookOnly(&grX11WindowTable, VisEvent->window); + entry = HashLookOnly(&grX11WindowTable, (char *)VisEvent->window); w = (entry)?(MagWindow *)HashGetValue(entry):0; if (!w) break; @@ -920,7 +920,7 @@ grX11Stdin() MagWindow *w; grCurrent.window = anyEvent->window; - entry = HashLookOnly(&grX11WindowTable, grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; /* The line above is defintely NOT a good idea. w == 0 causes address @@ -1233,7 +1233,7 @@ GrX11Create(w, name) grCurrent.mw = w; w->w_grdata = (ClientData) wind; - entry = HashFind(&grX11WindowTable,grCurrent.window); + entry = HashFind(&grX11WindowTable, (char *)grCurrent.window); HashSetValue(entry,w); XDefineCursor(grXdpy, grCurrent.window,grCurrent.cursor); @@ -1282,7 +1282,7 @@ GrX11Delete(w) HashEntry *entry; xw = (Window) w->w_grdata; - entry = HashLookOnly(&grX11WindowTable,xw); + entry = HashLookOnly(&grX11WindowTable, (char *)xw); HashSetValue(entry,NULL); XDestroyWindow(grXdpy,xw); diff --git a/windows/windCmdAM.c b/windows/windCmdAM.c index e2ce0639..81f5d4a8 100644 --- a/windows/windCmdAM.c +++ b/windows/windCmdAM.c @@ -1120,7 +1120,7 @@ windDoMacro(w, cmd, interactive) if (cmd->tx_argc == argstart) { - h = HashLookOnly(&MacroClients, wc); + h = HashLookOnly(&MacroClients, (char *)wc); if (h == NULL) return; else From 54f49829f2ce1d3463e5a7e451529de186e5e6e0 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 133/206] graphics: multiple definition of `various_x11_symbols' Solution is to make the grX11thread.c and grX11su1[5].c versions the official location. Another solution maybe to split them into their own file grX11common.c that would be shared. Multiple configurations tested, tested configurations assume X11 is available. The configuration wording indicates X11 must be available for all graphics enabled build configurations. Affected symbols appear to have multiple definitions: grCursors grXdpy grXscrn pipeRead pipeWrite Xhelper grVisual GCC14 and linker will not link the final executable due to this. GCC14 --without-tk --without-tcl Related issue: https://github.com/RTimothyEdwards/magic/issues/323 --- graphics/grOGL1.c | 10 +++++----- graphics/grOGL5.c | 2 +- graphics/grX11su1.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/graphics/grOGL1.c b/graphics/grOGL1.c index bf2bf3cb..355ba451 100644 --- a/graphics/grOGL1.c +++ b/graphics/grOGL1.c @@ -37,12 +37,12 @@ GLubyte **grOGLStipples; HashTable grOGLWindowTable; -Display *grXdpy; +extern Display *grXdpy; /* grX11thread.c */ GLXContext grXcontext; -int grXscrn; -int pipeRead, pipeWrite; -int Xhelper; -Visual *grVisual; +extern int grXscrn; /* grX11su1.c */ +extern int pipeRead, pipeWrite; /* grX11su1.c */ +extern int Xhelper; /* grX11su1.c */ +extern Visual *grVisual; /* grX11su1.c */ #ifdef HAVE_PTHREADS extern int writePipe; diff --git a/graphics/grOGL5.c b/graphics/grOGL5.c index f4ab4d0f..79c8a4d6 100644 --- a/graphics/grOGL5.c +++ b/graphics/grOGL5.c @@ -36,7 +36,7 @@ extern HashTable grOGLWindowTable; extern Display *grXdpy; extern int grXscrn; -Cursor grCursors[MAX_CURSORS]; +extern Cursor grCursors[MAX_CURSORS]; /* grX11su5.c */ /* diff --git a/graphics/grX11su1.c b/graphics/grX11su1.c index 68deaee7..f2efa4c9 100644 --- a/graphics/grX11su1.c +++ b/graphics/grX11su1.c @@ -52,7 +52,7 @@ extern char *DBWStyleType; -Display *grXdpy; +extern Display *grXdpy; /* grX11thread.c */ int grXscrn; Colormap grXcmap; Visual *grVisual; From 932deeaf2dcdf8d1665bf8ebe53e9828019bff73 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 134/206] readline: define _XOPEN_SOURCE at the top of files It is a requirement to define feature_test_macros(7) as soon as possible before including any files, otherwise the headers may not allow further configuration, as reconfiguration maybe denied. You need to pick the standard you wish to work with for the compilation unit (the file). This can be seen with an error for lack of symbol `wcwidth()` from wchar.h Moving the order slightly fixes the compile failure issue. See feature_test_macros(7) for more info. GCC14 --without-tk --without-tcl (without system libreadline-dev) --- readline/readline-4.3/display.c | 3 ++- readline/readline-4.3/mbutil.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/readline/readline-4.3/display.c b/readline/readline-4.3/display.c index 83f12f26..ab6e39b1 100644 --- a/readline/readline-4.3/display.c +++ b/readline/readline-4.3/display.c @@ -21,6 +21,8 @@ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #define READLINE_LIBRARY +#define _XOPEN_SOURCE /* See feature_test_macros(7) */ + #if defined (HAVE_CONFIG_H) # include #endif @@ -41,7 +43,6 @@ #include -#define _XOPEN_SOURCE /* See feature_test_macros(7) */ #include /* System-specific feature definitions and include files. */ diff --git a/readline/readline-4.3/mbutil.c b/readline/readline-4.3/mbutil.c index 397c22a6..32cbee1f 100644 --- a/readline/readline-4.3/mbutil.c +++ b/readline/readline-4.3/mbutil.c @@ -25,6 +25,8 @@ # include #endif +#define _XOPEN_SOURCE /* See feature_test_macros(7) */ + #include #include #include From 32a7323287fc8b652a10b9e8cb20396fcfbba2ae Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 135/206] SimSelect.c: type defaults to 'int' in declaration of 'RsimErrorMsg' GCC14 --without-tk --without-tcl Related issue: https://github.com/RTimothyEdwards/magic/issues/323 --- sim/SimSelect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/SimSelect.c b/sim/SimSelect.c index db0ffebd..41290dea 100644 --- a/sim/SimSelect.c +++ b/sim/SimSelect.c @@ -445,7 +445,7 @@ SimSelection(cmd) char *strPtr; bool goodReply; - extern RsimErrorMsg(); + extern void RsimErrorMsg(); timeString[0] = 0; From 1ae45188468934f57c9c71fb015e8bf73acf374f Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 136/206] DLONG_PREFIX is %ld on x86_64 LP64 GCC14 loud default warnings fix --- utils/magic.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/magic.h b/utils/magic.h index ca9e1eec..eebcd253 100644 --- a/utils/magic.h +++ b/utils/magic.h @@ -49,7 +49,13 @@ ERROR: Cannot compile without knowing the size of a pointer. See utils/magic.h typedef int64_t dlong; #define DLONG_MAX INT64_MAX #define DLONG_MIN INT64_MIN +#if (defined(__x86_64__) && !defined(_WIN64)) +/* gcc x86_64 defines int64_t as 'long int' on LP64 */ +#define DLONG_PREFIX "l" +#else +/* for 32bit and 64bit LLP64 (_WIN64) systems */ #define DLONG_PREFIX "ll" +#endif /* --------------------- Universal pointer type ----------------------- */ From b3cb528e46d29970b2cad84d8ec2ef384eda277d Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 137/206] ExtBasic.c: comparison between pointer and integer GCC14 loud default warnings series --- extract/ExtBasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 7515b9ba..a776b893 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -2879,7 +2879,7 @@ extTransFindSubsFunc1(tile, noderecptr) if (tile->ti_client != (ClientData) extUnInit) { if ((noderecptr->region != (NodeRegion *)NULL) && - (noderecptr->region != tile->ti_client)) + ((ClientData)noderecptr->region != tile->ti_client)) TxError("Warning: Split substrate under device at (%d %d)\n", tile->ti_ll.p_x, tile->ti_ll.p_y); if (IsSplit(tile)) From 66734bbaeeb7b85182c574c40c86d12c7c63dce5 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 138/206] ExtHier.c: format '%ld' expects argument of type 'long int', but .. 'dlong' GCC14 loud default warnings series --- extract/ExtHier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtHier.c b/extract/ExtHier.c index e886267b..24c8e036 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -854,7 +854,7 @@ extOutputConns(table, outf) fprintf(outf, "merge \"%s\" \"%s\" %lg", nn->nn_name, nnext->nn_name, c); for (n = 0; n < ExtCurStyle->exts_numResistClasses; n++) - fprintf(outf, " %ld %d", + fprintf(outf, " %"DLONG_PREFIX"d %d", node->node_pa[n].pa_area, node->node_pa[n].pa_perim); fprintf(outf, "\n"); From 41913fbd7824bfc93d2a215e35f816953e94ecdd Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 139/206] ExtUnique.c: '_uq' directive writing 3 bytes into a region of size between 1 and 1024 GCC14 loud default warnings series [-Wformat-overflow=] --- extract/ExtUnique.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extract/ExtUnique.c b/extract/ExtUnique.c index 028a6e49..98ca9b69 100644 --- a/extract/ExtUnique.c +++ b/extract/ExtUnique.c @@ -203,7 +203,7 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option) { static char *badmesg = "Non-global label \"%s\" attached to more than one unconnected node: %s"; - char *cpend, *text, name[1024], name2[1024], message[1024]; + char *cpend, *text, name[1024], name2[1024+32], message[1024]; LabRegion *lp2; LabelList *ll2; int nsuffix, nwarn; From b81e04eed48138f659a2fc99a079ac2dd29e0c8f Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 140/206] ResPrint.c: '%s' directive writing 2 bytes into a region of size between 1 and 1000 GCC14 loud default warnings series [-Wformat-overflow=] --- resis/ResPrint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resis/ResPrint.c b/resis/ResPrint.c index 17b20db9..49e8c537 100644 --- a/resis/ResPrint.c +++ b/resis/ResPrint.c @@ -218,7 +218,7 @@ ResPrintExtNode(outextfile, nodelist, nodename) char *nodename; { int nodenum = 0; - char newname[MAXNAME], tmpname[MAXNAME], *cp; + char newname[MAXNAME+32], tmpname[MAXNAME], *cp; HashEntry *entry; ResSimNode *node, *ResInitializeNode(); bool DoKillNode = TRUE; From bf916d264724d37eb5aba70cea731e7a8d6ba7f9 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 141/206] SimRsim.c: directive writing 1 byte into a region of size between 0 and 255 GCC14 loud default warnings series [-Wformat-overflow=] --- sim/SimRsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/SimRsim.c b/sim/SimRsim.c index 129a73f6..5088e8c3 100644 --- a/sim/SimRsim.c +++ b/sim/SimRsim.c @@ -553,7 +553,7 @@ SimRsimIt(cmd, nodeName) char *nodeName; { - static char cmdStr[256]; + static char cmdStr[512]; static char cleanName[256]; char *strptr; From 29bd23d40b362ea5ab1c9c15d644ee44b696a8ca Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 142/206] txOutput.c:408: warning: missing sentinel in function call GCC false positive, seems pedantic over it being NULL not 0. GCC14 loud default warnings series [-Wformat=] --- textio/txOutput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textio/txOutput.c b/textio/txOutput.c index 7d6bda23..7aec132e 100644 --- a/textio/txOutput.c +++ b/textio/txOutput.c @@ -405,7 +405,7 @@ TxUseMore() pagername++; else pagername = pagerpath; - execl(pagerpath, pagername, 0); + execl(pagerpath, pagername, NULL); /* Something went very wrong if it gets here. */ From 9f88450243e9a76ed12a58345b60a9ebbb48a1bd Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 143/206] niceabort.c: '%s' directive writing up to 199 bytes into a region of size 177 GCC14 loud default warnings series [-Wformat-overflow=] --- utils/niceabort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/niceabort.c b/utils/niceabort.c index 8c23fb5b..8533f800 100644 --- a/utils/niceabort.c +++ b/utils/niceabort.c @@ -67,7 +67,7 @@ DumpCore() int cpid, gcpid, wpid; FILE *commentFile, *crashFile; time_t now; - char pidString[20], line[150], command[200], tempName[200], *crashDir; + char pidString[20], line[150], command[512], tempName[200], *crashDir; TxPrintf("Please wait while magic generates a core image of itself....\n"); sprintf(pidString, "%d", parentPid); From 6a08b31149676d7c5ec7d4ba0cd8eb6cef79521a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 144/206] defWrite.: '%.10g' directive writing between 1 and 17 bytes into a region of size 12 GCC14 loud default warnings series [-Wformat-overflow=] --- lef/defWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lef/defWrite.c b/lef/defWrite.c index 95835752..8cfb800d 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -531,7 +531,7 @@ defWriteRouteWidth(defdata, width) int width; { float oscale = defdata->scale; - char numstr[12]; + char numstr[32]; sprintf(numstr, "%.10g", ((float)width * defdata->scale)); defCheckForBreak(strlen(numstr) + 1, defdata); fprintf(defdata->f, "%s ", numstr); @@ -564,7 +564,7 @@ defWriteCoord(defdata, x, y, orient) unsigned char orient; { FILE *f = defdata->f; - char numstr[12]; + char numstr[32]; int ctot = 4; /* The "12" here is just a fudge factor; it is not crucial */ From 1c326c9141e657d0faad356759b630f3314c738a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 145/206] grouteCrss.c: '%s' directive writing up to 1023 bytes into a region of size 227 GCC14 loud default warnings series [-Wformat-overflow=] --- grouter/grouteCrss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grouter/grouteCrss.c b/grouter/grouteCrss.c index 3d12540b..ffe49b81 100644 --- a/grouter/grouteCrss.c +++ b/grouter/grouteCrss.c @@ -166,7 +166,7 @@ glCrossTakePin(rootUse, pin, netid) GCRPin *pin; /* Pin to take */ NetId netid; /* Identifier to assign */ { - char c[256], name1[1024], name2[1024]; + char c[2048+64], name1[1024], name2[1024]; Rect r; if (DebugIsSet(glDebugID, glDebGreedy)) From 63256f1a4433aeeeef1fbb6573e1526ccee1411d Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 146/206] DBio.c: resolve warnings and use snprintf() GCC14 loud default warnings series [-Wformat-overflow=] --- database/DBio.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/database/DBio.c b/database/DBio.c index 0039d6f4..be3f11f0 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -1072,7 +1072,7 @@ DBFileRecovery(filename) struct stat sbuf; uid_t userid = getuid(); time_t recent = 0; - char *snptr, *tempdir, tempname[256]; + char *snptr, *tempdir, tempname[1024]; int pid; static char *actionNames[] = {"read", "cancel", 0 }; char *prompt; @@ -1098,7 +1098,8 @@ DBFileRecovery(filename) while ((dp = readdir(cwd)) != NULL) { char *doslash = (tempdir[strlen(tempdir) - 1] == '/') ? "" : "/"; - sprintf(tempname, "%s%s%s", tempdir, doslash, dp->d_name); + int n = snprintf(tempname, sizeof(tempname), "%s%s%s", tempdir, doslash, dp->d_name); + ASSERT(n < sizeof(tempname), "tempname"); snptr = tempname + strlen(tempdir); if (!strncmp(snptr, "MAG", 3)) { @@ -1909,7 +1910,8 @@ badTransform: { char savepath[1024]; strcpy(savepath, pathptr); - sprintf(path, "%s/%s", cellDef->cd_file, savepath); + int n = snprintf(path, sizeof(path), "%s/%s", cellDef->cd_file, savepath); + ASSERT(n < sizeof(path), "path"); } pathptr = &path[0]; *slashptr = '/'; @@ -2032,7 +2034,8 @@ badTransform: dup2(link[1], STDOUT_FILENO); close(link[0]); close(link[1]); - sprintf(argstr, "-C %s", pathptr); + int n = snprintf(argstr, sizeof(argstr), "-C %s", pathptr); + ASSERT(n < sizeof(argstr), "argstr"); execlp("git", argstr, "rev-parse", "HEAD", NULL); _exit(122); /* see vfork man page for reason for _exit() */ } From 65a0dc45dc902027860bedd8b51f88d12fe78141 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 2 Oct 2024 06:59:00 +0100 Subject: [PATCH 147/206] graphics: windowname[] potential buffer overrun warning GCC14 loud default warnings series --- graphics/grTCairo1.c | 2 +- graphics/grTOGL1.c | 2 +- graphics/grTk1.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/graphics/grTCairo1.c b/graphics/grTCairo1.c index 29fc05eb..30cb777a 100644 --- a/graphics/grTCairo1.c +++ b/graphics/grTCairo1.c @@ -1079,7 +1079,7 @@ char *name; static int WindowNumber = 0; HashEntry *entry; char *windowplace; - char windowname[10]; + char windowname[32]; int x = w->w_frameArea.r_xbot; int y = grTransYs(w->w_frameArea.r_ytop); int width = w->w_frameArea.r_xtop - w->w_frameArea.r_xbot; diff --git a/graphics/grTOGL1.c b/graphics/grTOGL1.c index 2feccdf1..6b1522ee 100644 --- a/graphics/grTOGL1.c +++ b/graphics/grTOGL1.c @@ -1081,7 +1081,7 @@ GrTOGLCreate(w, name) static int WindowNumber = 0; HashEntry *entry; char *windowplace; - char windowname[10]; + char windowname[32]; int x = w->w_frameArea.r_xbot; int y = glTransYs(w->w_frameArea.r_ytop); int width = w->w_frameArea.r_xtop - w->w_frameArea.r_xbot; diff --git a/graphics/grTk1.c b/graphics/grTk1.c index 7712d333..3f080055 100644 --- a/graphics/grTk1.c +++ b/graphics/grTk1.c @@ -1308,7 +1308,7 @@ GrTkCreate(w, name) static int WindowNumber = 0; HashEntry *entry; char *windowplace; - char windowname[10]; + char windowname[32]; int x = w->w_frameArea.r_xbot; int y = grMagicToXs(w->w_frameArea.r_ytop); int width = w->w_frameArea.r_xtop - w->w_frameArea.r_xbot; From 015f03307aed915a2db36d96c348e3caea8672e1 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Thu, 3 Oct 2024 22:59:00 +0100 Subject: [PATCH 148/206] appimage/Dockerfile: fix CentOS7 based docker build due to EOL CentOS7 went EOL on June 30, 2024 this builds out of vault.centos.org --- appimage/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/appimage/Dockerfile b/appimage/Dockerfile index ec683035..2242360f 100644 --- a/appimage/Dockerfile +++ b/appimage/Dockerfile @@ -2,6 +2,17 @@ FROM centos/python-38-centos7:20210726-fad62e9 USER root +# CentOS7 went EOL on June 30, 2024 this builds out of vault.centos.org +RUN ls -l /etc/yum.repos.d/ \ + && cp /etc/yum.repos.d/CentOS-Base.repo /tmp/CentOS-Base.repo.old \ + && sed -e 's/mirror.centos.org/vault.centos.org/g' -i /etc/yum.repos.d/*.repo \ + && sed -e 's/^#.*baseurl=http/baseurl=http/g' -i /etc/yum.repos.d/*.repo \ + && sed -e 's/^mirrorlist=http/#mirrorlist=http/g' -i /etc/yum.repos.d/*.repo \ + && diff -u /tmp/CentOS-Base.repo.old /etc/yum.repos.d/CentOS-Base.repo; \ + yum clean all \ + && yum -y update \ + && rm -f /tmp/CentOS-Base.repo.old + # Build Dependencies RUN yum install -y cairo-devel freeglut-devel gcc make tcsh From 4ea0f6a9b75fa6e7b7484464fc5198eb5ada9506 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 16:01:27 +0100 Subject: [PATCH 149/206] DBcellcopy.c: fix warning: self-comparison always evaluates to false Looks like a straighforward logic bug from a recent (2023) change. GCC14 -Wall cleanup series [-Wtautological-compare] --- database/DBcellcopy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBcellcopy.c b/database/DBcellcopy.c index d253ea08..3a173c6b 100644 --- a/database/DBcellcopy.c +++ b/database/DBcellcopy.c @@ -666,7 +666,7 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels, doclear) scx.scx_y++; scx.scx_x = use->cu_xlo; } - else if (use->cu_yhi > use->cu_yhi) + else if (use->cu_ylo > use->cu_yhi) { scx.scx_y--; scx.scx_x = use->cu_xlo; From cebb1a5277df70574ce4a370b2ab74283ca6bd69 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 16:01:47 +0100 Subject: [PATCH 150/206] lefTech.c: fix: default value logic error Looks like a logic bug, hiding behind this compiler warning lefTech.c:507:21: warning: suggest parentheses around assignment used as truth value lefTech.c:509:21: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- lef/lefTech.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lef/lefTech.c b/lef/lefTech.c index 16644e16..aecfa6bb 100644 --- a/lef/lefTech.c +++ b/lef/lefTech.c @@ -504,9 +504,9 @@ LefTechSetDefaults() } else if (lefl->lefClass == CLASS_ROUTE) { - if (lefl->info.route.width = -1) + if (lefl->info.route.width == -1) lefl->info.route.width = DRCGetDefaultLayerWidth(lefl->type); - if (lefl->info.route.spacing = -1) + if (lefl->info.route.spacing == -1) lefl->info.route.width = DRCGetDefaultLayerSpacing(lefl->type, lefl->type); } From c749d01eb79c254ce38640cacd1672e407697000 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 16:02:04 +0100 Subject: [PATCH 151/206] rtrStem.c: fix: warning: statement with no effect Looks like a logic bug hidden in the warning. GCC14 -Wall cleanup series [-Wunused-value] --- router/rtrStem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/rtrStem.c b/router/rtrStem.c index 54b9da1a..e36950a3 100644 --- a/router/rtrStem.c +++ b/router/rtrStem.c @@ -355,7 +355,7 @@ RtrStemAssignExt(use, doWarn, loc, term, net) */ pins = 0; - loc->nloc_chan == (GCRChannel *) NULL; + loc->nloc_chan = (GCRChannel *) NULL; for ( dr = dirs; dr->dr_dir; dr++) { StemInfo si; From 3477480ab0512bbcf0ffa356810f427b790634b3 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 16:03:53 +0100 Subject: [PATCH 152/206] NMbutton.c: fix: warning: statement with no effect Looks like a logic bug hidden in the warning. GCC14 -Wall cleanup series [-Wunused-value] --- netmenu/NMbutton.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netmenu/NMbutton.c b/netmenu/NMbutton.c index 723a6c4b..43d40308 100644 --- a/netmenu/NMbutton.c +++ b/netmenu/NMbutton.c @@ -79,7 +79,7 @@ NMButtonNetList(window, cmd, nmButton, point) else { TxPrintf("New net list name: "); - if (TxGetLine(newName, MAXLENGTH) == NULL) newName[0] == 0; + if (TxGetLine(newName, MAXLENGTH) == NULL) newName[0] = 0; if (newName[0] == 0) return; NMNewNetlist(newName); } From da2c7b719ed1d5e887853911f5cd985168a39922 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 16:04:45 +0100 Subject: [PATCH 153/206] DRCsubcell.c: fix: warning: value computed is not used Looks like a logic bug hidden in the warning. GCC14 -Wall cleanup series [-Wunused-value] --- drc/DRCsubcell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drc/DRCsubcell.c b/drc/DRCsubcell.c index a301da4b..cae91269 100644 --- a/drc/DRCsubcell.c +++ b/drc/DRCsubcell.c @@ -965,5 +965,5 @@ drcIncCount(def, area, rule, count) DRCCookie *rule; int *count; { - *count++; + (*count)++; } From 3300f45a228eff4886420e49a89bcfe6a12858e9 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 16:08:45 +0100 Subject: [PATCH 154/206] DRCtech.c: warning: use of logical '&&' with constant operand Looks like logic error hiding behind warning DRCtech.c:4365:22: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand] DRCtech.c:4365:22: note: remove constant to silence this warning clang18 default warning cleanup --- drc/DRCtech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drc/DRCtech.c b/drc/DRCtech.c index d5242355..a19e580f 100644 --- a/drc/DRCtech.c +++ b/drc/DRCtech.c @@ -4362,7 +4362,7 @@ DRCGetDefaultLayerSurround(ttype1, ttype2) cset = &cptr->drcc_corner; if (TTMaskHasType(set, TT_SPACE) && !TTMaskHasType(set, ttype1)) if ((TTMaskHasType(cset, ttype2)) && - (cptr->drcc_flags && DRC_BOTHCORNERS) && + (cptr->drcc_flags & DRC_BOTHCORNERS) && (cptr->drcc_edgeplane == cptr->drcc_plane) && (cptr->drcc_dist == cptr->drcc_cdist)) { From 967b41343b385c06604017baaacb8b22cb5944ef Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:02:09 +0100 Subject: [PATCH 155/206] GCC14: warning: missing braces around initializer GCC14 -Wall cleanup series [-Wmissing-braces] --- cmwind/CMWmain.c | 52 ++++++------- commands/CmdE.c | 2 +- commands/CmdRS.c | 2 +- commands/CmdSubrs.c | 14 ++-- database/DBtechtype.c | 34 ++++---- dbwind/DBWundo.c | 2 +- drc/DRCarray.c | 2 +- drc/DRCbasic.c | 2 +- drc/DRCsubcell.c | 6 +- drc/DRCtech.c | 96 +++++++++++------------ extflat/EFread.c | 52 ++++++------- extract/ExtMain.c | 34 ++++---- extract/ExtTech.c | 176 +++++++++++++++++++++--------------------- extract/ExtTest.c | 32 ++++---- garouter/gaTest.c | 30 +++---- graphics/grClip.c | 2 +- graphics/grMain.c | 2 +- grouter/grouteTest.c | 48 ++++++------ irouter/irCommand.c | 118 ++++++++++++++-------------- irouter/irMain.c | 6 +- irouter/irTestCmd.c | 16 ++-- mzrouter/mzInit.c | 6 +- mzrouter/mzTech.c | 4 +- mzrouter/mzTestCmd.c | 36 ++++----- netmenu/NMmain.c | 68 ++++++++-------- plot/plotVers.c | 18 ++--- plow/PlowTech.c | 10 +-- plow/PlowTest.c | 60 +++++++------- router/rtrCmd.c | 24 +++--- router/rtrStem.c | 2 +- select/selUndo.c | 2 +- tiles/tile.c | 2 +- utils/geometry.c | 72 ++++++++--------- utils/set.c | 18 ++--- 34 files changed, 525 insertions(+), 525 deletions(-) diff --git a/cmwind/CMWmain.c b/cmwind/CMWmain.c index 38a3040c..127b0ae4 100644 --- a/cmwind/CMWmain.c +++ b/cmwind/CMWmain.c @@ -91,36 +91,36 @@ extern void CMWundoInit(); ColorBar colorBars[] = { - "Red", CB_RED, STYLE_RED, {2000, 8000, 10000, 9000}, - {2000, 9500, 10000, 10500}, - "Green", CB_GREEN, STYLE_GREEN, {2000, 5000, 10000, 6000}, - {2000, 6500, 10000, 7500}, - "Blue", CB_BLUE, STYLE_BLUE, {2000, 2000, 10000, 3000}, - {2000, 3500, 10000, 4500}, - "Hue", CB_HUE, STYLE_YELLOW, {14000, 8000, 22000, 9000}, - {14000, 9500, 22000, 10500}, - "Saturation", CB_SAT, STYLE_GRAY, {14000, 5000, 22000, 6000}, - {14000, 6500, 22000, 7500}, - "Value", CB_VALUE, STYLE_BROWN1, {14000, 2000, 22000, 3000}, - {14000, 3500, 22000, 4500}, - 0 + {"Red", CB_RED, STYLE_RED, {{ 2000, 8000}, {10000, 9000}}, + {{ 2000, 9500}, {10000, 10500}}}, + {"Green", CB_GREEN, STYLE_GREEN, {{ 2000, 5000}, {10000, 6000}}, + {{ 2000, 6500}, {10000, 7500}}}, + {"Blue", CB_BLUE, STYLE_BLUE, {{ 2000, 2000}, {10000, 3000}}, + {{ 2000, 3500}, {10000, 4500}}}, + {"Hue", CB_HUE, STYLE_YELLOW, {{14000, 8000}, {22000, 9000}}, + {{14000, 9500}, {22000, 10500}}}, + {"Saturation", CB_SAT, STYLE_GRAY, {{14000, 5000}, {22000, 6000}}, + {{14000, 6500}, {22000, 7500}}}, + {"Value", CB_VALUE, STYLE_BROWN1, {{14000, 2000}, {22000, 3000}}, + {{14000, 3500}, {22000, 4500}}}, + {0} }; ColorPump colorPumps[] = { - CB_RED, -.0078, {500, 8000, 1500, 9000}, - CB_RED, .0078, {10500, 8000, 11500, 9000}, - CB_GREEN, -.0078, {500, 5000, 1500, 6000}, - CB_GREEN, .0078, {10500, 5000, 11500, 6000}, - CB_BLUE, -.0078, {500, 2000, 1500, 3000}, - CB_BLUE, .0078, {10500, 2000, 11500, 3000}, - CB_HUE, -.01, {12500, 8000, 13500, 9000}, - CB_HUE, .01, {22500, 8000, 23500, 9000}, - CB_SAT, -.01, {12500, 5000, 13500, 6000}, - CB_SAT, .01, {22500, 5000, 23500, 6000}, - CB_VALUE, -.01, {12500, 2000, 13500, 3000}, - CB_VALUE, .01, {22500, 2000, 23500, 3000}, - -1 + {CB_RED, -.0078, {{ 500, 8000}, { 1500, 9000}}}, + {CB_RED, .0078, {{10500, 8000}, {11500, 9000}}}, + {CB_GREEN, -.0078, {{ 500, 5000}, { 1500, 6000}}}, + {CB_GREEN, .0078, {{10500, 5000}, {11500, 6000}}}, + {CB_BLUE, -.0078, {{ 500, 2000}, { 1500, 3000}}}, + {CB_BLUE, .0078, {{10500, 2000}, {11500, 3000}}}, + {CB_HUE, -.01, {{12500, 8000}, {13500, 9000}}}, + {CB_HUE, .01, {{22500, 8000}, {23500, 9000}}}, + {CB_SAT, -.01, {{12500, 5000}, {13500, 6000}}}, + {CB_SAT, .01, {{22500, 5000}, {23500, 6000}}}, + {CB_VALUE, -.01, {{12500, 2000}, {13500, 3000}}}, + {CB_VALUE, .01, {{22500, 2000}, {23500, 3000}}}, + {-1} }; Rect cmwCurrentColorArea = {{6000, 12000}, {18000, 15000}}; diff --git a/commands/CmdE.c b/commands/CmdE.c index 28f10edc..dab3ab70 100644 --- a/commands/CmdE.c +++ b/commands/CmdE.c @@ -201,7 +201,7 @@ cmdEditRedisplayFunc(w, area) MagWindow *w; /* Window containing edit cell. */ Rect *area; /* Area to be redisplayed. */ { - static Rect origin = {-1, -1, 1, 1}; + static Rect origin = {{-1, -1}, {1, 1}}; Rect tmp; DBWclientRec *crec = (DBWclientRec *) w->w_clientData; diff --git a/commands/CmdRS.c b/commands/CmdRS.c index 9f06c33c..d2a4c6a2 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -817,7 +817,7 @@ CmdSelect(w, cmd) * multiples types are pointed to, consecutive * selections will cycle through them. */ - static Rect lastArea = {-100, -100, -200, -200}; + static Rect lastArea = {{-100, -100}, {-200, -200}}; /* Used to remember region around what was * pointed at in the last select command: a * new selection in this area causes the next diff --git a/commands/CmdSubrs.c b/commands/CmdSubrs.c index c5cdf734..18157db6 100644 --- a/commands/CmdSubrs.c +++ b/commands/CmdSubrs.c @@ -399,13 +399,13 @@ CmdParseLayers(s, mask) } special[] = { - "$", LN_DOLLAR, - "*", LN_ALL, - "errors", LN_ERRORS, - "labels", LN_LABELS, - "subcell", LN_CELL, - "connect", LN_CONNECT, - 0, + {"$", LN_DOLLAR}, + {"*", LN_ALL}, + {"errors", LN_ERRORS}, + {"labels", LN_LABELS}, + {"subcell", LN_CELL}, + {"connect", LN_CONNECT}, + {0}, }; diff --git a/database/DBtechtype.c b/database/DBtechtype.c index e7fe51ed..f8509df6 100644 --- a/database/DBtechtype.c +++ b/database/DBtechtype.c @@ -70,28 +70,28 @@ TileTypeBitMask DBTechActiveLayerBits; /* Layers marked locked in the techfile * /* Table of default, builtin planes */ DefaultPlane dbTechDefaultPlanes[] = { - PL_ROUTER, "router", - PL_DRC_ERROR, "designRuleError", - PL_DRC_CHECK, "designRuleCheck", - PL_M_HINT, "mhint", - PL_F_HINT, "fhint", - PL_R_HINT, "rhint", - 0, 0, 0 + {PL_ROUTER, "router"}, + {PL_DRC_ERROR, "designRuleError"}, + {PL_DRC_CHECK, "designRuleCheck"}, + {PL_M_HINT, "mhint"}, + {PL_F_HINT, "fhint"}, + {PL_R_HINT, "rhint"}, + {0, NULL} }; /* Table of default, builtin types */ DefaultType dbTechDefaultTypes[] = { - TT_SPACE, -1, "space", FALSE, - TT_CHECKPAINT, PL_DRC_CHECK, "checkpaint,CP", FALSE, - TT_CHECKSUBCELL, PL_DRC_CHECK, "checksubcell,CS", FALSE, - TT_ERROR_P, PL_DRC_ERROR, "error_p,EP", FALSE, - TT_ERROR_S, PL_DRC_ERROR, "error_s,ES", FALSE, - TT_ERROR_PS, PL_DRC_ERROR, "error_ps,EPS", FALSE, - TT_MAGNET, PL_M_HINT, "magnet,mag", TRUE, - TT_FENCE, PL_F_HINT, "fence,f", TRUE, - TT_ROTATE, PL_R_HINT, "rotate,r", TRUE, - 0, 0, NULL, 0 + {TT_SPACE, -1, "space", FALSE}, + {TT_CHECKPAINT, PL_DRC_CHECK, "checkpaint,CP", FALSE}, + {TT_CHECKSUBCELL, PL_DRC_CHECK, "checksubcell,CS", FALSE}, + {TT_ERROR_P, PL_DRC_ERROR, "error_p,EP", FALSE}, + {TT_ERROR_S, PL_DRC_ERROR, "error_s,ES", FALSE}, + {TT_ERROR_PS, PL_DRC_ERROR, "error_ps,EPS", FALSE}, + {TT_MAGNET, PL_M_HINT, "magnet,mag", TRUE}, + {TT_FENCE, PL_F_HINT, "fence,f", TRUE}, + {TT_ROTATE, PL_R_HINT, "rotate,r", TRUE}, + {0, 0, NULL, 0} }; /* Forward declarations */ diff --git a/dbwind/DBWundo.c b/dbwind/DBWundo.c index 3a2e148d..37b78db3 100644 --- a/dbwind/DBWundo.c +++ b/dbwind/DBWundo.c @@ -208,7 +208,7 @@ dbwUndoChangeEdit(ep) Rect area; CellUse *use; CellDef *editDef, *parent; - static Rect origin = {-1, -1, 1, 1}; + static Rect origin = {{-1, -1}, {1, 1}}; /* Redisplay the old edit cell */ GeoTransRect(&EditToRootTransform, &(EditCellUse->cu_def->cd_bbox), &area); diff --git a/drc/DRCarray.c b/drc/DRCarray.c index cbaaaffb..4e48926a 100644 --- a/drc/DRCarray.c +++ b/drc/DRCarray.c @@ -44,7 +44,7 @@ extern int drcArrayYankFunc(), drcArrayOverlapFunc(); static DRCCookie drcArrayCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_ARRAY_OVERLAP_TAG, (DRCCookie *) NULL diff --git a/drc/DRCbasic.c b/drc/DRCbasic.c index d56f5185..3cf2e14e 100644 --- a/drc/DRCbasic.c +++ b/drc/DRCbasic.c @@ -46,7 +46,7 @@ int dbDRCDebug = 0; static DRCCookie drcOverlapCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_OVERLAP_TAG, (DRCCookie *) NULL diff --git a/drc/DRCsubcell.c b/drc/DRCsubcell.c index cae91269..7d82cc66 100644 --- a/drc/DRCsubcell.c +++ b/drc/DRCsubcell.c @@ -55,7 +55,7 @@ static ClientData drcSubClientData; static DRCCookie drcSubcellCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_SUBCELL_OVERLAP_TAG, (DRCCookie *) NULL @@ -68,7 +68,7 @@ static DRCCookie drcSubcellCookie = { static DRCCookie drcInSubCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_IN_SUBCELL_TAG, (DRCCookie *) NULL @@ -82,7 +82,7 @@ static DRCCookie drcInSubCookie = { static DRCCookie drcOffGridCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_OFFGRID_TAG, (DRCCookie *) NULL diff --git a/drc/DRCtech.c b/drc/DRCtech.c index a19e580f..0e02924e 100644 --- a/drc/DRCtech.c +++ b/drc/DRCtech.c @@ -826,7 +826,7 @@ DRCTechLine(sectionName, argc, argv) if (DRCStyleList == NULL) { - char *locargv[2][10] = {"style", "default"}; + char *locargv[2][10] = {{"style"}, {"default"}}; if (DRCTechLine(sectionName, 2, locargv) == FALSE) return FALSE; @@ -1022,53 +1022,53 @@ DRCTechAddRule(sectionName, argc, argv) int (*rk_proc)(); /* Procedure implementing this keyword */ char *rk_err; /* Error message */ } ruleKeys[] = { - "angles", 4, 4, drcAngles, - "layers 45|90 why", - "edge", 8, 9, drcEdge, - "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]", - "edge4way", 8, 9, drcEdge, - "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]", - "exact_overlap", 2, 2, drcExactOverlap, - "layers", - "extend", 5, 6, drcExtend, - "layers1 layers2 distance [option] why", - "no_overlap", 3, 3, drcNoOverlap, - "layers1 layers2", - "option", 2, 2, drcOption, - "option_name option_value", - "overhang", 5, 5, drcOverhang, - "layers1 layers2 distance why", - "rect_only", 3, 3, drcRectOnly, - "layers why", - "spacing", 6, 7, drcSpacing, - "layers1 layers2 separation [layers3] adjacency why", - "stepsize", 2, 2, drcStepSize, - "step_size", - "surround", 6, 7, drcSurround, - "layers1 layers2 distance presence why", - "width", 4, 5, drcWidth, - "layers width why", - "widespacing", 7, 8, drcSpacing, - "layers1 width layers2 separation adjacency why", - "area", 5, 5, drcArea, - "layers area horizon why", - "off_grid", 4, 4, drcOffGrid, - "layers pitch why", - "maxwidth", 4, 5, drcMaxwidth, - "layers maxwidth bends why", - "cifstyle", 2, 2, drcCifSetStyle, - "cif_style", - "cifwidth", 4, 4, drcCifWidth, - "layers width why", - "cifspacing", 6, 6, drcCifSpacing, - "layers1 layers2 separation adjacency why", - "cifarea", 5, 5, drcCifArea, - "layers area horizon why", - "cifmaxwidth", 5, 5, drcCifMaxwidth, - "layers maxwidth bends why", - "rectangle", 5, 5, drcRectangle, - "layers maxwidth [even|odd|any] why", - 0 + {"angles", 4, 4, drcAngles, + "layers 45|90 why"}, + {"edge", 8, 9, drcEdge, + "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]"}, + {"edge4way", 8, 9, drcEdge, + "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]"}, + {"exact_overlap", 2, 2, drcExactOverlap, + "layers"}, + {"extend", 5, 6, drcExtend, + "layers1 layers2 distance [option] why"}, + {"no_overlap", 3, 3, drcNoOverlap, + "layers1 layers2"}, + {"option", 2, 2, drcOption, + "option_name option_value"}, + {"overhang", 5, 5, drcOverhang, + "layers1 layers2 distance why"}, + {"rect_only", 3, 3, drcRectOnly, + "layers why"}, + {"spacing", 6, 7, drcSpacing, + "layers1 layers2 separation [layers3] adjacency why"}, + {"stepsize", 2, 2, drcStepSize, + "step_size"}, + {"surround", 6, 7, drcSurround, + "layers1 layers2 distance presence why"}, + {"width", 4, 5, drcWidth, + "layers width why"}, + {"widespacing", 7, 8, drcSpacing, + "layers1 width layers2 separation adjacency why"}, + {"area", 5, 5, drcArea, + "layers area horizon why"}, + {"off_grid", 4, 4, drcOffGrid, + "layers pitch why"}, + {"maxwidth", 4, 5, drcMaxwidth, + "layers maxwidth bends why"}, + {"cifstyle", 2, 2, drcCifSetStyle, + "cif_style"}, + {"cifwidth", 4, 4, drcCifWidth, + "layers width why"}, + {"cifspacing", 6, 6, drcCifSpacing, + "layers1 layers2 separation adjacency why"}, + {"cifarea", 5, 5, drcCifArea, + "layers area horizon why"}, + {"cifmaxwidth", 5, 5, drcCifMaxwidth, + "layers maxwidth bends why"}, + {"rectangle", 5, 5, drcRectangle, + "layers maxwidth [even|odd|any] why"}, + {0} }, *rp; drcRulesSpecified += 1; diff --git a/extflat/EFread.c b/extflat/EFread.c index 0d472350..7692a9d6 100644 --- a/extflat/EFread.c +++ b/extflat/EFread.c @@ -71,32 +71,32 @@ static struct } keyTable[] = { - "abstract", ABSTRACT, 0, /* defines a LEF-like view */ - "adjust", ADJUST, 4, - "attr", ATTR, 8, - "cap", CAP, 4, - "device", DEVICE, 11, /* effectively replaces "fet" */ - "distance", DIST, 4, - "equiv", EQUIV, 3, - "fet", FET, 12, /* for backwards compatibility */ - "killnode", KILLNODE, 2, - "merge", MERGE, 3, - "node", NODE, 7, - "parameters", PARAMETERS, 3, - "port", PORT, 8, - "primitive", PRIMITIVE, 0, /* defines a primitive device */ - "resist", RESISTOR, 4, - "resistclasses", RESISTCLASS, 1, - "rnode", RNODE, 5, - "scale", SCALE, 4, - "subcap", SUBCAP, 3, - "substrate", SUBSTRATE, 3, - "tech", TECH, 2, - "timestamp", TIMESTAMP, 2, - "use", USE, 9, - "version", VERSION, 2, - "style", EXT_STYLE, 2, - 0 + {"abstract", ABSTRACT, 0}, /* defines a LEF-like view */ + {"adjust", ADJUST, 4}, + {"attr", ATTR, 8}, + {"cap", CAP, 4}, + {"device", DEVICE, 11}, /* effectively replaces "fet" */ + {"distance", DIST, 4}, + {"equiv", EQUIV, 3}, + {"fet", FET, 12}, /* for backwards compatibility */ + {"killnode", KILLNODE, 2}, + {"merge", MERGE, 3}, + {"node", NODE, 7}, + {"parameters", PARAMETERS, 3}, + {"port", PORT, 8}, + {"primitive", PRIMITIVE, 0}, /* defines a primitive device */ + {"resist", RESISTOR, 4}, + {"resistclasses", RESISTCLASS, 1}, + {"rnode", RNODE, 5}, + {"scale", SCALE, 4}, + {"subcap", SUBCAP, 3}, + {"substrate", SUBSTRATE, 3}, + {"tech", TECH, 2}, + {"timestamp", TIMESTAMP, 2}, + {"use", USE, 9}, + {"version", VERSION, 2}, + {"style", EXT_STYLE, 2}, + {0} }; /* Data shared with EFerror.c */ diff --git a/extract/ExtMain.c b/extract/ExtMain.c index 464cfab7..ab9b38c0 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -137,23 +137,23 @@ ExtInit() char *di_name; int *di_id; } debugFlags[] = { - "areaenum", &extDebAreaEnum, - "array", &extDebArray, - "hardway", &extDebHardWay, - "hiercap", &extDebHierCap, - "hierareacap", &extDebHierAreaCap, - "label", &extDebLabel, - "length", &extDebLength, - "neighbor", &extDebNeighbor, - "noarray", &extDebNoArray, - "nofeedback", &extDebNoFeedback, - "nohard", &extDebNoHard, - "nosubcell", &extDebNoSubcell, - "perimeter", &extDebPerim, - "resist", &extDebResist, - "visonly", &extDebVisOnly, - "yank", &extDebYank, - 0 + {"areaenum", &extDebAreaEnum}, + {"array", &extDebArray}, + {"hardway", &extDebHardWay}, + {"hiercap", &extDebHierCap}, + {"hierareacap", &extDebHierAreaCap}, + {"label", &extDebLabel}, + {"length", &extDebLength}, + {"neighbor", &extDebNeighbor}, + {"noarray", &extDebNoArray}, + {"nofeedback", &extDebNoFeedback}, + {"nohard", &extDebNoHard}, + {"nosubcell", &extDebNoSubcell}, + {"perimeter", &extDebPerim}, + {"resist", &extDebResist}, + {"visonly", &extDebVisOnly}, + {"yank", &extDebYank}, + {0} }; /* Register ourselves with the debugging module */ diff --git a/extract/ExtTech.c b/extract/ExtTech.c index d936dd0c..36adeaa2 100644 --- a/extract/ExtTech.c +++ b/extract/ExtTech.c @@ -96,99 +96,99 @@ typedef struct } keydesc; static keydesc keyTable[] = { - "areacap", AREAC, 3, 3, -"types capacitance", + {"areacap", AREAC, 3, 3, +"types capacitance"}, - "contact", CONTACT, 3, 6, -"type resistance", + {"contact", CONTACT, 3, 6, +"type resistance"}, - "cscale", CSCALE, 2, 2, -"capacitance-scalefactor", + {"cscale", CSCALE, 2, 2, +"capacitance-scalefactor"}, - "defaultareacap", DEFAULTAREACAP, 4, 6, -"types plane capacitance", + {"defaultareacap", DEFAULTAREACAP, 4, 6, +"types plane capacitance"}, - "defaultoverlap", DEFAULTOVERLAP, 6, 6, -"types plane otertypes otherplane capacitance", + {"defaultoverlap", DEFAULTOVERLAP, 6, 6, +"types plane otertypes otherplane capacitance"}, - "defaultperimeter", DEFAULTPERIMETER, 4, 6, -"types plane capacitance", + {"defaultperimeter", DEFAULTPERIMETER, 4, 6, +"types plane capacitance"}, - "defaultsideoverlap", DEFAULTSIDEOVERLAP, 6, 6, -"types plane othertypes otherplane capacitance", + {"defaultsideoverlap", DEFAULTSIDEOVERLAP, 6, 6, +"types plane othertypes otherplane capacitance"}, - "defaultsidewall", DEFAULTSIDEWALL, 4, 5, -"types plane capacitance [offset]", + {"defaultsidewall", DEFAULTSIDEWALL, 4, 5, +"types plane capacitance [offset]"}, - "device", DEVICE, 4, 10, -"device dev-type types options...", + {"device", DEVICE, 4, 10, +"device dev-type types options..."}, - "fet", FET, 8, 9, -"types terminal-types min-#-terminals name [subs-types] subs-node gscap gate-chan-cap", + {"fet", FET, 8, 9, +"types terminal-types min-#-terminals name [subs-types] subs-node gscap gate-chan-cap"}, - "fetresist", FETRESIST, 4, 4, -"type region ohms-per-square", + {"fetresist", FETRESIST, 4, 4, +"type region ohms-per-square"}, - "fringeshieldhalo", FRINGESHIELDHALO, 2, 2, -"distance", + {"fringeshieldhalo", FRINGESHIELDHALO, 2, 2, +"distance"}, - "height", HEIGHT, 4, 4, -"type height-above-subtrate thickness", + {"height", HEIGHT, 4, 4, +"type height-above-subtrate thickness"}, - "antenna", ANTENNA, 4, 6, -"type [calc-type] [antenna-ratio-proportional] antenna-ratio-const", + {"antenna", ANTENNA, 4, 6, +"type [calc-type] [antenna-ratio-proportional] antenna-ratio-const"}, - "model", MODEL, 2, 3, -"partial-cumulative [area-sidewall]", + {"model", MODEL, 2, 3, +"partial-cumulative [area-sidewall]"}, - "tiedown", TIEDOWN, 2, 2, -"types", + {"tiedown", TIEDOWN, 2, 2, +"types"}, - "lambda", LAMBDA, 2, 2, -"units-per-lambda", + {"lambda", LAMBDA, 2, 2, +"units-per-lambda"}, - "overlap", OVERC, 4, 5, -"toptypes bottomtypes capacitance [shieldtypes]", + {"overlap", OVERC, 4, 5, +"toptypes bottomtypes capacitance [shieldtypes]"}, - "perimc", PERIMC, 4, 4, -"intypes outtypes capacitance", + {"perimc", PERIMC, 4, 4, +"intypes outtypes capacitance"}, - "planeorder", PLANEORDER, 3, 3, -"plane index", - "noplaneordering", NOPLANEORDER, 1, 1, -"(no arguments needed)", + {"planeorder", PLANEORDER, 3, 3, +"plane index"}, + {"noplaneordering", NOPLANEORDER, 1, 1, +"(no arguments needed)"}, - "resist", RESIST, 3, 4, -"types resistance", + {"resist", RESIST, 3, 4, +"types resistance"}, - "rscale", RSCALE, 2, 2, -"resistance-scalefactor", + {"rscale", RSCALE, 2, 2, +"resistance-scalefactor"}, - "sidehalo", SIDEHALO, 2, 2, -"distance", + {"sidehalo", SIDEHALO, 2, 2, +"distance"}, - "sideoverlap", SIDEOVERLAP, 5, 6, -"intypes outtypes ovtypes capacitance [shieldtypes]", + {"sideoverlap", SIDEOVERLAP, 5, 6, +"intypes outtypes ovtypes capacitance [shieldtypes]"}, - "sidewall", SIDEWALL, 6, 7, -"intypes outtypes neartypes fartypes capacitance [offset]", + {"sidewall", SIDEWALL, 6, 7, +"intypes outtypes neartypes fartypes capacitance [offset]"}, - "step", STEP, 2, 2, -"size", + {"step", STEP, 2, 2, +"size"}, - "style", STYLE, 2, 4, -"stylename", + {"style", STYLE, 2, 4, +"stylename"}, - "substrate", SUBSTRATE, 3, 5, -"types plane [subs-node]", + {"substrate", SUBSTRATE, 3, 5, +"types plane [subs-node]"}, - "units", UNITS, 2, 2, -"lambda|microns", + {"units", UNITS, 2, 2, +"lambda|microns"}, - "variants", VARIANT, 2, 2, -"style,...", + {"variants", VARIANT, 2, 2, +"style,..."}, - 0 + {0} }; @@ -202,43 +202,43 @@ static keydesc keyTable[] = { /* types are enumerated in extract.h */ static keydesc devTable[] = { - "mosfet", DEV_MOSFET, 5, 10, -"name gate-types src-types [drn-types] sub-types|None sub-node [gscap gccap]", + {"mosfet", DEV_MOSFET, 5, 10, +"name gate-types src-types [drn-types] sub-types|None sub-node [gscap gccap]"}, - "bjt", DEV_BJT, 5, 5, -"name base-types emitter-types collector-types", + {"bjt", DEV_BJT, 5, 5, +"name base-types emitter-types collector-types"}, - "capacitor", DEV_CAP, 4, 8, -"name top-types bottom-types [sub-types|None sub-node] [[perimcap] areacap]", + {"capacitor", DEV_CAP, 4, 8, +"name top-types bottom-types [sub-types|None sub-node] [[perimcap] areacap]"}, - "capreverse", DEV_CAPREV, 4, 8, -"name bottom-types top-types [sub-types|None sub-node] [[perimcap] areacap]", + {"capreverse", DEV_CAPREV, 4, 8, +"name bottom-types top-types [sub-types|None sub-node] [[perimcap] areacap]"}, - "resistor", DEV_RES, 4, 6, -"name|None res-types terminal-types [sub-types|None sub-node]", + {"resistor", DEV_RES, 4, 6, +"name|None res-types terminal-types [sub-types|None sub-node]"}, - "diode", DEV_DIODE, 4, 6, -"name pos-types neg-types [sub-types|None sub-node]", + {"diode", DEV_DIODE, 4, 6, +"name pos-types neg-types [sub-types|None sub-node]"}, - "pdiode", DEV_PDIODE, 4, 6, -"name pos-types neg-types [sub-types|None sub-node]", + {"pdiode", DEV_PDIODE, 4, 6, +"name pos-types neg-types [sub-types|None sub-node]"}, - "ndiode", DEV_NDIODE, 4, 6, -"name neg-types pos-types [sub-types|None sub-node]", + {"ndiode", DEV_NDIODE, 4, 6, +"name neg-types pos-types [sub-types|None sub-node]"}, - "subcircuit", DEV_SUBCKT, 3, 11, -"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]", + {"subcircuit", DEV_SUBCKT, 3, 11, +"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]"}, - "rsubcircuit", DEV_RSUBCKT, 4, 7, -"name dev-types terminal-types [sub-types|None sub-node] [options]", + {"rsubcircuit", DEV_RSUBCKT, 4, 7, +"name dev-types terminal-types [sub-types|None sub-node] [options]"}, - "msubcircuit", DEV_MSUBCKT, 3, 11, -"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]", + {"msubcircuit", DEV_MSUBCKT, 3, 11, +"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]"}, - "csubcircuit", DEV_CSUBCKT, 4, 7, -"name dev-types terminal-types [sub-types|None sub-node] [options]", + {"csubcircuit", DEV_CSUBCKT, 4, 7, +"name dev-types terminal-types [sub-types|None sub-node] [options]"}, - 0 + {0} }; #ifdef MAGIC_WRAPPER diff --git a/extract/ExtTest.c b/extract/ExtTest.c index 571b3a6c..7217707e 100644 --- a/extract/ExtTest.c +++ b/extract/ExtTest.c @@ -128,22 +128,22 @@ ExtractTest(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "clrdebug", CLRDEBUG, - "clrlength", CLRLENGTH, - "driver", DRIVER, - "dump", DUMP, - "interactions", INTERACTIONS, - "intercount", INTERCOUNT, - "parents", EXTPARENTS, - "receiver", RECEIVER, - "setdebug", SETDEBUG, - "showdebug", SHOWDEBUG, - "showparents", SHOWPARENTS, - "showtech", SHOWTECH, - "stats", STATS, - "step", STEP, - "times", TIME, - 0 + {"clrdebug", CLRDEBUG}, + {"clrlength", CLRLENGTH}, + {"driver", DRIVER}, + {"dump", DUMP}, + {"interactions", INTERACTIONS}, + {"intercount", INTERCOUNT}, + {"parents", EXTPARENTS}, + {"receiver", RECEIVER}, + {"setdebug", SETDEBUG}, + {"showdebug", SHOWDEBUG}, + {"showparents", SHOWPARENTS}, + {"showtech", SHOWTECH}, + {"stats", STATS}, + {"step", STEP}, + {"times", TIME}, + {0} }; if (cmd->tx_argc == 1) diff --git a/garouter/gaTest.c b/garouter/gaTest.c index b05cf780..adc32ccf 100644 --- a/garouter/gaTest.c +++ b/garouter/gaTest.c @@ -98,10 +98,10 @@ GATest(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "clrdebug", CLRDEBUG, - "setdebug", SETDEBUG, - "showdebug", SHOWDEBUG, - 0 + {"clrdebug", CLRDEBUG}, + {"setdebug", SETDEBUG}, + {"showdebug", SHOWDEBUG}, + {0} }; GAInit(); @@ -388,17 +388,17 @@ GAInit() char *di_name; int *di_id; } dflags[] = { - "chanonly", &gaDebChanOnly, - "chanstats", &gaDebChanStats, - "maze", &gaDebMaze, - "nosimple", &gaDebNoSimple, - "paintstems", &gaDebPaintStems, - "showchans", &gaDebShowChans, - "showmaze", &gaDebShowMaze, - "stems", &gaDebStems, - "verbose", &gaDebVerbose, - "noclean", &gaDebNoClean, - 0 + {"chanonly", &gaDebChanOnly}, + {"chanstats", &gaDebChanStats}, + {"maze", &gaDebMaze}, + {"nosimple", &gaDebNoSimple}, + {"paintstems", &gaDebPaintStems}, + {"showchans", &gaDebShowChans}, + {"showmaze", &gaDebShowMaze}, + {"stems", &gaDebStems}, + {"verbose", &gaDebVerbose}, + {"noclean", &gaDebNoClean}, + {0} }; if (gaInitialized) diff --git a/graphics/grClip.c b/graphics/grClip.c index d90b5500..24afe3de 100644 --- a/graphics/grClip.c +++ b/graphics/grClip.c @@ -46,7 +46,7 @@ extern void GrClipTriangle(); * lintpick happy! */ -global Rect GrCrossRect = {-GR_CROSSSIZE, -GR_CROSSSIZE, GR_CROSSSIZE, GR_CROSSSIZE}; +global Rect GrCrossRect = {{-GR_CROSSSIZE, -GR_CROSSSIZE}, {GR_CROSSSIZE, GR_CROSSSIZE}}; global int GrNumClipBoxes = 0; /* for benchmarking */ global int grCurDStyle; global unsigned char GrGridMultiple = 1; diff --git a/graphics/grMain.c b/graphics/grMain.c index 09cc87bb..9d565e3e 100644 --- a/graphics/grMain.c +++ b/graphics/grMain.c @@ -80,7 +80,7 @@ global int GrPixelCorrect = 1; /* The following rectangle is describes the display area and is available * to the user of this module. */ -global Rect GrScreenRect = {0, 0, 0, 0}; +global Rect GrScreenRect = {{0, 0}, {0, 0}}; /* * Interrupt status for the timer. In TCL, this is used for graphics diff --git a/grouter/grouteTest.c b/grouter/grouteTest.c index 1aed3070..77a17cf2 100644 --- a/grouter/grouteTest.c +++ b/grouter/grouteTest.c @@ -124,12 +124,12 @@ GlTest(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "clrdebug", CLRDEBUG, - "onlynet", ONLYNET, - "setdebug", SETDEBUG, - "showdebug", SHOWDEBUG, - "sides", SIDES, - 0 + {"clrdebug", CLRDEBUG}, + {"onlynet", ONLYNET}, + {"setdebug", SETDEBUG}, + {"showdebug", SHOWDEBUG}, + {"sides", SIDES}, + {0} }; if (!glInitialized) @@ -262,24 +262,24 @@ GlInit() char *di_name; int *di_id; } dflags[] = { - "allpoints", &glDebAllPoints, - "chan", &glDebChan, - "cross", &glDebCross, - "fast", &glDebFast, - "heap", &glDebHeap, - "histo", &glDebHisto, - "log", &glDebLog, - "greedy", &glDebGreedy, - "maze", &glDebMaze, - "net", &glDebNet, - "newheaps", &glDebNewHeaps, - "penalties", &glDebPen, - "showpins", &glDebShowPins, - "stemsonly", &glDebStemsOnly, - "straight", &glDebStraight, - "tiles", &glDebTiles, - "verbose", &glDebVerbose, - 0 + {"allpoints", &glDebAllPoints}, + {"chan", &glDebChan}, + {"cross", &glDebCross}, + {"fast", &glDebFast}, + {"heap", &glDebHeap}, + {"histo", &glDebHisto}, + {"log", &glDebLog}, + {"greedy", &glDebGreedy}, + {"maze", &glDebMaze}, + {"net", &glDebNet}, + {"newheaps", &glDebNewHeaps}, + {"penalties", &glDebPen}, + {"showpins", &glDebShowPins}, + {"stemsonly", &glDebStemsOnly}, + {"straight", &glDebStraight}, + {"tiles", &glDebTiles}, + {"verbose", &glDebVerbose}, + {0} }; if (glInitialized) diff --git a/irouter/irCommand.c b/irouter/irCommand.c index f48c2c10..83ca2244 100644 --- a/irouter/irCommand.c +++ b/irouter/irCommand.c @@ -110,8 +110,8 @@ irSetNoisyAutoInt(parm, valueS, file) char *sv_name; /* name */ int sv_type; } specialValues[] = { - "automatic", V_AUTOMATIC, - 0 + {"automatic", V_AUTOMATIC}, + {0} }; /* If value non-null set parm */ @@ -679,9 +679,9 @@ FILE *file; char *sp_name; /* name */ int sp_type; } specialArgs[] = { - "command", SP_COMMAND, - ".", SP_DOT, - 0 + {"command", SP_COMMAND}, + {".", SP_DOT}, + {0} }; if(s!=NULL) @@ -785,11 +785,11 @@ static struct void (*cP_proc)(); /* Procedure processing this parameter */ #endif } cParms[] = { - "active", irCSetActive, - "width", irCSetWidth, - "length", irCSetLength, - "cost", irCSetCost, - 0 + {"active", irCSetActive}, + {"width", irCSetWidth}, + {"length", irCSetLength}, + {"cost", irCSetCost}, + {0} }; /* NEXTVALUE - returns pointer to next value arg (string). */ @@ -1154,15 +1154,15 @@ static struct void (*lP_proc)(); /* procedure processing this parameter */ #endif } lParms[] = { - "active", irLSetActive, - "width", irLSetWidth, - "length", irLSetLength, - "hCost", irLSetHCost, - "vCost", irLSetVCost, - "jogCost", irLSetJogCost, - "hintCost", irLSetHintCost, - "overCost", irLSetOverCost, - 0 + {"active", irLSetActive}, + {"width", irLSetWidth}, + {"length", irLSetLength}, + {"hCost", irLSetHCost}, + {"vCost", irLSetVCost}, + {"jogCost", irLSetJogCost}, + {"hintCost", irLSetHintCost}, + {"overCost", irLSetOverCost}, + {0} }; /* NEXTVALUE - returns pointer to next value arg (string). */ @@ -1747,9 +1747,9 @@ static struct char *srP_name; /* name of parameter */ void (*srP_proc)(); /* Procedure processing this parameter */ } srParms[] = { - "rate", irSrSetRate, - "width", irSrSetWidth, - 0 + {"rate", irSrSetRate}, + {"width", irSrSetWidth}, + {0} }; void @@ -1868,11 +1868,11 @@ irSpacingsCmd(w, cmd) char *sV_name; /* name of value */ int sV_value; /* corresponding interger value */ } sValue[] = { - "n", -1, - "nil", -1, - "none", -1, - "null", -1, - 0 + {"n", -1}, + {"nil", -1}, + {"none", -1}, + {"null", -1}, + {0} }; /* Subcell Table */ @@ -1881,8 +1881,8 @@ irSpacingsCmd(w, cmd) char *sT_name; /* name of value */ int sT_value; /* corresponding interger value */ } subcellTable[] = { - "subcell", TT_SUBCELL, - 0 + {"subcell", TT_SUBCELL}, + {0} }; /* Process by case */ @@ -2238,15 +2238,15 @@ static struct char *wzdP_name; /* name of parameter */ void (*wzdP_proc)(); /* Procedure processing this parameter */ } wzdParms[] = { - "bloom", irWzdSetBloomCost, - "bloomLimit", irWzdSetBloomLimit, - "boundsIncrement", irWzdSetBoundsIncrement, - "estimate", irWzdSetEstimate, - "expandEndpoints", irWzdSetExpandEndpoints, - "penalty", irWzdSetPenalty, - "penetration", irWzdSetPenetration, - "window", irWzdSetWindow, - 0 + {"bloom", irWzdSetBloomCost}, + {"bloomLimit", irWzdSetBloomLimit}, + {"boundsIncrement", irWzdSetBoundsIncrement}, + {"estimate", irWzdSetEstimate}, + {"expandEndpoints", irWzdSetExpandEndpoints}, + {"penalty", irWzdSetPenalty}, + {"penetration", irWzdSetPenetration}, + {"window", irWzdSetWindow}, + {0} }; void @@ -2510,21 +2510,21 @@ irSaveParametersCmd(w, cmd) /*--- Subcommand Table ---*/ SubCmdTableE irSubcommands[] = { - "contacts", irContactsCmd, + {"contacts", irContactsCmd, "set route-contact parameters", "contacts [type] [parameter] [value1] ... [valuen]\n\ -\t(can use '*' for type or parameter)", +\t(can use '*' for type or parameter)"}, - "help", irHelpCmd, + {"help", irHelpCmd, "summarize iroute subcommands", - "help [subcommand]", + "help [subcommand]"}, - "layers", irLayersCmd, + {"layers", irLayersCmd, "set route-layer parameters", "layers [type] [parameter] [value1] ... [valuen]\n\ -\t(can use '*' for type or parameter)", +\t(can use '*' for type or parameter)"}, - "route", irRouteCmd, + {"route", irRouteCmd, "connect point to node(s)", "route [options]\n\ \t-sLayers layers = layers route may start on.\n\ @@ -2535,38 +2535,38 @@ SubCmdTableE irSubcommands[] = { \t-dBox = route to box (DEFAULT)\n\ \t-dLabel name = route to label of given name\n\ \t-dRect xbot ybot xtop ytop = route to rectangle of given coordinates\n\ -\t-dSelection = route to selection", +\t-dSelection = route to selection"}, - "saveParameters", irSaveParametersCmd, + {"saveParameters", irSaveParametersCmd, "write out all irouter parameters\n\ \t(can be read back with :source)", - "saveParameters ", + "saveParameters "}, - "search", irSearchCmd, + {"search", irSearchCmd, "set parameters controlling the internal search for routes", - "search [searchParameter] [value]", + "search [searchParameter] [value]"}, - "spacings", irSpacingsCmd, + {"spacings", irSpacingsCmd, "set minimum spacing between route-type and arbitrary type", "spacings [route-type] [type] [spacing] ... [typen spacingn]\n\ \t(types can be 'SUBCELL', spacing can be 'nil')\n\ iroute spacings CLEAR\n\ -\t(sets all spacings to nil)", +\t(sets all spacings to nil)"}, - "verbosity", irVerbosityCmd, + {"verbosity", irVerbosityCmd, "control the amount of messages printed", "verbosity [level]\n\ -\t(0 = errors and warnings only, 1 = brief, 2 = lots of statistics)", +\t(0 = errors and warnings only, 1 = brief, 2 = lots of statistics)"}, - "version", irVersionCmd, + {"version", irVersionCmd, "identify irouter version", - "version", + "version"}, - "wizard", irWizardCmd, + {"wizard", irWizardCmd, "set miscellaneous parameters", - "wizard [wizardParameter] [value]", + "wizard [wizardParameter] [value]"}, - 0 + {0} }, *subCmdP; void diff --git a/irouter/irMain.c b/irouter/irMain.c index 8ccf636d..42e82ace 100644 --- a/irouter/irMain.c +++ b/irouter/irMain.c @@ -99,9 +99,9 @@ IRDebugInit() char *di_name; int *di_id; } dflags[] = { - "endpts", &irDebEndPts, - "noclean", &irDebNoClean, - 0 + {"endpts", &irDebEndPts}, + {"noclean", &irDebNoClean}, + {0} }; /* Register with debug module */ diff --git a/irouter/irTestCmd.c b/irouter/irTestCmd.c index 8919105c..59fa973f 100644 --- a/irouter/irTestCmd.c +++ b/irouter/irTestCmd.c @@ -220,20 +220,20 @@ irParmsTstCmd(w, cmd) /*--------------------------- Command Table ------------------------------ */ TestCmdTableE irTestCommands[] = { - "debug", irDebugTstCmd, + {"debug", irDebugTstCmd, "set or clear debug flags", - "debug [flag] [value]", + "debug [flag] [value]"}, - "help", irHelpTstCmd, + {"help", irHelpTstCmd, "summarize *iroute subcommands", - "help [subcommand]", + "help [subcommand]"}, - "parms", irParmsTstCmd, + {"parms", irParmsTstCmd, "print internal data structures", - "parms", + "parms"}, - 0 - }, *irTestCmdP; + {0} +}, *irTestCmdP; /* diff --git a/mzrouter/mzInit.c b/mzrouter/mzInit.c index 7dce9c84..2cbaec5d 100644 --- a/mzrouter/mzInit.c +++ b/mzrouter/mzInit.c @@ -111,9 +111,9 @@ MZInit() char *di_name; int *di_id; } dflags[] = { - "steppath", &mzDebStep, - "maze", &mzDebMaze, - 0 + {"steppath", &mzDebStep}, + {"maze", &mzDebMaze}, + {0} }; /* Register with debug module */ diff --git a/mzrouter/mzTech.c b/mzrouter/mzTech.c index dc7a595c..d65d5651 100644 --- a/mzrouter/mzTech.c +++ b/mzrouter/mzTech.c @@ -817,8 +817,8 @@ mzTechSpacing(argc, argv) char *sT_name; /* name of value */ int sT_value; /* corresponding interger value */ } subcellTable[] = { - "subcell", TT_SUBCELL, - 0 + {"subcell", TT_SUBCELL}, + {0} }; /* check number of arguments */ diff --git a/mzrouter/mzTestCmd.c b/mzrouter/mzTestCmd.c index d6c4b5a1..526d291b 100644 --- a/mzrouter/mzTestCmd.c +++ b/mzrouter/mzTestCmd.c @@ -537,40 +537,40 @@ mzVersionCmd(w, cmd) /*--------------------------- Command Table ------------------------------ */ TestCmdTableE mzTestCommands[] = { - "debug", mzDebugTstCmd, + {"debug", mzDebugTstCmd, "set or clear debug flags", - "debug [flag] [value]", + "debug [flag] [value]"}, - "dumpEstimates", mzDumpEstimatesTstCmd, + {"dumpEstimates", mzDumpEstimatesTstCmd, "print global estimate info for tiles under box", - "dumpEstimates", + "dumpEstimates"}, - "dumpTags", mzDumpTagsTstCmd, + {"dumpTags", mzDumpTagsTstCmd, "print tag info on data tiles under box", - "dumpTags", + "dumpTags"}, - "help", mzHelpTstCmd, + {"help", mzHelpTstCmd, "summarize *mzroute subcommands", - "help [subcommand]", + "help [subcommand]"}, - "numberLine", mzNumberLineTstCmd, + {"numberLine", mzNumberLineTstCmd, "exercise numberline code", - "numberLine", + "numberLine"}, - "parms", mzParmsTstCmd, + {"parms", mzParmsTstCmd, "print internal data structures", - "parms", + "parms"}, - "plane", mzPlaneTstCmd, + {"plane", mzPlaneTstCmd, "make internal tile plane visible", - "plane [plane]", + "plane [plane]"}, - "version", mzVersionCmd, + {"version", mzVersionCmd, "identify mzrouter version", - "version", + "version"}, - 0 - }, *mzTestCmdP; + {0} +}, *mzTestCmdP; void MZTest(w, cmd) diff --git a/netmenu/NMmain.c b/netmenu/NMmain.c index 6c23b816..9694a16e 100644 --- a/netmenu/NMmain.c +++ b/netmenu/NMmain.c @@ -59,46 +59,46 @@ extern void nmNotDefined(); NetButton NMButtons[] = { - NULL, STYLE_ORANGE1, 0, 200, 80, 210, - NMGetLabels, NULL, NMNextLabel, NULL, NMNextLabel, NULL, - NULL, STYLE_ERASEALL, 0, 174, 24, 198, - NMPutLabel, NULL, NMReOrientLabel, NULL, NMReOrientLabel, NULL, - NULL, STYLE_ORANGE1, 42, 188, 59, 198, - NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL, - NULL, STYLE_ORANGE1, 63, 188, 80, 198, - NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL, - "Find", STYLE_ORANGE2, 42, 174, 80, 184, - NMFindLabel, NULL, NMFindLabel, NULL, NMFindLabel, NULL, - NULL, STYLE_GREEN1, 0, 150, 80, 160, - NMButtonNetList, NULL, NMButtonNetList, NULL, NMButtonNetList, NULL, - "Verify", STYLE_BLUE1, 0, 138, 38, 148, - NMCmdVerify, NULL, NMCmdVerify, NULL, NMCmdVerify, NULL, - "Print", STYLE_BLUE2, 42, 138, 80, 148, - NMCmdPrint, NULL, NMCmdPrint, NULL, NMCmdPrint, NULL, - "Terms", STYLE_RED1, 0, 126, 38, 136, - NMCmdShowterms, NULL, NMCmdShowterms, NULL, NMCmdShowterms, NULL, - "Cleanup", STYLE_RED2, 42, 126, 80, 136, - NMCmdCleanup, NULL, NMCmdCleanup, NULL, NMCmdCleanup, NULL, - "No Net",STYLE_GRAY1, 0, 114, 38, 124, - NMCmdDnet, NULL, NMCmdDnet, NULL, NMCmdDnet, NULL, - "Show",STYLE_YELLOW1, 42, 114, 80, 124, - NMShowUnderBox, NULL, NMShowUnderBox, NULL, NMShowUnderBox, NULL, - NULL, -1 /* -1 Signals end of list. */ + {NULL, STYLE_ORANGE1, {{0, 200}, {80, 210}}, + NMGetLabels, NULL, NMNextLabel, NULL, NMNextLabel, NULL}, + {NULL, STYLE_ERASEALL, {{0, 174}, {24, 198}}, + NMPutLabel, NULL, NMReOrientLabel, NULL, NMReOrientLabel, NULL}, + {NULL, STYLE_ORANGE1, {{42, 188}, {59, 198}}, + NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL}, + {NULL, STYLE_ORANGE1, {{63, 188}, {80, 198}}, + NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL}, + {"Find", STYLE_ORANGE2, {{42, 174}, {80, 184}}, + NMFindLabel, NULL, NMFindLabel, NULL, NMFindLabel, NULL}, + {NULL, STYLE_GREEN1, {{0, 150}, {80, 160}}, + NMButtonNetList, NULL, NMButtonNetList, NULL, NMButtonNetList, NULL}, + {"Verify", STYLE_BLUE1, {{0, 138}, {38, 148}}, + NMCmdVerify, NULL, NMCmdVerify, NULL, NMCmdVerify, NULL}, + {"Print", STYLE_BLUE2, {{42, 138}, {80, 148}}, + NMCmdPrint, NULL, NMCmdPrint, NULL, NMCmdPrint, NULL}, + {"Terms", STYLE_RED1, {{0, 126}, {38, 136}}, + NMCmdShowterms, NULL, NMCmdShowterms, NULL, NMCmdShowterms, NULL}, + {"Cleanup", STYLE_RED2, {{42, 126}, {80, 136}}, + NMCmdCleanup, NULL, NMCmdCleanup, NULL, NMCmdCleanup, NULL}, + {"No Net",STYLE_GRAY1, {{0, 114}, {38, 124}}, + NMCmdDnet, NULL, NMCmdDnet, NULL, NMCmdDnet, NULL}, + {"Show",STYLE_YELLOW1, {{42, 114}, {80, 124}}, + NMShowUnderBox, NULL, NMShowUnderBox, NULL, NMShowUnderBox, NULL}, + {NULL, -1 /* -1 Signals end of list. */ } }; NetLabel nmLabels[] = { - "Label", STYLE_WHITE, 0, 212, 80, 222, - "Netlist", STYLE_WHITE, 0, 162, 80, 172, - NULL, -1 /* -1 signals end of list. */ + {"Label", STYLE_WHITE, {{0, 212}, {80, 222}}}, + {"Netlist", STYLE_WHITE, {{0, 162}, {80, 172}}}, + {NULL, -1 /* -1 signals end of list. */ } }; NetRect nmRects[] = { - STYLE_BBOX, 8, 174, 16, 198, - STYLE_BBOX, 0, 182, 24, 190, - STYLE_BBOX, 12, 186, 12, 186, - -1 /* -1 signals end of list. */ + {STYLE_BBOX, {{8, 174}, {16, 198}}}, + {STYLE_BBOX, {{0, 182}, {24, 190}}}, + {STYLE_BBOX, {{12, 186}, {12, 186}}}, + {-1 /* -1 signals end of list. */ } }; @@ -106,8 +106,8 @@ NetRect nmRects[] = * netlist menu, and the initial screen location of netlist menus. */ -Rect nmSurfaceArea = {-4, 110, 84, 226}; -Rect nmScreenArea = {0, 0, 140, 190}; +Rect nmSurfaceArea = {{-4, 110}, {84, 226}}; +Rect nmScreenArea = {{0, 0}, {140, 190}}; /* Only one netlist window is allowed to be open at once. This is it. */ diff --git a/plot/plotVers.c b/plot/plotVers.c index d9e55ad5..f5698e1d 100644 --- a/plot/plotVers.c +++ b/plot/plotVers.c @@ -408,15 +408,15 @@ PlotColorVersTechLine(sectionName, argc, argv) { VersatecStyle *new; static struct { char *l_str; int l_color; } colors[] = { - "black", BLACK, - "cyan", CYAN, - "magenta", MAGENTA, - "yellow", YELLOW, - "K", BLACK, - "C", CYAN, - "M", MAGENTA, - "Y", YELLOW, - 0 + {"black", BLACK}, + {"cyan", CYAN}, + {"magenta", MAGENTA}, + {"yellow", YELLOW}, + {"K", BLACK}, + {"C", CYAN}, + {"M", MAGENTA}, + {"Y", YELLOW}, + {0} }; int i; diff --git a/plow/PlowTech.c b/plow/PlowTech.c index c2292667..4ec3d936 100644 --- a/plow/PlowTech.c +++ b/plow/PlowTech.c @@ -182,11 +182,11 @@ PlowDRCLine(sectionName, argc, argv) int rk_maxargs; /* Max # arguments */ int (*rk_proc)(); /* Procedure implementing this keyword */ } ruleKeys[] = { - "edge", 8, 9, plowEdgeRule, - "edge4way", 8, 9, plowEdgeRule, - "spacing", 6, 6, plowSpacingRule, - "width", 4, 4, plowWidthRule, - 0 + {"edge", 8, 9, plowEdgeRule}, + {"edge4way", 8, 9, plowEdgeRule}, + {"spacing", 6, 6, plowSpacingRule}, + {"width", 4, 4, plowWidthRule}, + {0} }, *rp; /* diff --git a/plow/PlowTest.c b/plow/PlowTest.c index a291008d..fd36d466 100644 --- a/plow/PlowTest.c +++ b/plow/PlowTest.c @@ -105,28 +105,28 @@ struct pCmd p_cmd; char *p_help; } plowCmds[] = { - "clrdebug", PC_CLRD, "flags", - "help", PC_HELP, "", - "jogreduce", PC_JOG, "", - "lwidth", PC_LWIDTH, "layers", - "lshadow", PC_LSHADOW, "layers", - "mergedown", PC_MERGEDOWN, "", - "mergeup", PC_MERGEUP, "", - "move", PC_MOVE, "", - "outline", PC_OUTLINE, "direction layers", - "plow", PC_PLOW, "direction [layers]", - "print", PC_PRINT, "", - "random", PC_RANDOM, "", - "setdebug", PC_SETD, "flags", - "shadow", PC_SHADOW, "layers", - "showdebug", PC_SHOWD, "", - "split", PC_SPLIT, "", - "techshow", PC_TECHSHOW, "[file]", - "trail", PC_TRAIL, "[value]", - "whenbot", PC_WHENBOT, "[xbot ybot]", - "whentop", PC_WHENTOP, "[xtop ytop]", - "width", PC_WIDTH, "layers", - 0, + {"clrdebug", PC_CLRD, "flags"}, + {"help", PC_HELP, ""}, + {"jogreduce", PC_JOG, ""}, + {"lwidth", PC_LWIDTH, "layers"}, + {"lshadow", PC_LSHADOW, "layers"}, + {"mergedown", PC_MERGEDOWN, ""}, + {"mergeup", PC_MERGEUP, ""}, + {"move", PC_MOVE, ""}, + {"outline", PC_OUTLINE, "direction layers"}, + {"plow", PC_PLOW, "direction [layers]"}, + {"print", PC_PRINT, ""}, + {"random", PC_RANDOM, ""}, + {"setdebug", PC_SETD, "flags"}, + {"shadow", PC_SHADOW, "layers"}, + {"showdebug", PC_SHOWD, ""}, + {"split", PC_SPLIT, ""}, + {"techshow", PC_TECHSHOW, "[file]"}, + {"trail", PC_TRAIL, "[value]"}, + {"whenbot", PC_WHENBOT, "[xbot ybot]"}, + {"whentop", PC_WHENTOP, "[xtop ytop]"}, + {"width", PC_WIDTH, "layers"}, + {0}, }; void @@ -457,14 +457,14 @@ plowDebugInit() char *di_name; int *di_id; } debug[] = { - "addedge", &plowDebAdd, - "jogs", &plowDebJogs, - "moveedge", &plowDebMove, - "nextedge", &plowDebNext, - "time", &plowDebTime, - "width", &plowDebWidth, - "yankall", &plowDebYankAll, - 0 + {"addedge", &plowDebAdd}, + {"jogs", &plowDebJogs}, + {"moveedge", &plowDebMove}, + {"nextedge", &plowDebNext}, + {"time", &plowDebTime}, + {"width", &plowDebWidth}, + {"yankall", &plowDebYankAll}, + {0} }; /* Register ourselves with the debugging module */ diff --git a/router/rtrCmd.c b/router/rtrCmd.c index d33abea8..590245d9 100644 --- a/router/rtrCmd.c +++ b/router/rtrCmd.c @@ -272,18 +272,18 @@ CmdGaRoute(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "channel xl yl xh yh [type]\n\ -channel [type] define a channel", CHANNEL, - "generate type [file] generate channel definition commands", - GEN, - "help print this message", HELP, - "nowarn only warn if all locations of a terminal\n\ - are unreachable", NOWARN, - "route [netlist] route the current cell",ROUTE, - "reset clear all channel definitions", RESET, - "warn leave feedback for each location of a\n\ - terminal that is unreachable", WARN, - 0 + {"channel xl yl xh yh [type]\n\ +channel [type] define a channel", CHANNEL}, + {"generate type [file] generate channel definition commands", + GEN}, + {"help print this message", HELP}, + {"nowarn only warn if all locations of a terminal\n\ + are unreachable", NOWARN}, + {"route [netlist] route the current cell",ROUTE}, + {"reset clear all channel definitions", RESET}, + {"warn leave feedback for each location of a\n\ + terminal that is unreachable", WARN}, + {0} }; GAInit(); diff --git a/router/rtrStem.c b/router/rtrStem.c index e36950a3..120b6827 100644 --- a/router/rtrStem.c +++ b/router/rtrStem.c @@ -66,7 +66,7 @@ static struct dirs /* List of directions for stems */ { int dr_dir; /* Direction */ } - dirs[] = { GEO_NORTH, GEO_SOUTH, GEO_EAST, GEO_WEST, 0 }; + dirs[] = { {GEO_NORTH}, {GEO_SOUTH}, {GEO_EAST}, {GEO_WEST}, {0} }; #define MAKEBOX(p, r, width, offset) { \ (r)->r_xbot = (p)->p_x + (offset); \ diff --git a/select/selUndo.c b/select/selUndo.c index 813b5c84..9b6ade6e 100644 --- a/select/selUndo.c +++ b/select/selUndo.c @@ -193,7 +193,7 @@ SelRememberForUndo(before, def, area) { SelUndoEvent *sue; static SelUndoEvent *beforeEvent = NULL; - static Rect nullRect = {0, 0, -1, -1}; + static Rect nullRect = {{0, 0}, {-1, -1}}; sue = (SelUndoEvent *) UndoNewEvent(SelUndoClientID, sizeof(SelUndoEvent)); if (sue == NULL) return; diff --git a/tiles/tile.c b/tiles/tile.c index 9eaecec1..a1faa840 100644 --- a/tiles/tile.c +++ b/tiles/tile.c @@ -57,7 +57,7 @@ TiSetBody(tp, b) * this area. */ -global Rect TiPlaneRect = { MINFINITY+2, MINFINITY+2, INFINITY-2, INFINITY-2 }; +global Rect TiPlaneRect = { {MINFINITY+2, MINFINITY+2}, {INFINITY-2, INFINITY-2} }; #ifdef HAVE_SYS_MMAN_H diff --git a/utils/geometry.c b/utils/geometry.c index cfa985ab..8f17a433 100644 --- a/utils/geometry.c +++ b/utils/geometry.c @@ -74,8 +74,8 @@ global int GeoOppositePos[] = *------------------------------------------------------------------- */ -global Rect GeoNullRect = { 0, 0, 0, 0 }; -global Rect GeoInvertedRect = { 0, 0, -1, -1 }; +global Rect GeoNullRect = { {0, 0}, {0, 0} }; +global Rect GeoInvertedRect = { {0, 0}, {-1, -1} }; global Point GeoOrigin = { 0, 0 }; @@ -365,40 +365,40 @@ GeoNameToPos(name, manhattan, verbose) } positions[] = { - "bl", GEO_SOUTHWEST, FALSE, - "bottom", GEO_SOUTH, TRUE, - "br", GEO_SOUTHEAST, FALSE, - "center", GEO_CENTER, FALSE, - "d", GEO_SOUTH, TRUE, - "dl", GEO_SOUTHWEST, FALSE, - "down", GEO_SOUTH, TRUE, - "dr", GEO_SOUTHEAST, FALSE, - "e", GEO_EAST, TRUE, - "east", GEO_EAST, TRUE, - "left", GEO_WEST, TRUE, - "n", GEO_NORTH, TRUE, - "ne", GEO_NORTHEAST, FALSE, - "north", GEO_NORTH, TRUE, - "northeast", GEO_NORTHEAST, FALSE, - "northwest", GEO_NORTHWEST, FALSE, - "nw", GEO_NORTHWEST, FALSE, - "right", GEO_EAST, TRUE, - "s", GEO_SOUTH, TRUE, - "se", GEO_SOUTHEAST, FALSE, - "south", GEO_SOUTH, TRUE, - "southeast", GEO_SOUTHEAST, FALSE, - "southwest", GEO_SOUTHWEST, FALSE, - "sw", GEO_SOUTHWEST, FALSE, - "tl", GEO_NORTHWEST, FALSE, - "top", GEO_NORTH, TRUE, - "tr", GEO_NORTHEAST, FALSE, - "u", GEO_NORTH, TRUE, - "ul", GEO_NORTHWEST, FALSE, - "up", GEO_NORTH, TRUE, - "ur", GEO_NORTHEAST, FALSE, - "w", GEO_WEST, TRUE, - "west", GEO_WEST, TRUE, - 0 + {"bl", GEO_SOUTHWEST, FALSE}, + {"bottom", GEO_SOUTH, TRUE}, + {"br", GEO_SOUTHEAST, FALSE}, + {"center", GEO_CENTER, FALSE}, + {"d", GEO_SOUTH, TRUE}, + {"dl", GEO_SOUTHWEST, FALSE}, + {"down", GEO_SOUTH, TRUE}, + {"dr", GEO_SOUTHEAST, FALSE}, + {"e", GEO_EAST, TRUE}, + {"east", GEO_EAST, TRUE}, + {"left", GEO_WEST, TRUE}, + {"n", GEO_NORTH, TRUE}, + {"ne", GEO_NORTHEAST, FALSE}, + {"north", GEO_NORTH, TRUE}, + {"northeast", GEO_NORTHEAST, FALSE}, + {"northwest", GEO_NORTHWEST, FALSE}, + {"nw", GEO_NORTHWEST, FALSE}, + {"right", GEO_EAST, TRUE}, + {"s", GEO_SOUTH, TRUE}, + {"se", GEO_SOUTHEAST, FALSE}, + {"south", GEO_SOUTH, TRUE}, + {"southeast", GEO_SOUTHEAST, FALSE}, + {"southwest", GEO_SOUTHWEST, FALSE}, + {"sw", GEO_SOUTHWEST, FALSE}, + {"tl", GEO_NORTHWEST, FALSE}, + {"top", GEO_NORTH, TRUE}, + {"tr", GEO_NORTHEAST, FALSE}, + {"u", GEO_NORTH, TRUE}, + {"ul", GEO_NORTHWEST, FALSE}, + {"up", GEO_NORTH, TRUE}, + {"ur", GEO_NORTHEAST, FALSE}, + {"w", GEO_WEST, TRUE}, + {"west", GEO_WEST, TRUE}, + {0} }; struct pos *pp; char *fmt; diff --git a/utils/set.c b/utils/set.c index 22bbcad7..f82d8fd2 100644 --- a/utils/set.c +++ b/utils/set.c @@ -109,15 +109,15 @@ SetNoisyBool(parm,valueS,file) char *bS_name; /* name */ bool bS_value; /* procedure processing this parameter */ } boolStrings[] = { - "yes", TRUE, - "no", FALSE, - "true", TRUE, - "false", FALSE, - "1", TRUE, - "0", FALSE, - "on", TRUE, - "off", FALSE, - 0 + {"yes", TRUE}, + {"no", FALSE}, + {"true", TRUE}, + {"false", FALSE}, + {"1", TRUE}, + {"0", FALSE}, + {"on", TRUE}, + {"off", FALSE}, + {0} }; /* If value not null, set parm */ From 0cde30356343ae49bd847e6d3dc73670dcc2929e Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:04:43 +0100 Subject: [PATCH 156/206] ResReadSim.c: warning: this 'if' clause does not guard... break keyword indention corrected, braces added to better convey code intention of multiline statement. GCC14 -Wall cleanup series [-Wmisleading-indentation] --- resis/ResReadSim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resis/ResReadSim.c b/resis/ResReadSim.c index 1a6a0026..d3668896 100644 --- a/resis/ResReadSim.c +++ b/resis/ResReadSim.c @@ -178,9 +178,11 @@ ResReadSim(simfile, fetproc, capproc, resproc, attrproc, mergeproc, subproc) break; case 'A': if (attrproc) + { result = (*attrproc)(line[ATTRIBUTENODENAME], line[ATTRIBUTEVALUE], simfile, &extfile); - break; + } + break; case 'x': fettype = DBNumTypes; break; From e8f9b0af5e8805e1ae31d4f09f27c8905b6de3ea Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:07:15 +0100 Subject: [PATCH 157/206] CIFgen.c: warning: this 'for' clause does not guard... return keyword indention corrected braces added to previous statement to better convey code intention of multiline statement GCC14 -Wall cleanup series [-Wmisleading-indentation] --- cif/CIFgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cif/CIFgen.c b/cif/CIFgen.c index 8707f2d9..bc234dc5 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -4157,11 +4157,13 @@ bridgeErase(brlims, area) } for (t = 0; t < TT_MAXTYPES; t++, temps++) + { if (TTMaskHasType(&brlims->co_cifMask, t)) if (DBSrPaintArea((Tile *) NULL, *temps, area, &CIFSolidBits, cifPaintFunc, CIFEraseTable)) return 0; - - return 1; //Nothing found + } + + return 1; //Nothing found } /* From 88d36bfd1e54a8a34b8e38cadee76ed7b8267e2b Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:08:30 +0100 Subject: [PATCH 158/206] geofast.h: warning: this 'else' clause does not guard... Use of macro idiom: if(1) { ... } else which has dangling else keyword to allow trailing semicolon at use site, is not a good pattern. Replaced with idiom: do { ... } while(0) which should achieve the same purpose but now cause compile error when used incorrectly at use site. GCC14 -Wall cleanup series [-Wmisleading-indentation] --- utils/geofast.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/geofast.h b/utils/geofast.h index 1af24db1..af1f3664 100644 --- a/utils/geofast.h +++ b/utils/geofast.h @@ -32,12 +32,12 @@ */ #define GEOCLIP(r, area) \ - if (1) { \ + do { \ if ((r)->r_xbot < (area)->r_xbot) (r)->r_xbot = (area)->r_xbot; \ if ((r)->r_ybot < (area)->r_ybot) (r)->r_ybot = (area)->r_ybot; \ if ((r)->r_xtop > (area)->r_xtop) (r)->r_xtop = (area)->r_xtop; \ if ((r)->r_ytop > (area)->r_ytop) (r)->r_ytop = (area)->r_ytop; \ - } else + } while(0) /* --------------------- Transforming rectangles ---------------------- */ From bd75ddf32cb0e4c8d47997243aaf861d6025e3c2 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:08:37 +0100 Subject: [PATCH 159/206] mzMain.c: warning: this 'else' clause does not guard... Use of macro idiom: if(1) { ... } else which has dangling else keyword to allow trailing semicolon at use site, is not a good pattern. Replaced with idiom: do { ... } while(0) which should achieve the same purpose but now cause compile error when used incorrectly at use site. GCC14 -Wall cleanup series [-Wmisleading-indentation] --- mzrouter/mzMain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mzrouter/mzMain.c b/mzrouter/mzMain.c index c877e8ab..f2e4637b 100644 --- a/mzrouter/mzMain.c +++ b/mzrouter/mzMain.c @@ -233,22 +233,22 @@ bool mzPathsDirty = FALSE; /* macro for adding address pairs to translation table */ #define ADDR_TBL_EQUIV(a1,a2) \ -if(TRUE) \ +do \ { \ HashSetValue(HashFind(&aT, (char *) (a1)), (char *) (a2)); \ HashSetValue(HashFind(&aT, (char *) (a2)), (char *) (a1)); \ -} else +} while(0) /* macro for translating address to address paired with it in address table */ #define ADDR_TBL(type,a) \ -if (TRUE) \ +do \ { \ HashEntry *he = HashLookOnly(&aT, (char *) (a)); \ if(he) \ { \ a = (type) HashGetValue(he); \ } \ -} else +} while(0) /* From b654647fdc0824f9f38768d2e06b5addbde36ec7 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:10:13 +0100 Subject: [PATCH 160/206] PlowTest.c: warning: enumeration value 'PC_ERROR' not handled in switch False positive. Added no-op case statement, but code above looks the case should never execute due return from function. GCC14 -Wall cleanup series [-Wswitch] --- plow/PlowTest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plow/PlowTest.c b/plow/PlowTest.c index fd36d466..48e5a65a 100644 --- a/plow/PlowTest.c +++ b/plow/PlowTest.c @@ -162,6 +162,8 @@ PlowTest(w, cmd) for (n = 0; plowCmds[n].p_name; n++) TxPrintf("%-15s %s\n", plowCmds[n].p_name, plowCmds[n].p_help); break; + case PC_ERROR: /* exhaustive switch on enum compiler warning */ + break; case PC_RANDOM: PlowRandomTest(def); break; From 7dfdf5aa63ed7272f524a0453c09371077c193bd Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:10:48 +0100 Subject: [PATCH 161/206] CIFrdcl.c: warning: comparison between two arrays Added pointer casts to hint to compiler the programmer intention is to compare as pointers to the start of the array (and not be concerned the programmer is overlooking the contents of the array). GCC14 -Wall cleanup series [-Warray-compare] --- cif/CIFrdcl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cif/CIFrdcl.c b/cif/CIFrdcl.c index 44ad78fb..7d859077 100644 --- a/cif/CIFrdcl.c +++ b/cif/CIFrdcl.c @@ -389,7 +389,7 @@ CIFInputRescale(n, d) CIFScalePlanes(n, d, cifCurReadPlanes); if (cifCurReadPlanes != cifEditCellPlanes) CIFScalePlanes(n, d, cifEditCellPlanes); - if (cifEditCellPlanes != cifSubcellPlanes && cifCurReadPlanes != cifSubcellPlanes) + if ((const Plane*)cifEditCellPlanes != (const Plane*)cifSubcellPlanes && cifCurReadPlanes != cifSubcellPlanes) CIFScalePlanes(n, d, cifSubcellPlanes); CIFReadWarning("CIF style %s: units rescaled by factor of %d / %d\n", From 9225fa6cf16faf59ca9344d21a5d7439adee2755 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:13:24 +0100 Subject: [PATCH 162/206] 4 x warning: suggest explicit braces to avoid ambiguous 'else' Give compiler the extra braces it recommends. DBio.c edited as my original change was caught out by the incorrect indention of the 'else' keyword and my modification would have caused a NULL deref. Exactly the kind of issue this warning is trying to prevent. CmdTZ.c:417:20: warning: suggest explicit braces to avoid ambiguous 'else' DBio.c:1422:12: warning: suggest explicit braces to avoid ambiguous 'else' DBpaint2.c:285:12: warning: suggest explicit braces to avoid ambiguous 'else' DBpaint2.c:384:12: warning: suggest explicit braces to avoid ambiguous 'else' GCC14 -Wall cleanup series [-Wdangling-else] --- commands/CmdTZ.c | 2 ++ database/DBio.c | 5 +++-- database/DBpaint2.c | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index 56fa95b3..8f8681ef 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -415,10 +415,12 @@ CmdTech(w, cmd) for (ctype = TT_TECHDEPBASE; ctype < DBNumUserLayers; ctype++) if (DBIsContact(ctype)) + { if (TTMaskHasType(&DBActiveLayerBits, ctype)) DBUnlockContact(ctype); else DBLockContact(ctype); + } for (ctype = DBNumUserLayers; ctype < DBNumTypes; ctype++) { diff --git a/database/DBio.c b/database/DBio.c index be3f11f0..bf663bac 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -1420,9 +1420,10 @@ dbReadOpen(cellDef, setFileName, dereference, errptr) pptr = strrchr(sptr, '.'); if (pptr != NULL) + { if (strcmp(pptr, DBSuffix)) pptr = NULL; - else - *pptr = '\0'; + else *pptr = '\0'; + } /* If dereferencing, then use search paths first */ if (!dereference) diff --git a/database/DBpaint2.c b/database/DBpaint2.c index de3a1cbe..aa82305b 100644 --- a/database/DBpaint2.c +++ b/database/DBpaint2.c @@ -283,6 +283,7 @@ DBPaintValid(cellDef, rect, mask, dinfo) for (t = TT_SELECTBASE; t < DBNumUserLayers; t++) if (TTMaskHasType(&mmask, t)) + { if (DBIsContact(t)) { tMask = DBResidueMask(t); @@ -310,6 +311,7 @@ DBPaintValid(cellDef, rect, mask, dinfo) (t << 14) : t) : t); DBPaint(cellDef, rect, tloc); } + } } /* @@ -382,6 +384,7 @@ DBEraseValid(cellDef, rect, mask, dinfo) for (t = TT_SELECTBASE; t < DBNumUserLayers; t++) if (TTMaskHasType(&mmask, t)) + { if (DBIsContact(t)) { tMask = DBResidueMask(t); @@ -409,4 +412,5 @@ DBEraseValid(cellDef, rect, mask, dinfo) (t << 14) : t) : t); DBErase(cellDef, rect, tloc); } + } } From d94cd7253851badca9b9a1c3d1a60e5c969fd8f4 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:15:21 +0100 Subject: [PATCH 163/206] 37 x warning: array subscript has type 'char' Compiler is expressing range concern with the warning mitigated by using unsigned C array offsets. This also draws attention to the range concern when reading the code and making changes. DBundo.c:263:45: warning: array subscript has type 'char' DBundo.c:279:49: warning: array subscript has type 'char' DBundo.c:317:52: warning: array subscript has type 'char' DBundo.c:318:64: warning: array subscript has type 'char' DBundo.c:324:52: warning: array subscript has type 'char' DBundo.c:325:64: warning: array subscript has type 'char' DBundo.c:329:50: warning: array subscript has type 'char' DBundo.c:330:58: warning: array subscript has type 'char' DBundo.c:338:52: warning: array subscript has type 'char' DBundo.c:339:64: warning: array subscript has type 'char' DBundo.c:345:52: warning: array subscript has type 'char' DBundo.c:346:64: warning: array subscript has type 'char' DBundo.c:350:50: warning: array subscript has type 'char' DBundo.c:351:58: warning: array subscript has type 'char' DBundo.c:371:52: warning: array subscript has type 'char' DBundo.c:372:64: warning: array subscript has type 'char' DBundo.c:378:52: warning: array subscript has type 'char' DBundo.c:379:64: warning: array subscript has type 'char' DBundo.c:383:50: warning: array subscript has type 'char' DBundo.c:384:58: warning: array subscript has type 'char' DBundo.c:392:52: warning: array subscript has type 'char' DBundo.c:393:57: warning: array subscript has type 'char' DBundo.c:399:52: warning: array subscript has type 'char' DBundo.c:400:57: warning: array subscript has type 'char' DBundo.c:403:53: warning: array subscript has type 'char' DBundo.c:407:50: warning: array subscript has type 'char' DBundo.c:408:58: warning: array subscript has type 'char' EFbuild.c:1048:32: warning: array subscript has type 'char' EFbuild.c:1056:32: warning: array subscript has type 'char' ExtBasic.c:2358:43: warning: array subscript has type 'char' ExtBasic.c:2493:43: warning: array subscript has type 'char' ExtBasic.c:2519:43: warning: array subscript has type 'char' ExtBasic.c:2644:43: warning: array subscript has type 'char' ExtBasic.c:2678:43: warning: array subscript has type 'char' ResPrint.c:143:43: warning: array subscript has type 'char' plotRutils.c:713:34: warning: array subscript has type 'char' plotRutils.c:786:29: warning: array subscript has type 'char' GCC14 -Wall cleanup series [-Wchar-subscripts] --- database/DBundo.c | 54 +++++++++++++++++++++++----------------------- extflat/EFbuild.c | 4 ++-- extract/ExtBasic.c | 10 ++++----- plot/plotRutils.c | 4 ++-- resis/ResPrint.c | 2 +- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/database/DBundo.c b/database/DBundo.c index 56a6bc94..73b98414 100644 --- a/database/DBundo.c +++ b/database/DBundo.c @@ -260,7 +260,7 @@ dbUndoSplitForw(us) { /* Create internal fracture */ if (dbUndoLastCell == NULL) return; - DBSplitTile(dbUndoLastCell->cd_planes[us->sue_plane], &us->sue_point, + DBSplitTile(dbUndoLastCell->cd_planes[(unsigned char)us->sue_plane], &us->sue_point, us->sue_splitx); } @@ -276,7 +276,7 @@ dbUndoSplitBack(us) srect.r_ur.p_y = us->sue_point.p_y + 1; /* Remove internal fracture and restore original split tile */ - DBMergeNMTiles0(dbUndoLastCell->cd_planes[us->sue_plane], &srect, + DBMergeNMTiles0(dbUndoLastCell->cd_planes[(unsigned char)us->sue_plane], &srect, (PaintUndoInfo *)NULL, TRUE); } @@ -314,20 +314,20 @@ dbUndoPaintForw(up) loctype = (up->pue_oldtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_oldtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_oldtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdEraseTbl(up->pue_oldtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdEraseTbl(up->pue_oldtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); if (up->pue_newtype & TT_DIAGONAL) @@ -335,20 +335,20 @@ dbUndoPaintForw(up) loctype = (up->pue_newtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_newtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_newtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdPaintTbl(up->pue_newtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdPaintTbl(up->pue_newtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); endPaintFor: dbUndoUndid = TRUE; @@ -368,20 +368,20 @@ dbUndoPaintBack(up) loctype = (up->pue_newtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_newtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_newtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdEraseTbl(up->pue_newtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdEraseTbl(up->pue_newtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); if (up->pue_oldtype & TT_DIAGONAL) @@ -389,23 +389,23 @@ dbUndoPaintBack(up) loctype = (up->pue_oldtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_oldtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], dinfo, - &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], dinfo, + &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_oldtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], dinfo, - &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], dinfo, + &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); - DBMergeNMTiles0(dbUndoLastCell->cd_planes[up->pue_plane], + DBMergeNMTiles0(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, (PaintUndoInfo *)NULL, TRUE); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdPaintTbl(up->pue_oldtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdPaintTbl(up->pue_oldtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); endPaintBack: diff --git a/extflat/EFbuild.c b/extflat/EFbuild.c index 684f2895..20c31830 100644 --- a/extflat/EFbuild.c +++ b/extflat/EFbuild.c @@ -1045,7 +1045,7 @@ efBuildDevice(def, class, type, r, argc, argv) && (ttype != extGetDevType(EFDevTypes[newdev->dev_type])))) { TxError("Device %s %s at (%d, %d) overlaps incompatible device %s %s!\n", - extDevTable[class], type, r->r_xbot, r->r_ybot, + extDevTable[(unsigned char)class], type, r->r_xbot, r->r_ybot, extDevTable[newdev->dev_class], EFDevTypes[newdev->dev_type]); return 0; } @@ -1053,7 +1053,7 @@ efBuildDevice(def, class, type, r, argc, argv) { TxError("Device %s %s at (%d, %d) overlaps device with incompatible" " number of terminals (%d vs. %d)!\n", - extDevTable[class], type, r->r_xbot, r->r_ybot, nterminals, + extDevTable[(unsigned char)class], type, r->r_xbot, r->r_ybot, nterminals, newdev->dev_nterm); return 0; } diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index a776b893..2c73d98c 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -2355,7 +2355,7 @@ extOutputDevices(def, transList, outFile) { case DEV_FET: /* old style, perimeter & area */ fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2490,7 +2490,7 @@ extOutputDevices(def, transList, outFile) devptr = extDevFindParamMatch(devptr, length, width); fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2516,7 +2516,7 @@ extOutputDevices(def, transList, outFile) case DEV_PDIODE: devptr = extDevFindParamMatch(devptr, length, width); fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2641,7 +2641,7 @@ extOutputDevices(def, transList, outFile) devptr = extDevFindParamMatch(devptr, length, width); fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2675,7 +2675,7 @@ extOutputDevices(def, transList, outFile) case DEV_CAPREV: case DEV_CSUBCKT: fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", diff --git a/plot/plotRutils.c b/plot/plotRutils.c index ec0e2485..8b4b22ee 100644 --- a/plot/plotRutils.c +++ b/plot/plotRutils.c @@ -710,7 +710,7 @@ PlotTextSize(font, string, area) { if ((*string == ' ') || (*string == '\t')) d = &font->fo_chars['t']; - else d = &font->fo_chars[*string]; + else d = &font->fo_chars[(unsigned char)*string]; if (d->nbytes == 0) continue; if (d->up > area->r_ytop) area->r_ytop = d->up; @@ -783,7 +783,7 @@ PlotRasterText(raster, clip, font, string, point) * area of the raster. */ - d = &font->fo_chars[*string]; + d = &font->fo_chars[(unsigned char)*string]; cBytesPerLine = (d->left + d->right + 7) >> 3; for (i = 0; i < d->up + d->down; i++) { diff --git a/resis/ResPrint.c b/resis/ResPrint.c index 49e8c537..50397eca 100644 --- a/resis/ResPrint.c +++ b/resis/ResPrint.c @@ -140,7 +140,7 @@ ResPrintExtDev(outextfile, devices) fprintf(outextfile,"device "); fprintf(outextfile,"%s %s %d %d %d %d ", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName, devices->layout->rd_inside.r_ll.p_x, devices->layout->rd_inside.r_ll.p_y, From 518b5f45d84bffd72abba336153c22e3f6d6a36b Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:16:54 +0100 Subject: [PATCH 164/206] bpEnum.h: warning: suggest parentheses around assignment used as truth value Removes 1312 warning lines from build output due to inline nature of use. bplane/bpEnum.h:509:10: warning: suggest parentheses around assignment used as truth value bplane/bpEnum.h:513:10: warning: suggest parentheses around assignment used as truth value bplane/bpEnum.h:517:10: warning: suggest parentheses around assignment used as truth value bplane/bpEnum.h:521:10: warning: suggest parentheses around assignment used as truth value bbplane/bpEnum.h:525:10: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- bplane/bpEnum.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bplane/bpEnum.h b/bplane/bpEnum.h index 5cb7fbfa..1d44a5df 100644 --- a/bplane/bpEnum.h +++ b/bplane/bpEnum.h @@ -506,23 +506,23 @@ static __inline__ void *BPEnumNext(BPEnum *bpe) switch (bpe->bpe_top->bps_state) { case BPS_BINS: - if(e=bpEnumNextBINS(bpe, 0)) return e; + if((e=bpEnumNextBINS(bpe, 0))) return e; break; case BPS_BINS_INSIDE: - if(e=bpEnumNextBINS(bpe, 1)) return e; + if((e=bpEnumNextBINS(bpe, 1))) return e; break; case BPS_INBOX: - if(e=bpEnumNextINBOX(bpe, 0)) return e; + if((e=bpEnumNextINBOX(bpe, 0))) return e; break; case BPS_INBOX_INSIDE: - if(e=bpEnumNextINBOX(bpe, 1)) return e; + if((e=bpEnumNextINBOX(bpe, 1))) return e; break; case BPS_HASH: - if(e=bpEnumNextHASH(bpe)) return e; + if((e=bpEnumNextHASH(bpe))) return e; break; case BPS_DONE: From 6cdb9ad167d6b1e8ef6987ecedb753859770e8fd Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:19:27 +0100 Subject: [PATCH 165/206] 36 x warning: suggest parentheses around assignment used as truth value bpMain.c:265:11: warning: suggest parentheses around assignment used as truth value CmdSubrs.c:413:12: warning: suggest parentheses around assignment used as truth value CmdSubrs.c:759:13: warning: suggest parentheses around assignment used as truth value CmdFI.c:1600:12: warning: suggest parentheses around assignment used as truth value DBcell.c:109:12: warning: suggest parentheses around assignment used as truth value DBcellname.c:2512:9: warning: suggest parentheses around assignment used as truth value DBcellsrch.c:95:12: warning: suggest parentheses around assignment used as truth value DBio.c:3998:9: warning: suggest parentheses around assignment used as truth value DBlabel2.c:228:9: warning: suggest parentheses around assignment used as truth value DBWelement.c:195:12: warning: suggest parentheses around assignment used as truth value DBWelement.c:197:13: warning: suggest parentheses around assignment used as truth value DBWelement.c:295:12: warning: suggest parentheses around assignment used as truth value DBWelement.c:297:13: warning: suggest parentheses around assignment used as truth value DBWelement.c:637:12: warning: suggest parentheses around assignment used as truth value DBWelement.c:639:13: warning: suggest parentheses around assignment used as truth value DBWelement.c:679:12: warning: suggest parentheses around assignment used as truth value DBWelement.c:681:13: warning: suggest parentheses around assignment used as truth value DRCtech.c:1219:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:1368:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:1471:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:1543:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:1676:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:1772:21: warning: suggest parentheses around assignment used as truth value DRCtech.c:1919:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:2099:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:2324:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:2713:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:2830:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:2944:17: warning: suggest parentheses around assignment used as truth value DRCtech.c:3097:21: warning: suggest parentheses around assignment used as truth value DRCtech.c:3144:21: warning: suggest parentheses around assignment used as truth value DRCtech.c:3181:21: warning: suggest parentheses around assignment used as truth value DRCtech.c:3215:9: warning: suggest parentheses around assignment used as truth value DRCtech.c:3227:21: warning: suggest parentheses around assignment used as truth value DRCtech.c:3261:21: warning: suggest parentheses around assignment used as truth value DRCtech.c:3459:17: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- bplane/bpMain.c | 2 +- commands/CmdFI.c | 2 +- commands/CmdSubrs.c | 4 ++-- database/DBcell.c | 2 +- database/DBcellname.c | 2 +- database/DBcellsrch.c | 2 +- database/DBio.c | 2 +- database/DBlabel2.c | 2 +- dbwind/DBWelement.c | 16 ++++++++-------- drc/DRCtech.c | 38 +++++++++++++++++++------------------- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/bplane/bpMain.c b/bplane/bpMain.c index b3cd752d..36046973 100644 --- a/bplane/bpMain.c +++ b/bplane/bpMain.c @@ -262,7 +262,7 @@ Rect BPBBox(BPlane *bp) e = BPEnumNext(&bpe); bp->bp_bbox = e->e_rect; - while(e = BPEnumNext(&bpe)) + while((e = BPEnumNext(&bpe))) { GeoIncludeRectInBBox(&e->e_rect, &bp->bp_bbox); } diff --git a/commands/CmdFI.c b/commands/CmdFI.c index cfd4066b..b1b437d0 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -1597,7 +1597,7 @@ CmdFindNetProc(nodename, use, rect, warn_not_found, isvalid) scx.scx_trans = GeoIdentityTransform; s = nodename; trans = GeoIdentityTransform; - while (s2 = strchr(s, '/')) + while ((s2 = strchr(s, '/'))) { *s2 = '\0'; DBTreeFindUse(s, scx.scx_use, &scx2); diff --git a/commands/CmdSubrs.c b/commands/CmdSubrs.c index 18157db6..9932b6f9 100644 --- a/commands/CmdSubrs.c +++ b/commands/CmdSubrs.c @@ -410,7 +410,7 @@ CmdParseLayers(s, mask) TTMaskZero(mask); - while (c = *s++) + while ((c = *s++)) { switch (c) { @@ -756,7 +756,7 @@ again: if (strcmp(returnname, def->cd_name) != 0) { - if (f = PaOpen(returnname, "r", DBSuffix, ".", (char *) NULL, &filename)) + if ((f = PaOpen(returnname, "r", DBSuffix, ".", (char *) NULL, &filename))) { (void) fclose(f); if (noninteractive) { diff --git a/database/DBcell.c b/database/DBcell.c index 57444bae..a28d4493 100644 --- a/database/DBcell.c +++ b/database/DBcell.c @@ -106,7 +106,7 @@ DBCellFindDup(use, parent) BPEnumInit(&bpe, parent->cd_cellPlane, &use->cu_bbox, BPE_EQUAL, "DBCellFindDup"); - while (dupUse = BPEnumNext(&bpe)) + while ((dupUse = BPEnumNext(&bpe))) if (dupUse->cu_def == use->cu_def) /* Transforms must be equal---Aligned bounding boxes are * an insufficient measure of exact overlap. diff --git a/database/DBcellname.c b/database/DBcellname.c index b9eedd1c..faf10fc6 100644 --- a/database/DBcellname.c +++ b/database/DBcellname.c @@ -2509,7 +2509,7 @@ DBUnLinkCell(use, parentDef) { HashEntry *he; - if (he = HashLookOnly(&parentDef->cd_idHash, use->cu_id)) + if ((he = HashLookOnly(&parentDef->cd_idHash, use->cu_id))) HashSetValue(he, (ClientData) NULL); } diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index ed08f7b7..a8e946c5 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -92,7 +92,7 @@ DBSrCellPlaneArea(BPlane *plane, Rect *rect, int (*func)(), ClientData arg) bpe = (BPEnum *)mallocMagic(sizeof(BPEnum)); BPEnumInit(bpe, plane, rect, BPE_OVERLAP, "DBSrCellPlaneArea"); - while (use = BPEnumNext(bpe)) + while ((use = BPEnumNext(bpe))) { if ((*func)(use, arg)) { diff --git a/database/DBio.c b/database/DBio.c index bf663bac..9848e9ac 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -3993,7 +3993,7 @@ DBCellWrite(cellDef, fileName) * If so, write to the temp file and then rename it after * we're done. */ - if (tmpf = fopen(tmpname, "w")) + if ((tmpf = fopen(tmpname, "w"))) { result = DBCellWriteFile(cellDef, tmpf); (void) fclose(tmpf); diff --git a/database/DBlabel2.c b/database/DBlabel2.c index b43d01ef..9396af1f 100644 --- a/database/DBlabel2.c +++ b/database/DBlabel2.c @@ -225,7 +225,7 @@ DBSrLabelLoc(rootUse, name, func, cdarg) char csave; Rect r; - if (cp = strrchr(name, '/')) + if ((cp = strrchr(name, '/'))) { csave = *cp; *cp = '\0'; diff --git a/dbwind/DBWelement.c b/dbwind/DBWelement.c index 6172f047..408be04e 100644 --- a/dbwind/DBWelement.c +++ b/dbwind/DBWelement.c @@ -192,9 +192,9 @@ DBWPrintElements(cellDef, flagmask, reducer) char *etypes[] = {"rectangle", "line", "text"}; HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { if ((elem->rootDef == cellDef) && (elem->flags & flagmask)) { @@ -292,9 +292,9 @@ DBWScaleElements(n, d) extern bool DBScalePoint(); /* Forward declaration */ HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { /* scale area rectangle */ DBScalePoint(&elem->area.r_ll, n, d); @@ -634,9 +634,9 @@ DBWElementNames() #endif HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { #ifdef MAGIC_WRAPPER Tcl_AppendElement(magicinterp, he->h_key.h_name); @@ -676,9 +676,9 @@ DBWElementInbox(area) #endif HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { if (GEO_SURROUND(area, &elem->area)) { diff --git a/drc/DRCtech.c b/drc/DRCtech.c index 0e02924e..44d20f5c 100644 --- a/drc/DRCtech.c +++ b/drc/DRCtech.c @@ -1216,7 +1216,7 @@ drcExtend(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask2))) { /* Edge depends on whether or not the extension is */ /* on the same plane as the layer from which it is */ @@ -1365,7 +1365,7 @@ drcWidth(argc, argv) * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1468,7 +1468,7 @@ drcArea(argc, argv) * to the right of any edge between a type in '~set' * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1540,7 +1540,7 @@ drcOffGrid(argc, argv) * to the right of any edge between a type in '~set' * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j))) + if ((pset = (DBTypesOnSamePlane(i, j)))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1673,7 +1673,7 @@ drcMaxwidth(argc, argv) * to the right of any edge between a type in '~set' * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1769,7 +1769,7 @@ drcAngles(argc, argv) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { /* Inside corners */ if (TTMaskHasType(&set, i) && TTMaskHasType(&set2, j)) @@ -1916,7 +1916,7 @@ drcSpacing3(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set3, j)) { @@ -2096,7 +2096,7 @@ drcMaskSpacing(set1, set2, pmask1, pmask2, wwidth, distance, adjacency, for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask1)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask1))) { plane = LowestMaskBit(pset); @@ -2321,7 +2321,7 @@ drcMaskSpacing(set1, set2, pmask1, pmask2, wwidth, distance, adjacency, if (needtrigger) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask1)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask1))) { plane = LowestMaskBit(pset); @@ -2710,7 +2710,7 @@ drcEdge(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask1)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask1))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set2, j)) { @@ -2827,7 +2827,7 @@ drcOverhang(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask2))) { if ((pset & pMask1) != 0) { @@ -2941,7 +2941,7 @@ drcRectOnly(argc, argv) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set2, j)) { @@ -3094,7 +3094,7 @@ drcSurround(argc, argv) if (isDirectional) { - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { /* Directional surround is done entirely differently */ @@ -3141,7 +3141,7 @@ drcSurround(argc, argv) } else { - if (pset = (DBTypesOnSamePlane(i, j) & pmask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask2))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set2, j)) { @@ -3178,7 +3178,7 @@ drcSurround(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; /* Ignore false edges */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setM, i) && TTMaskHasType(&set2, j)) { @@ -3212,7 +3212,7 @@ drcSurround(argc, argv) /* Add an extra rule when presence of the surrounding */ /* layer is required. Rule is different if planes match. */ - if (pset = pmask & pmask2) + if ((pset = pmask & pmask2)) { TTMaskZero(&invM); TTMaskSetMask(&invM, &setM); @@ -3224,7 +3224,7 @@ drcSurround(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask & pmask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask & pmask2))) { plane1 = LowestMaskBit(pset); if (TTMaskHasType(&setM, i) && TTMaskHasType(&invM, j)) @@ -3258,7 +3258,7 @@ drcSurround(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setM, i) && TTMaskHasType(&invM, j)) { @@ -3456,7 +3456,7 @@ drcRectangle(argc, argv) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask))) { if (TTMaskHasType(&types, i) && TTMaskHasType(¬types, j)) { From e3bfe8c59ed93c94f7a6e5f29a695b1a29c5678d Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:20:25 +0100 Subject: [PATCH 166/206] 42 x warning: suggest parentheses around assignment used as truth value EFbuild.c:466:9: warning: suggest parentheses around assignment used as truth value EFbuild.c:662:20: warning: suggest parentheses around assignment used as truth value EFbuild.c:682:24: warning: suggest parentheses around assignment used as truth value EFbuild.c:690:24: warning: suggest parentheses around assignment used as truth value EFbuild.c:1760:12: warning: suggest parentheses around assignment used as truth value EFbuild.c:1973:9: warning: suggest parentheses around assignment used as truth value EFbuild.c:2062:12: warning: suggest parentheses around assignment used as truth value EFbuild.c:2063:13: warning: suggest parentheses around assignment used as truth value EFbuild.c:2091:12: warning: suggest parentheses around assignment used as truth value EFbuild.c:2134:12: warning: suggest parentheses around assignment used as truth value EFbuild.c:2135:13: warning: suggest parentheses around assignment used as truth value EFread.c:673:12: warning: suggest parentheses around assignment used as truth value ExtArray.c:693:12: warning: suggest parentheses around assignment used as truth value ExtArray.c:800:13: warning: suggest parentheses around assignment used as truth value ExtBasic.c:4569:9: warning: suggest parentheses around assignment used as truth value ExtBasic.c:4949:13: warning: suggest parentheses around assignment used as truth value ExtBasic.c:5032:12: warning: suggest parentheses around assignment used as truth value ExtCell.c:218:13: warning: suggest parentheses around assignment used as truth value ExtCouple.c:222:12: warning: suggest parentheses around assignment used as truth value ExtCouple.c:278:12: warning: suggest parentheses around assignment used as truth value ExtCouple.c:467:9: warning: suggest parentheses around assignment used as truth value ExtHard.c:379:12: warning: suggest parentheses around assignment used as truth value ExtHard.c:458:12: warning: suggest parentheses around assignment used as truth value ExtHier.c:740:16: warning: suggest parentheses around assignment used as truth value ExtHier.c:831:12: warning: suggest parentheses around assignment used as truth value ExtHier.c:841:13: warning: suggest parentheses around assignment used as truth value ExtHier.c:851:17: warning: suggest parentheses around assignment used as truth value ExtHier.c:865:34: warning: suggest parentheses around assignment used as truth value ExtLength.c:264:12: warning: suggest parentheses around assignment used as truth value ExtLength.c:276:12: warning: suggest parentheses around assignment used as truth value ExtLength.c:878:9: warning: suggest parentheses around assignment used as truth value ExtMain.c:499:12: warning: suggest parentheses around assignment used as truth value ExtMain.c:970:12: warning: suggest parentheses around assignment used as truth value ExtNghbors.c:298:13: warning: suggest parentheses around assignment used as truth value ExtSubtree.c:683:12: warning: suggest parentheses around assignment used as truth value ExtTest.c:457:21: warning: suggest parentheses around assignment used as truth value ExtTest.c:466:21: warning: suggest parentheses around assignment used as truth value ExtTimes.c:216:12: warning: suggest parentheses around assignment used as truth value ExtTimes.c:226:12: warning: suggest parentheses around assignment used as truth value ExtTimes.c:235:12: warning: suggest parentheses around assignment used as truth value ExtYank.c:236:34: warning: suggest parentheses around assignment used as truth value ExtYank.c:238:42: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- extflat/EFbuild.c | 22 +++++++++++----------- extflat/EFread.c | 2 +- extract/ExtArray.c | 4 ++-- extract/ExtBasic.c | 6 +++--- extract/ExtCell.c | 2 +- extract/ExtCouple.c | 6 +++--- extract/ExtHard.c | 4 ++-- extract/ExtHier.c | 10 +++++----- extract/ExtLength.c | 6 +++--- extract/ExtMain.c | 4 ++-- extract/ExtNghbors.c | 2 +- extract/ExtSubtree.c | 2 +- extract/ExtTest.c | 4 ++-- extract/ExtTimes.c | 6 +++--- extract/ExtYank.c | 4 ++-- 15 files changed, 42 insertions(+), 42 deletions(-) diff --git a/extflat/EFbuild.c b/extflat/EFbuild.c index 20c31830..e1688680 100644 --- a/extflat/EFbuild.c +++ b/extflat/EFbuild.c @@ -463,7 +463,7 @@ efBuildDist(def, driver, receiver, min, max) #endif /* notdef */ he = HashFind(&def->def_dists, (char *) &distKey); - if (dist = (Distance *) HashGetValue(he)) + if ((dist = (Distance *) HashGetValue(he))) { /* * There was already an entry in the table; update it @@ -659,7 +659,7 @@ efBuildEquiv(def, nodeName1, nodeName2, resist, isspice) * node that was just removed. */ HashStartSearch(&hs); - while (he = HashNext(&def->def_devs, &hs)) + while ((he = HashNext(&def->def_devs, &hs))) { Dev *dev; int n; @@ -679,7 +679,7 @@ efBuildEquiv(def, nodeName1, nodeName2, resist, isspice) { nn2->efnn_refc += nn1->efnn_refc + 1; HashStartSearch(&hs); - while (he1 = HashNext(&def->def_nodes, &hs)) + while ((he1 = HashNext(&def->def_nodes, &hs))) if ((EFNodeName *)HashGetValue(he1) == nn1) HashSetValue(he1, (char *)nn2); } @@ -687,7 +687,7 @@ efBuildEquiv(def, nodeName1, nodeName2, resist, isspice) { nn1->efnn_refc += nn2->efnn_refc + 1; HashStartSearch(&hs); - while (he2 = HashNext(&def->def_nodes, &hs)) + while ((he2 = HashNext(&def->def_nodes, &hs))) if ((EFNodeName *)HashGetValue(he2) == nn2) HashSetValue(he2, (char *)nn1); } @@ -1757,7 +1757,7 @@ again: *dstp++ = ']'; /* Copy remainder of path */ - while (*dstp++ = *cp++) + while ((*dstp++ = *cp++)) /* Nothing */; cnp->cn_name = StrDup((char **) NULL, newname); @@ -1970,7 +1970,7 @@ efNodeMerge(node1ptr, node2ptr) keeping->efnode_num += removing->efnode_num; /* Merge attribute lists */ - if (ap = removing->efnode_attrs) + if ((ap = removing->efnode_attrs)) { while (ap->efa_next) ap = ap->efa_next; @@ -2059,8 +2059,8 @@ efFreeUseTable(table) EFNodeName *nn; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) - if (use = (Use *) HashGetValue(he)) + while ((he = HashNext(table, &hs))) + if ((use = (Use *) HashGetValue(he))) { if (use->use_id != NULL) freeMagic((char *)use->use_id); freeMagic(use); @@ -2088,7 +2088,7 @@ efFreeDevTable(table) int n; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { dev = (Dev *)HashGetValue(he); for (n = 0; n < (int)dev->dev_nterm; n++) @@ -2131,8 +2131,8 @@ efFreeNodeTable(table) EFNodeName *nn; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) - if (nn = (EFNodeName *) HashGetValue(he)) + while ((he = HashNext(table, &hs))) + if ((nn = (EFNodeName *) HashGetValue(he))) { for (hn = nn->efnn_hier; hn; hn = hn->hn_parent) (void) HashFind(&efFreeHashTable, (char *) hn); diff --git a/extflat/EFread.c b/extflat/EFread.c index 7692a9d6..29742c72 100644 --- a/extflat/EFread.c +++ b/extflat/EFread.c @@ -670,7 +670,7 @@ resistChanged: /* Read in each def that has not yet been read in */ HashStartSearch(&hs); - while (he = HashNext(&def->def_uses, &hs)) + while ((he = HashNext(&def->def_uses, &hs))) { use = (Use *)HashGetValue(he); if ((use->use_def->def_flags & DEF_AVAILABLE) == 0) diff --git a/extract/ExtArray.c b/extract/ExtArray.c index 2ea8b6ea..b1f9f43f 100644 --- a/extract/ExtArray.c +++ b/extract/ExtArray.c @@ -690,7 +690,7 @@ extArrayAdjust(ha, et1, et2) extHierAdjustments(ha, &ha->ha_cumFlat, et2, et2); HashStartSearch(&hs); - while (he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs)) + while ((he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs))) { cap = extGetCapValue(he) / ExtCurStyle->exts_capScale; if (cap == 0) @@ -797,7 +797,7 @@ extArrayTileToNode(tp, pNum, et, ha, doHard) } if (!DebugIsSet(extDebugID, extDebNoHard)) - if (reg = (LabRegion *) extArrayHardNode(tp, pNum, def, ha)) + if ((reg = (LabRegion *) extArrayHardNode(tp, pNum, def, ha))) goto found; /* Blew it */ diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 2c73d98c..8ab90e68 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -4566,7 +4566,7 @@ extNodeAreaFunc(tile, arg) } /* Compute the resistance for the previous region */ - if (old = (NodeRegion *) arg->fra_region) + if ((old = (NodeRegion *) arg->fra_region)) if (ExtOptions & EXT_DORESISTANCE) extSetResist(old); @@ -4946,7 +4946,7 @@ donesides: * 1-lambda halo to find everything it overlaps or touches * on the other plane. */ - if (pMask = DBAllConnPlanes[type]) + if ((pMask = DBAllConnPlanes[type])) { Rect biggerArea; bool is_split = IsSplit(tile); @@ -5029,7 +5029,7 @@ extCapHashKill(ht) HashEntry *he; HashStartSearch(&hs); - while (he = HashNext(ht, &hs)) + while ((he = HashNext(ht, &hs))) { if (HashGetValue(he) != NULL) { diff --git a/extract/ExtCell.c b/extract/ExtCell.c index 48d33751..d425c4d4 100644 --- a/extract/ExtCell.c +++ b/extract/ExtCell.c @@ -215,7 +215,7 @@ extFileOpen(def, file, mode, prealfile) name = def->cd_file; ends = strrchr(def->cd_file, '/'); if (ends == NULL) ends = def->cd_file; - if (endp = strrchr(ends + 1, '.')) + if ((endp = strrchr(ends + 1, '.'))) { name = namebuf; len = endp - def->cd_file; diff --git a/extract/ExtCouple.c b/extract/ExtCouple.c index 80a177d6..9b669248 100644 --- a/extract/ExtCouple.c +++ b/extract/ExtCouple.c @@ -219,7 +219,7 @@ extRelocateSubstrateCoupling(table, subsnode) NodeRegion *rbp; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { cap = extGetCapValue(he); if (cap == 0) continue; @@ -275,7 +275,7 @@ extOutputCoupling(table, outFile) CapValue cap; /* value of capacitance. */ HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { cap = extGetCapValue(he) / ExtCurStyle->exts_capScale; if (cap == 0) @@ -464,7 +464,7 @@ extAddOverlap(tbelow, ecpls) * Deduct the area shielded from the area of the overlap, so we adjust * the overlap capacitance correspondingly. */ - if (ov.o_pmask = ExtCurStyle->exts_overlapShieldPlanes[ta][tb]) + if ((ov.o_pmask = ExtCurStyle->exts_overlapShieldPlanes[ta][tb])) { ov.o_tmask = ExtCurStyle->exts_overlapShieldTypes[ta][tb]; for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) diff --git a/extract/ExtHard.c b/extract/ExtHard.c index 923c2041..8f1fef43 100644 --- a/extract/ExtHard.c +++ b/extract/ExtHard.c @@ -376,7 +376,7 @@ extHardSetLabel(scx, reg, arg) do { *dstp++ = *srcp++; } while (--prefixlen > 0); } srcp = text; - while (*dstp++ = *srcp++) /* Nothing */; + while ((*dstp++ = *srcp++)) /* Nothing */; arg->hw_label = newlab; if (DebugIsSet(extDebugID, extDebHardWay)) @@ -455,7 +455,7 @@ extHardGenerateLabel(scx, reg, arg) do { *dstp++ = *srcp++; } while (--prefixlen > 0); } srcp = gen; - while (*dstp++ = *srcp++) /* Nothing */; + while ((*dstp++ = *srcp++)) /* Nothing */; arg->hw_label = newlab; if (DebugIsSet(extDebugID, extDebHardWay)) TxPrintf("Hard way: generated label = \"%s\"\n", newlab->lab_text); diff --git a/extract/ExtHier.c b/extract/ExtHier.c index 24c8e036..87d223b8 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -737,7 +737,7 @@ extHierAdjustments(ha, cumFlat, oneFlat, lookFlat) if (ExtOptions & EXT_DOCOUPLING) { HashStartSearch(&hs); - while (he = HashNext(&oneFlat->et_coupleHash, &hs)) + while ((he = HashNext(&oneFlat->et_coupleHash, &hs))) { ckpOne = ((CoupleKey *) he->h_key.h_words); @@ -828,7 +828,7 @@ extOutputConns(table, outf) HashEntry *he; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { nfirst = (NodeName *) HashGetValue(he); @@ -838,7 +838,7 @@ extOutputConns(table, outf) * for a node appearing earlier in the table. If so, we need * only free the NodeName without any further processing. */ - if (node = nfirst->nn_node) + if ((node = nfirst->nn_node)) { /* * If there are N names for this node, output N-1 merge lines. @@ -848,7 +848,7 @@ extOutputConns(table, outf) /* Note 3/1/2017: Cap value no longer used */ c = (node->node_cap) / ExtCurStyle->exts_capScale; nn = node->node_names; - if (nnext = nn->nn_next) + if ((nnext = nn->nn_next)) { /* First merge */ fprintf(outf, "merge \"%s\" \"%s\" %lg", @@ -862,7 +862,7 @@ extOutputConns(table, outf) nn->nn_node = (Node *) NULL; /* Processed */ /* Subsequent merges */ - for (nn = nnext; nnext = nn->nn_next; nn = nnext) + for (nn = nnext; (nnext = nn->nn_next); nn = nnext) { fprintf(outf, "merge \"%s\" \"%s\"\n", nn->nn_name, nnext->nn_name); diff --git a/extract/ExtLength.c b/extract/ExtLength.c index bfb2ba6f..b896d3e2 100644 --- a/extract/ExtLength.c +++ b/extract/ExtLength.c @@ -261,7 +261,7 @@ extLength(rootUse, f) * be from a single cell. */ HashStartSearch(&hs); - while (he = HashNext(&extDriverHash, &hs)) + while ((he = HashNext(&extDriverHash, &hs))) { dList = extPathLabel(rootUse, he->h_key.h_name); HashSetValue(he, (ClientData) dList); @@ -273,7 +273,7 @@ extLength(rootUse, f) * then compute and output the distance to each. */ HashStartSearch(&hs); - while (he = HashNext(&extDriverHash, &hs)) + while ((he = HashNext(&extDriverHash, &hs))) { /* Ignore drivers whose labels couldn't be found */ dList = (Label *) HashGetValue(he); @@ -875,7 +875,7 @@ extPathFlood(tile, p, distance, epa) * 1-lambda halo to find everything it overlaps or touches * on the other plane. */ - if (pMask = DBAllConnPlanes[type]) + if ((pMask = DBAllConnPlanes[type])) { int saveplane = epa->epa_pNum; struct extPathFloodArg epfa; diff --git a/extract/ExtMain.c b/extract/ExtMain.c index ab9b38c0..eac2b5ee 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -496,7 +496,7 @@ ExtUnique(rootUse, option) /* Now process all the cells we just found */ nwarn = 0; - while (def = (CellDef *) StackPop(extDefStack)) + while ((def = (CellDef *) StackPop(extDefStack))) { /* EXT_UNIQ_NOTOPPORTS: Use EXT_UNIQ_ALL on all cells other than the top */ if ((option == EXT_UNIQ_NOTOPPORTS) && @@ -967,7 +967,7 @@ extExtractStack(stack, doExtract, rootDef) CellDef *def; struct saveList *newsl, *sl = (struct saveList *)NULL; - while (def = (CellDef *) StackPop(stack)) + while ((def = (CellDef *) StackPop(stack))) { def->cd_client = (ClientData) 0; if (!SigInterruptPending) diff --git a/extract/ExtNghbors.c b/extract/ExtNghbors.c index bdfa8ce0..9ea7b21a 100644 --- a/extract/ExtNghbors.c +++ b/extract/ExtNghbors.c @@ -295,7 +295,7 @@ donesides: * 1-lambda halo to find everything it overlaps or touches * on the other plane. */ - if (pMask = DBAllConnPlanes[type]) + if ((pMask = DBAllConnPlanes[type])) { TITORECT(tile, &pla.area); GEO_EXPAND(&pla.area, 1, &biggerArea); diff --git a/extract/ExtSubtree.c b/extract/ExtSubtree.c index cd7944ee..d1a854bf 100644 --- a/extract/ExtSubtree.c +++ b/extract/ExtSubtree.c @@ -680,7 +680,7 @@ extSubtreeOutputCoupling(ha) char *name; HashStartSearch(&hs); - while (he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs)) + while ((he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs))) { cap = extGetCapValue(he) / ExtCurStyle->exts_capScale; if (cap == 0) diff --git a/extract/ExtTest.c b/extract/ExtTest.c index 7217707e..38b9c3fe 100644 --- a/extract/ExtTest.c +++ b/extract/ExtTest.c @@ -454,7 +454,7 @@ extShowTech(name) out); fprintf(out, "\n"); } - if (e = ExtCurStyle->exts_sideCoupleCap[s][t]) + if ((e = ExtCurStyle->exts_sideCoupleCap[s][t])) for ( ; e; e = e->ec_next) { fprintf(out, " COUPLE: "); @@ -463,7 +463,7 @@ extShowTech(name) extShowMask(&e->ec_far, out); fprintf(out, ": %lf\n", e->ec_cap); } - if (e = ExtCurStyle->exts_sideOverlapCap[s][t]) + if ((e = ExtCurStyle->exts_sideOverlapCap[s][t])) for ( ; e; e = e->ec_next) { fprintf(out, " OVERLAP: "); diff --git a/extract/ExtTimes.c b/extract/ExtTimes.c index 1f1d21e7..7d3a6431 100644 --- a/extract/ExtTimes.c +++ b/extract/ExtTimes.c @@ -213,7 +213,7 @@ ExtTimes(rootUse, f) */ TxPrintf("Computing individual cell statistics:\n"); TxFlush(); HashStartSearch(&hs); - while (he = HashNext(&cellStatsTable, &hs)) + while ((he = HashNext(&cellStatsTable, &hs))) extTimesCellFunc((struct cellStats *) HashGetValue(he)); /* @@ -223,7 +223,7 @@ ExtTimes(rootUse, f) */ TxPrintf("Computing hierarchical and incremental statistics:\n"); TxFlush(); HashStartSearch(&hs); - while (he = HashNext(&cellStatsTable, &hs)) + while ((he = HashNext(&cellStatsTable, &hs))) extTimesIncrFunc((struct cellStats *) HashGetValue(he)); /* @@ -232,7 +232,7 @@ ExtTimes(rootUse, f) */ TxPrintf("Computing summary statistics:\n"); TxFlush(); HashStartSearch(&hs); - while (he = HashNext(&cellStatsTable, &hs)) + while ((he = HashNext(&cellStatsTable, &hs))) { extTimesSummaryFunc((struct cellStats *) HashGetValue(he), f); freeMagic((char *) HashGetValue(he)); diff --git a/extract/ExtYank.c b/extract/ExtYank.c index ace872ee..b89c4256 100644 --- a/extract/ExtYank.c +++ b/extract/ExtYank.c @@ -233,9 +233,9 @@ extHierLabelFunc(scx, label, tpath, targetDef) newlab->lab_flags = label->lab_flags; newlab->lab_port = label->lab_port; dstp = newlab->lab_text; - for (srcp = tpath->tp_first; *dstp++ = *srcp++; ) + for (srcp = tpath->tp_first; (*dstp++ = *srcp++); ) /* Nothing */; - for (--dstp, srcp = label->lab_text; *dstp++ = *srcp++; ) + for (--dstp, srcp = label->lab_text; (*dstp++ = *srcp++); ) /* Nothing */; newlab->lab_next = targetDef->cd_labels; From 64772655dc7050743c7c9c21973eef88f984a259 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:20:32 +0100 Subject: [PATCH 167/206] 38 x warning: suggest parentheses around assignment used as truth value EFdef.c:110:12: warning: suggest parentheses around assignment used as truth value EFdef.c:154:12: warning: suggest parentheses around assignment used as truth value EFdef.c:167:12: warning: suggest parentheses around assignment used as truth value EFflat.c:546:17: warning: suggest parentheses around assignment used as truth value EFflat.c:798:12: warning: suggest parentheses around assignment used as truth value EFflat.c:930:13: warning: suggest parentheses around assignment used as truth value EFflat.c:1152:12: warning: suggest parentheses around assignment used as truth value EFflat.c:1157:13: warning: suggest parentheses around assignment used as truth value EFhier.c:84:12: warning: suggest parentheses around assignment used as truth value EFhier.c:261:12: warning: suggest parentheses around assignment used as truth value EFhier.c:489:12: warning: suggest parentheses around assignment used as truth value EFhier.c:682:12: warning: suggest parentheses around assignment used as truth value EFname.c:325:12: warning: suggest parentheses around assignment used as truth value EFname.c:584:13: warning: suggest parentheses around assignment used as truth value EFname.c:632:16: warning: suggest parentheses around assignment used as truth value EFname.c:765:16: warning: suggest parentheses around assignment used as truth value EFname.c:977:12: warning: suggest parentheses around assignment used as truth value EFsym.c:113:13: warning: suggest parentheses around assignment used as truth value EFsym.c:164:9: warning: suggest parentheses around assignment used as truth value EFvisit.c:322:12: warning: suggest parentheses around assignment used as truth value EFvisit.c:627:12: warning: suggest parentheses around assignment used as truth value EFvisit.c:881:16: warning: suggest parentheses around assignment used as truth value EFvisit.c:917:12: warning: suggest parentheses around assignment used as truth value grTk1.c:1325:9: warning: suggest parentheses around assignment used as truth value grTk1.c:1342:9: warning: suggest parentheses around assignment used as truth value grTk1.c:1757:9: warning: suggest parentheses around assignment used as truth value grTk1.c:1766:9: warning: suggest parentheses around assignment used as truth value grTk5.c:177:12: warning: suggest parentheses around assignment used as truth value grTOGL1.c:1095:9: warning: suggest parentheses around assignment used as truth value grTOGL1.c:1111:9: warning: suggest parentheses around assignment used as truth value grTOGL1.c:1542:13: warning: suggest parentheses around assignment used as truth value grTOGL1.c:1551:13: warning: suggest parentheses around assignment used as truth value grTOGL5.c:201:12: warning: suggest parentheses around assignment used as truth value grTCairo1.c:1093:13: warning: suggest parentheses around assignment used as truth value grTCairo1.c:1109:13: warning: suggest parentheses around assignment used as truth value grTCairo1.c:1493:21: warning: suggest parentheses around assignment used as truth value grTCairo1.c:1502:21: warning: suggest parentheses around assignment used as truth value grTCairo5.c:202:16: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- extflat/EFdef.c | 6 +++--- extflat/EFflat.c | 10 +++++----- extflat/EFhier.c | 8 ++++---- extflat/EFname.c | 10 +++++----- extflat/EFsym.c | 4 ++-- extflat/EFvisit.c | 8 ++++---- graphics/grTCairo1.c | 8 ++++---- graphics/grTCairo5.c | 2 +- graphics/grTOGL1.c | 8 ++++---- graphics/grTOGL5.c | 2 +- graphics/grTk1.c | 8 ++++---- graphics/grTk5.c | 2 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/extflat/EFdef.c b/extflat/EFdef.c index 1947c82c..6eb24b9b 100644 --- a/extflat/EFdef.c +++ b/extflat/EFdef.c @@ -107,7 +107,7 @@ EFDone(func) int n; HashStartSearch(&hs); - while (he = HashNext(&efDefHashTable, &hs)) + while ((he = HashNext(&efDefHashTable, &hs))) { def = (Def *) HashGetValue(he); freeMagic(def->def_name); @@ -151,7 +151,7 @@ EFDone(func) /* Free up the parameter name tables for each device */ HashStartSearch(&hs); - while (he = HashNext(&efDevParamTable, &hs)) + while ((he = HashNext(&efDevParamTable, &hs))) { DevParam *plist = (DevParam *)HashGetValue(he); while (plist != NULL) @@ -164,7 +164,7 @@ EFDone(func) HashKill(&efDevParamTable); HashStartSearch(&hs); - while (he = HashNext(&efFreeHashTable, &hs)) + while ((he = HashNext(&efFreeHashTable, &hs))) { /* Keys of this table are entries to be free'd */ freeMagic(he->h_key.h_ptr); diff --git a/extflat/EFflat.c b/extflat/EFflat.c index 6e253af8..25502dbe 100644 --- a/extflat/EFflat.c +++ b/extflat/EFflat.c @@ -543,7 +543,7 @@ efAddNodes(hc, stdcell) * The name should only have been in the hash table already * if the node was marked with EF_DEVTERM as described above. */ - if (oldname = (EFNodeName *) HashGetValue(he)) + if ((oldname = (EFNodeName *) HashGetValue(he))) { if (hierName != nn->efnn_hier) EFHNFree(hierName, hc->hc_hierName, HN_CONCAT); @@ -795,7 +795,7 @@ efFlatGlob() * also adding it to the global hash table efNodeHashTable. */ HashStartSearch(&hs); - while (heGlob = HashNext(&globalTable, &hs)) + while ((heGlob = HashNext(&globalTable, &hs))) { /* * Add the name to the flat node name hash table, and @@ -927,7 +927,7 @@ efFlatKills(hc) /* Process all of our kill information */ for (k = def->def_kills; k; k = k->kill_next) { - if (he = EFHNConcatLook(hc->hc_hierName, k->kill_name, "kill")) + if ((he = EFHNConcatLook(hc->hc_hierName, k->kill_name, "kill"))) { nn = (EFNodeName *) HashGetValue(he); nn->efnn_node->efnode_flags |= EF_KILLED; @@ -1149,12 +1149,12 @@ efFlatDists(hc) /* Process our own distances */ HashStartSearch(&hs); - while (he = HashNext(&hc->hc_use->use_def->def_dists, &hs)) + while ((he = HashNext(&hc->hc_use->use_def->def_dists, &hs))) { dist = (Distance *) HashGetValue(he); efHNBuildDistKey(hc->hc_hierName, dist, &distKey); heFlat = HashFind(&efDistHashTable, (char *) &distKey); - if (distFlat = (Distance *) HashGetValue(heFlat)) + if ((distFlat = (Distance *) HashGetValue(heFlat))) { /* * This code differs from that in efBuildDist(), in that diff --git a/extflat/EFhier.c b/extflat/EFhier.c index d295437c..efc6cc38 100644 --- a/extflat/EFhier.c +++ b/extflat/EFhier.c @@ -81,7 +81,7 @@ efHierSrUses(hc, func, cdata) HashEntry *he; HashStartSearch(&hs); - while (he = HashNext(&hc->hc_use->use_def->def_uses, &hs)) + while ((he = HashNext(&hc->hc_use->use_def->def_uses, &hs))) { u = (Use *)HashGetValue(he); newhc.hc_use = u; @@ -258,7 +258,7 @@ EFHierSrDefs(hc, func, cdata) } HashStartSearch(&hs); - while (he = HashNext(&hc->hc_use->use_def->def_uses, &hs)) + while ((he = HashNext(&hc->hc_use->use_def->def_uses, &hs))) { u = (Use *)HashGetValue(he); newhc.hc_use = u; @@ -486,7 +486,7 @@ efHierVisitDevs(hc, ca) /* Visit all devices */ HashStartSearch(&hs); - while (he = HashNext(&def->def_devs, &hs)) + while ((he = HashNext(&def->def_devs, &hs))) { dev = (Dev *)HashGetValue(he); if (efHierDevKilled(hc, dev, hc->hc_hierName)) @@ -679,7 +679,7 @@ EFHierVisitCaps(hc, capProc, cdata) /* efCapHashTable using efFlatCaps(). */ HashStartSearch(&hs); - while (he = HashNext(&efCapHashTable, &hs)) + while ((he = HashNext(&efCapHashTable, &hs))) { ccap = CapHashGetValue(he); ck = (EFCoupleKey *) he->h_key.h_words; diff --git a/extflat/EFname.c b/extflat/EFname.c index 5a5302ec..a8ff4256 100644 --- a/extflat/EFname.c +++ b/extflat/EFname.c @@ -322,7 +322,7 @@ efHNToStrFunc(hierName, dstp) } srcp = hierName->hn_name; - while (*dstp++ = *srcp++) + while ((*dstp++ = *srcp++)) /* Nothing */; return --dstp; @@ -581,7 +581,7 @@ efHNLexOrder(hierName1, hierName2) return 0; if (hierName1->hn_parent) - if (i = efHNLexOrder(hierName1->hn_parent, hierName2->hn_parent)) + if ((i = efHNLexOrder(hierName1->hn_parent, hierName2->hn_parent))) return i; return strcmp(hierName1->hn_name, hierName2->hn_name); @@ -629,7 +629,7 @@ efHNFromUse(hc, prefix) namePtr = name; srcp = u->use_id; dstp = name; - while (*dstp++ = *srcp++) + while ((*dstp++ = *srcp++)) /* Nothing */; /* Array subscript */ @@ -762,7 +762,7 @@ efHNInit(hierName, cp, endp) } else { - while (*dstp++ = *cp) + while ((*dstp++ = *cp)) hashsum = HASHADDVAL(hashsum, *cp++); } @@ -974,7 +974,7 @@ efHNDump() } HashStartSearch(&hs); - while (he = HashNext(&efNodeHashTable, &hs)) + while ((he = HashNext(&efNodeHashTable, &hs))) fprintf(f, "%s\n", EFHNToStr((HierName *) he->h_key.h_ptr)); (void) fclose(f); diff --git a/extflat/EFsym.c b/extflat/EFsym.c index d3aae30c..3aeaceba 100644 --- a/extflat/EFsym.c +++ b/extflat/EFsym.c @@ -110,7 +110,7 @@ efSymAddFile(name) for (lineNum = 1; fgets(line, sizeof line, f); lineNum++) { - if (cp = strchr(line, '\n')) + if ((cp = strchr(line, '\n'))) *cp = '\0'; if (!efSymAdd(line)) TxError("Error at line %d of %s\n", lineNum, name); @@ -161,7 +161,7 @@ efSymAdd(str) } value[-1] = '\0'; - if (he = HashLookOnly(&efSymHash, str)) + if ((he = HashLookOnly(&efSymHash, str))) { TxError("Symbol \"%s\" already defined\n", str); value[-1] = '='; diff --git a/extflat/EFvisit.c b/extflat/EFvisit.c index 285677da..335fa716 100644 --- a/extflat/EFvisit.c +++ b/extflat/EFvisit.c @@ -319,7 +319,7 @@ efVisitDevs(hc, ca) /* Visit our own devices */ HashStartSearch(&hs); - while (he = HashNext(&def->def_devs, &hs)) + while ((he = HashNext(&def->def_devs, &hs))) { dev = (Dev *)HashGetValue(he); if (efDevKilled(dev, hc->hc_hierName)) @@ -624,7 +624,7 @@ EFVisitCaps(capProc, cdata) EFCapValue cap; HashStartSearch(&hs); - while (he = HashNext(&efCapHashTable, &hs)) + while ((he = HashNext(&efCapHashTable, &hs))) { cap = CapHashGetValue(he); ck = (EFCoupleKey *) he->h_key.h_words; @@ -878,7 +878,7 @@ EFHNOut(hierName, outf) trimLocal = (EFOutputFlags & EF_TRIMLOCAL); convComma = (EFOutputFlags & EF_CONVERTCOMMA); convBrackets = (EFOutputFlags & EF_CONVERTBRACKETS); - while (c = *cp++) + while ((c = *cp++)) { if (*cp) { @@ -914,7 +914,7 @@ efHNOutPrefix(hierName, outf) efHNOutPrefix(hierName->hn_parent, outf); cp = hierName->hn_name; - while (c = *cp++) + while ((c = *cp++)) putc(c, outf); putc('/', outf); } diff --git a/graphics/grTCairo1.c b/graphics/grTCairo1.c index 30cb777a..bdb2bff3 100644 --- a/graphics/grTCairo1.c +++ b/graphics/grTCairo1.c @@ -1090,7 +1090,7 @@ char *name; WindSeparateRedisplay(w); sprintf(windowname, ".magic%d", WindowNumber + 1); - if (windowplace = XGetDefault(grXdpy, "magic", windowname)) + if ((windowplace = XGetDefault(grXdpy, "magic", windowname))) { XParseGeometry(windowplace, &x, &y, (unsigned int *)&width, (unsigned int *)&height); @@ -1106,7 +1106,7 @@ char *name; grAttributes.background_pixel = WhitePixel(grXdpy, grXscrn); grAttributes.border_pixel = BlackPixel(grXdpy, grXscrn); - if (tktop = Tk_MainWindow(magicinterp)) + if ((tktop = Tk_MainWindow(magicinterp))) { if (!WindowNumber) { @@ -1490,7 +1490,7 @@ char *text; XSetClassHint( grXdpy, wind, &class); if (text) { - if (brack = strchr(text, '[')) + if ((brack = strchr(text, '['))) { brack--; *brack = 0; @@ -1499,7 +1499,7 @@ char *text; *brack = ' '; return; } - if (brack = strrchr(text, ' ')) text = brack + 1; + if ((brack = strrchr(text, ' '))) text = brack + 1; XSetIconName(grXdpy, wind, text); XStoreName(grXdpy, wind, text); } diff --git a/graphics/grTCairo5.c b/graphics/grTCairo5.c index 2f1de6eb..1774f657 100644 --- a/graphics/grTCairo5.c +++ b/graphics/grTCairo5.c @@ -199,7 +199,7 @@ int cursorNum; /* The cursor number as defined in the display tcairoCurrent.cursor = grCursors[cursorNum]; HashStartSearch(&hs); - while (entry = HashNext(&grTCairoWindowTable, &hs)) + while ((entry = HashNext(&grTCairoWindowTable, &hs))) { if (HashGetValue(entry)) { diff --git a/graphics/grTOGL1.c b/graphics/grTOGL1.c index 6b1522ee..400878b8 100644 --- a/graphics/grTOGL1.c +++ b/graphics/grTOGL1.c @@ -1092,7 +1092,7 @@ GrTOGLCreate(w, name) WindSeparateRedisplay(w); sprintf(windowname, ".magic%d", WindowNumber + 1); - if (windowplace = XGetDefault(grXdpy, "magic", windowname)) + if ((windowplace = XGetDefault(grXdpy, "magic", windowname))) { XParseGeometry(windowplace,&x,&y, (unsigned int *)&width,(unsigned int *)&height); @@ -1108,7 +1108,7 @@ GrTOGLCreate(w, name) grAttributes.background_pixel = WhitePixel(grXdpy,grXscrn); grAttributes.border_pixel = BlackPixel(grXdpy,grXscrn); - if (tktop = Tk_MainWindow(magicinterp)) + if ((tktop = Tk_MainWindow(magicinterp))) { if (!WindowNumber) { @@ -1539,7 +1539,7 @@ GrTOGLIconUpdate(w,text) /* See Blt code */ XSetClassHint( grXdpy, wind, &class); if (text) { - if (brack = strchr(text,'[')) + if ((brack = strchr(text,'['))) { brack--; *brack = 0; @@ -1548,7 +1548,7 @@ GrTOGLIconUpdate(w,text) /* See Blt code */ *brack = ' '; return; } - if (brack = strrchr(text,' ')) text = brack+1; + if ((brack = strrchr(text,' '))) text = brack+1; XSetIconName(grXdpy,wind,text); XStoreName(grXdpy,wind,text); } diff --git a/graphics/grTOGL5.c b/graphics/grTOGL5.c index ffe271f8..8aadcbba 100644 --- a/graphics/grTOGL5.c +++ b/graphics/grTOGL5.c @@ -198,7 +198,7 @@ GrTOGLSetCursor(cursorNum) toglCurrent.cursor = grCursors[cursorNum]; HashStartSearch(&hs); - while (entry = HashNext(&grTOGLWindowTable,&hs)) + while ((entry = HashNext(&grTOGLWindowTable,&hs))) { if (HashGetValue(entry)) { diff --git a/graphics/grTk1.c b/graphics/grTk1.c index 3f080055..ea31b786 100644 --- a/graphics/grTk1.c +++ b/graphics/grTk1.c @@ -1322,7 +1322,7 @@ GrTkCreate(w, name) WindSeparateRedisplay(w); sprintf(windowname, ".magic%d", WindowNumber + 1); - if (windowplace = XGetDefault(grXdpy, "magic", windowname)) + if ((windowplace = XGetDefault(grXdpy, "magic", windowname))) { XParseGeometry(windowplace,&x,&y, (unsigned int *)&width,(unsigned int *)&height); @@ -1339,7 +1339,7 @@ GrTkCreate(w, name) if(grClass == 3) grDepth = 8; /* Needed since grDisplay.depth is reset to 7 if Pseudocolor */ - if (tktop = Tk_MainWindow(magicinterp)) + if ((tktop = Tk_MainWindow(magicinterp))) { if (!WindowNumber) { @@ -1754,7 +1754,7 @@ GrTkIconUpdate(w, text) /* See Blt code */ class.res_class = "magic"; XSetClassHint( grXdpy, wind, &class); - if (brack = strchr(text,'[')) + if ((brack = strchr(text,'['))) { brack--; *brack = 0; @@ -1763,7 +1763,7 @@ GrTkIconUpdate(w, text) /* See Blt code */ *brack = ' '; return; } - if (brack = strrchr(text,' ')) text = brack+1; + if ((brack = strrchr(text,' '))) text = brack+1; XSetIconName(grXdpy,wind,text); XStoreName(grXdpy,wind,text); } diff --git a/graphics/grTk5.c b/graphics/grTk5.c index fa4b155e..beda86f5 100644 --- a/graphics/grTk5.c +++ b/graphics/grTk5.c @@ -174,7 +174,7 @@ GrTkSetCursor(cursorNum) grCurrent.cursor = grCursors[cursorNum]; HashStartSearch(&hs); - while (entry = HashNext(&grTkWindowTable,&hs)) + while ((entry = HashNext(&grTkWindowTable,&hs))) { if (HashGetValue(entry)) { From 76d8c8c911093e573abfc0dd9c098bfc00f142fc Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:21:15 +0100 Subject: [PATCH 168/206] 35 x warning: suggest parentheses around assignment used as truth value PlowRules1.c:439:9: warning: suggest parentheses around assignment used as truth value PlowTech.c:645:17: warning: suggest parentheses around assignment used as truth value PlowTech.c:652:17: warning: suggest parentheses around assignment used as truth value PlowTech.c:1019:17: warning: suggest parentheses around assignment used as truth value ResReadSim.c:270:13: warning: suggest parentheses around assignment used as truth value ResReadSim.c:871:9: warning: suggest parentheses around assignment used as truth value ResRex.c:1840:17: warning: suggest parentheses around assignment used as truth value getrect.c:72:9: warning: suggest parentheses around assignment used as truth value getrect.c:79:9: warning: suggest parentheses around assignment used as truth value getrect.c:86:9: warning: suggest parentheses around assignment used as truth value getrect.c:93:9: warning: suggest parentheses around assignment used as truth value hash.c:732:16: warning: suggest parentheses around assignment used as truth value heap.c:328:17: warning: suggest parentheses around assignment used as truth value heap.c:344:17: warning: suggest parentheses around assignment used as truth value netlist.c:323:17: warning: suggest parentheses around assignment used as truth value niceabort.c:121:9: warning: suggest parentheses around assignment used as truth value path.c:1102:12: warning: suggest parentheses around assignment used as truth value pathvisit.c:245:13: warning: suggest parentheses around assignment used as truth value pathvisit.c:295:17: warning: suggest parentheses around assignment used as truth value tech.c:656:17: warning: suggest parentheses around assignment used as truth value ext2spice.c:1591:16: warning: suggest parentheses around assignment used as truth value ext2spice.c:1622:16: warning: suggest parentheses around assignment used as truth value ext2spice.c:1813:12: warning: suggest parentheses around assignment used as truth value ext2spice.c:1862:12: warning: suggest parentheses around assignment used as truth value ext2spice.c:3808:16: warning: suggest parentheses around assignment used as truth value CalmaRdio.c:437:9: warning: suggest parentheses around assignment used as truth value CalmaWrite.c:396:9: warning: suggest parentheses around assignment used as truth value CalmaWrite.c:1772:29: warning: suggest parentheses around assignment used as truth value CalmaWriteZ.c:372:9: warning: suggest parentheses around assignment used as truth value CalmaWriteZ.c:1608:29: warning: suggest parentheses around assignment used as truth value CIFrdtech.c:209:9: warning: suggest parentheses around assignment used as truth value CIFrdtech.c:214:9: warning: suggest parentheses around assignment used as truth value CIFrdtech.c:220:9: warning: suggest parentheses around assignment used as truth value CIFrdtech.c:226:9: warning: suggest parentheses around assignment used as truth value CIFrdutils.c:1258:12: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- calma/CalmaRdio.c | 2 +- calma/CalmaWrite.c | 4 ++-- calma/CalmaWriteZ.c | 4 ++-- cif/CIFrdtech.c | 8 ++++---- cif/CIFrdutils.c | 2 +- ext2spice/ext2spice.c | 10 +++++----- plow/PlowRules1.c | 2 +- plow/PlowTech.c | 6 +++--- resis/ResReadSim.c | 4 ++-- resis/ResRex.c | 2 +- utils/getrect.c | 8 ++++---- utils/hash.c | 2 +- utils/heap.c | 4 ++-- utils/netlist.c | 2 +- utils/niceabort.c | 2 +- utils/path.c | 2 +- utils/pathvisit.c | 4 ++-- utils/tech.c | 2 +- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/calma/CalmaRdio.c b/calma/CalmaRdio.c index f51d5dd3..c6d07661 100644 --- a/calma/CalmaRdio.c +++ b/calma/CalmaRdio.c @@ -434,7 +434,7 @@ calmaReadR8(pd) /* Extract the sign and exponent */ exponent = dchars[0]; - if (isneg = (exponent & 0x80)) + if ((isneg = (exponent & 0x80))) exponent &= ~0x80; exponent -= 64; diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index 44ea65a2..7853148e 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -393,7 +393,7 @@ CalmaWrite(rootDef, f) good = !ferror(f); /* See if any problems occurred */ - if (problems = (DBWFeedbackCount - oldCount)) + if ((problems = (DBWFeedbackCount - oldCount))) TxPrintf("%d problems occurred. See feedback entries.\n", problems); /* @@ -1769,7 +1769,7 @@ calmaOutStructName(type, def, f) } /* Is the def name a legal Calma name? */ - for (cp = def->cd_name; c = (unsigned char) *cp; cp++) + for (cp = def->cd_name; (c = (unsigned char) *cp); cp++) { if ((c > 127) || (table[c] == 0)) goto bad; diff --git a/calma/CalmaWriteZ.c b/calma/CalmaWriteZ.c index 16e717df..d5687189 100644 --- a/calma/CalmaWriteZ.c +++ b/calma/CalmaWriteZ.c @@ -369,7 +369,7 @@ CalmaWriteZ(rootDef, f) good = (nerr == 0) ? TRUE : FALSE; /* See if any problems occurred */ - if (problems = (DBWFeedbackCount - oldCount)) + if ((problems = (DBWFeedbackCount - oldCount))) TxPrintf("%d problems occurred. See feedback entries.\n", problems); /* @@ -1605,7 +1605,7 @@ calmaOutStructNameZ(type, def, f) } /* Is the def name a legal Calma name? */ - for (cp = def->cd_name; c = (unsigned char) *cp; cp++) + for (cp = def->cd_name; (c = (unsigned char) *cp); cp++) { if ((c > 127) || (table[c] == 0)) goto bad; diff --git a/cif/CIFrdtech.c b/cif/CIFrdtech.c index 70c6dc99..271ee1b3 100644 --- a/cif/CIFrdtech.c +++ b/cif/CIFrdtech.c @@ -206,24 +206,24 @@ CIFCalmaLayerToCifLayer(layer, datatype, calmaStyle) clt.clt_layer = layer; clt.clt_type = datatype; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* Try wildcarding the datatype */ clt.clt_type = -1; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* Try wildcarding the layer */ clt.clt_layer = -1; clt.clt_type = datatype; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* Try wildcarding them both, for a default value */ clt.clt_layer = -1; clt.clt_type = -1; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* No luck */ diff --git a/cif/CIFrdutils.c b/cif/CIFrdutils.c index 53695ef5..5a46f71c 100644 --- a/cif/CIFrdutils.c +++ b/cif/CIFrdutils.c @@ -1253,7 +1253,7 @@ CIFCleanPath(pathHead) if (!path) return; } - while (next = path->cifp_next) + while ((next = path->cifp_next)) { if ((dir2 = CIFEdgeDirection(path, next)) == CIF_ZERO) { diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 09cef4ee..45cc93be 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -1588,7 +1588,7 @@ subcktVisit(use, hierName, is_top) /* generated during topVisit(). */ HashStartSearch(&hs); - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { sname = (EFNodeName *) HashGetValue(he); if (sname == NULL) continue; @@ -1619,7 +1619,7 @@ subcktVisit(use, hierName, is_top) nodeList[portidx] = (EFNodeName *)NULL; HashStartSearch(&hs); - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { sname = (EFNodeName *) HashGetValue(he); if (sname == NULL) continue; @@ -1810,7 +1810,7 @@ topVisit(def, doStub) HashStartSearch(&hs); portmax = -1; - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { sname = (EFNodeName *) HashGetValue(he); if (sname == NULL) continue; @@ -1859,7 +1859,7 @@ topVisit(def, doStub) sorted_ports[portorder] = NULL; HashStartSearch(&hs); - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { char stmp[MAX_STR_SIZE]; int portidx; @@ -3805,7 +3805,7 @@ EFHNSprintf(str, hierName) convertComma = (EFOutputFlags & EF_CONVERTCOMMA); convertEqual = (EFOutputFlags & EF_CONVERTEQUAL); convertBrackets = (EFOutputFlags & EF_CONVERTBRACKETS); - while (c = *cp++) + while ((c = *cp++)) { switch (c) { diff --git a/plow/PlowRules1.c b/plow/PlowRules1.c index 4e0ba98c..0dfb8fdb 100644 --- a/plow/PlowRules1.c +++ b/plow/PlowRules1.c @@ -436,7 +436,7 @@ plowPenumbraRule(impactedEdge, ar) int newsep, oldsep, newx; oldsep = impactedEdge->e_x - movingEdge->e_x; - if (pr = ar->ar_rule) + if ((pr = ar->ar_rule)) { if (!TTMaskHasType(&pr->pr_oktypes, impactedEdge->e_ltype)) return (0); diff --git a/plow/PlowTech.c b/plow/PlowTech.c index 4ec3d936..7ebabe89 100644 --- a/plow/PlowTech.c +++ b/plow/PlowTech.c @@ -642,14 +642,14 @@ PlowDRCFinal() plowMaxDist[i] = 0; for (j = 0; j < DBNumTypes; j++) { - if (pr = plowWidthRulesTbl[i][j]) + if ((pr = plowWidthRulesTbl[i][j])) { pr = plowWidthRulesTbl[i][j] = plowTechOptimizeRule(pr); for ( ; pr; pr = pr->pr_next) if (pr->pr_dist > plowMaxDist[i]) plowMaxDist[i] = pr->pr_dist; } - if (pr = plowSpacingRulesTbl[i][j]) + if ((pr = plowSpacingRulesTbl[i][j])) { pr = plowSpacingRulesTbl[i][j] = plowTechOptimizeRule(pr); for ( ; pr; pr = pr->pr_next) @@ -1016,7 +1016,7 @@ plowTechShowTable(table, header, f) fprintf(f, "\n\n------------ %s ------------\n", header); for (i = 0; i < DBNumTypes; i++) for (j = 0; j < DBNumTypes; j++) - if (pr = table[i][j]) + if ((pr = table[i][j])) { fprintf(f, "\n%s -- %s:\n", DBTypeLongName(i), DBTypeLongName(j)); diff --git a/resis/ResReadSim.c b/resis/ResReadSim.c index d3668896..0671fdda 100644 --- a/resis/ResReadSim.c +++ b/resis/ResReadSim.c @@ -267,7 +267,7 @@ ResReadNode(nodefile) node->rs_bbox.r_xtop = atoi(line[NODE_BBOX_UR_X]); node->rs_bbox.r_ytop = atoi(line[NODE_BBOX_UR_Y]); #endif - if (cp = strchr(line[NODES_NODETYPE], ';')) *cp = '\0'; + if ((cp = strchr(line[NODES_NODETYPE], ';'))) *cp = '\0'; node->type = DBTechNameType(line[NODES_NODETYPE]); if (node->type == -1) @@ -868,7 +868,7 @@ ResSimAttribute(aname, avalue, rootname, readextfile) } } #endif - if (avalue = strchr(avalue, ',')) + if ((avalue = strchr(avalue, ','))) { ResSimAttribute(aname, avalue + 1, rootname, readextfile); } diff --git a/resis/ResRex.c b/resis/ResRex.c index 521d5e5e..a2fe3a97 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -1837,7 +1837,7 @@ ResWriteExtFile(celldef, node, rctol, nidx, eidx) } for (ptr = node->firstDev; ptr != NULL; ptr=ptr->nextDev) { - if (layoutDev = ResGetDevice(&ptr->thisDev->location, ptr->thisDev->rs_ttype)) + if ((layoutDev = ResGetDevice(&ptr->thisDev->location, ptr->thisDev->rs_ttype))) { ResFixUpConnections(ptr->thisDev, layoutDev, node, newname); } diff --git a/utils/getrect.c b/utils/getrect.c index f5a572a0..e7c73134 100644 --- a/utils/getrect.c +++ b/utils/getrect.c @@ -69,28 +69,28 @@ GetRect(fin, skip, rect, scalen, scaled) while (skip-- > 0) (void) FGETC(fin); - if (isNegative = ((c = FGETC(fin)) == '-')) c = FGETC(fin); + if ((isNegative = ((c = FGETC(fin)) == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_xbot = isNegative ? -n : n; if (!isspace(c)) goto bad; while ((c = FGETC(fin)) != EOF && isspace(c)) /* Nothing */; - if (isNegative = (c == '-')) c = FGETC(fin); + if ((isNegative = (c == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_ybot = isNegative ? -n : n; if (!isspace(c)) goto bad; while ((c = FGETC(fin)) != EOF && isspace(c)) /* Nothing */; - if (isNegative = (c == '-')) c = FGETC(fin); + if ((isNegative = (c == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_xtop = isNegative ? -n : n; if (!isspace(c)) goto bad; while ((c = FGETC(fin)) != EOF && isspace(c)) /* Nothing */; - if (isNegative = (c == '-')) c = FGETC(fin); + if ((isNegative = (c == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_ytop = isNegative ? -n : n; diff --git a/utils/hash.c b/utils/hash.c index 93f62419..2460a48f 100644 --- a/utils/hash.c +++ b/utils/hash.c @@ -729,7 +729,7 @@ HashTable *table; void *p; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) { + while ((he = HashNext(table, &hs))) { p = HashGetValue(he); freeMagic(p); } diff --git a/utils/heap.c b/utils/heap.c index 69b85c9d..09900d74 100644 --- a/utils/heap.c +++ b/utils/heap.c @@ -325,7 +325,7 @@ heapify(heap, root) while (1) { if ((x = heapLeft(used, root)) == 0) break; - if (r = heapRight(used, root)) + if ((r = heapRight(used, root))) KEY_LESS_COND(keyType, list, x, r, x = r); KEY_LE_COND(keyType, list, x, root, return); @@ -341,7 +341,7 @@ heapify(heap, root) while (1) { if ((x = heapLeft(used, root)) == 0) break; - if (r = heapRight(used, root)) + if ((r = heapRight(used, root))) KEY_GREATER_COND(keyType, list, x, r, x = r); KEY_GE_COND(keyType, list, x, root, return); *list = list[root]; diff --git a/utils/netlist.c b/utils/netlist.c index 5256621c..3a903dcf 100644 --- a/utils/netlist.c +++ b/utils/netlist.c @@ -320,7 +320,7 @@ NLSort(netList, netHeap) /* Find bounding box around all terminals in this net */ nterms = 0; for (term = net->nnet_terms; term; term = term->nterm_next) - if (loc = term->nterm_locs) + if ((loc = term->nterm_locs)) { for ( ; loc; loc = loc->nloc_next) { diff --git a/utils/niceabort.c b/utils/niceabort.c index 8533f800..19a38736 100644 --- a/utils/niceabort.c +++ b/utils/niceabort.c @@ -118,7 +118,7 @@ DumpCore() * to place the crash dump. */ - if (crashFile = PaOpen(CRASHDIR, "r", "", ".", "", &crashDir)) + if ((crashFile = PaOpen(CRASHDIR, "r", "", ".", "", &crashDir))) { (void) fclose(crashFile); diff --git a/utils/path.c b/utils/path.c index 71431dac..3a0fea80 100644 --- a/utils/path.c +++ b/utils/path.c @@ -1099,7 +1099,7 @@ PaEnum(path, file, proc, cdata) { char component[MAXSIZE], *next; - while (next = nextName(&path, file, component, sizeof component)) + while ((next = nextName(&path, file, component, sizeof component))) if (next[0] && (*proc)(next, cdata)) return (1); diff --git a/utils/pathvisit.c b/utils/pathvisit.c index d9b87f78..606272e7 100644 --- a/utils/pathvisit.c +++ b/utils/pathvisit.c @@ -242,7 +242,7 @@ paVisitFilesProc(name, pv) } } *lp = '\0'; - if (code = paVisitProcess(lp = line, pv)) + if ((code = paVisitProcess(lp = line, pv))) break; next: ; } @@ -292,7 +292,7 @@ paVisitProcess(line, pv) for (pvc = pv->pv_first; pvc; pvc = pvc->pvc_next) if (len > 0 && strncmp(line, pvc->pvc_keyword, len) == 0) - if (code = (*pvc->pvc_proc)(line, pvc->pvc_cdata)) + if ((code = (*pvc->pvc_proc)(line, pvc->pvc_cdata))) break; return (code); diff --git a/utils/tech.c b/utils/tech.c index f0d9bf06..20fbcbb6 100644 --- a/utils/tech.c +++ b/utils/tech.c @@ -651,7 +651,7 @@ TechLoad(filename, initmask) skip = TRUE; continue; } - if (mask = (tsp->ts_prevSects & ~techSectionMask)) + if ((mask = (tsp->ts_prevSects & ~techSectionMask))) { techSection *sp; From a6e1596ba6abe839270704039465050ea20378bf Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:23:02 +0100 Subject: [PATCH 169/206] 22 x warning: suggest parentheses around assignment used as truth value lefTech.c:107:16: warning: suggest parentheses around assignment used as truth value lefTech.c:160:16: warning: suggest parentheses around assignment used as truth value lefTech.c:426:16: warning: suggest parentheses around assignment used as truth value lefTech.c:453:16: warning: suggest parentheses around assignment used as truth value lefTech.c:486:16: warning: suggest parentheses around assignment used as truth value lefWrite.c:190:9: warning: suggest parentheses around assignment used as truth value lefWrite.c:303:12: warning: suggest parentheses around assignment used as truth value lefWrite.c:315:12: warning: suggest parentheses around assignment used as truth value lefWrite.c:377:16: warning: suggest parentheses around assignment used as truth value lefWrite.c:439:16: warning: suggest parentheses around assignment used as truth value lefWrite.c:1222:12: warning: suggest parentheses around assignment used as truth value lefWrite.c:2246:12: warning: suggest parentheses around assignment used as truth value defWrite.c:415:12: warning: suggest parentheses around assignment used as truth value defWrite.c:447:12: warning: suggest parentheses around assignment used as truth value defWrite.c:2039:16: warning: suggest parentheses around assignment used as truth value defWrite.c:2104:16: warning: suggest parentheses around assignment used as truth value defWrite.c:2478:16: warning: suggest parentheses around assignment used as truth value defWrite.c:2498:20: warning: suggest parentheses around assignment used as truth value defWrite.c:3066:16: warning: suggest parentheses around assignment used as truth value defWrite.c:3084:28: warning: suggest parentheses around assignment used as truth value defWrite.c:3111:28: warning: suggest parentheses around assignment used as truth value lefRead.c:651:12: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- lef/defWrite.c | 18 +++++++++--------- lef/lefRead.c | 2 +- lef/lefTech.c | 10 +++++----- lef/lefWrite.c | 14 +++++++------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lef/defWrite.c b/lef/defWrite.c index 8cfb800d..4ae81f73 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -412,7 +412,7 @@ defHNsprintf(str, hierName, divchar) /* (which are interpreted as wildcard characters by LEF/DEF). */ cp = hierName->hn_name; - while (c = *cp++) + while ((c = *cp++)) { switch (c) { @@ -444,7 +444,7 @@ char *defHNsprintfPrefix(hierName, str, divchar) str = defHNsprintfPrefix(hierName->hn_parent, str, divchar); cp = hierName->hn_name; - while (*str++ = *cp++) ; + while ((*str++ = *cp++)) ; *(--str) = divchar; return ++str; } @@ -2036,7 +2036,7 @@ defGetType(ttype, lefptr, do_vias) if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (lefl && (do_vias == FALSE) && (contact == CLASS_VIA) && @@ -2101,7 +2101,7 @@ defWriteVias(f, rootDef, oscale, lefMagicToLefLayer) cscale = CIFGetOutputScale(1); HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { int size, sep, border; char *us1, *us2; @@ -2475,7 +2475,7 @@ defWriteBlockages(f, rootDef, oscale, MagicToLefTable) if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (lefl != NULL) @@ -2495,7 +2495,7 @@ defWriteBlockages(f, rootDef, oscale, MagicToLefTable) { numblocks = 0; HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if ((lefl != NULL) && ((lefl->lefClass == CLASS_ROUTE) || @@ -3063,7 +3063,7 @@ DefWriteCell(def, outName, allSpecial, units, analRetentive) fprintf(f, "NONDEFAULTRULES %d ;\n", numrules); HashStartSearch(&hs); - while (he = HashNext(&LefNonDefaultRules, &hs)) + while ((he = HashNext(&LefNonDefaultRules, &hs))) { nrules = (LefRules *)HashGetValue(he); fprintf(f, " - %s", nrules->name); @@ -3081,7 +3081,7 @@ DefWriteCell(def, outName, allSpecial, units, analRetentive) lefLayer *lefl2; HashStartSearch(&hs2); - while (he2 = HashNext(&LefInfo, &hs2)) + while ((he2 = HashNext(&LefInfo, &hs2))) { lefl2 = (lefLayer *)HashGetValue(he2); if (lefl2->lefClass == CLASS_ROUTE) @@ -3108,7 +3108,7 @@ DefWriteCell(def, outName, allSpecial, units, analRetentive) /* Put the reference counts back to the way they were */ HashStartSearch(&hs2); - while (he2 = HashNext(&LefInfo, &hs2)) + while ((he2 = HashNext(&LefInfo, &hs2))) { lefl2 = (lefLayer *)HashGetValue(he2); if (lefl2->refCnt < 0) diff --git a/lef/lefRead.c b/lef/lefRead.c index f1206c78..e8e1ae9b 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -648,7 +648,7 @@ LefRedefined(lefl, redefname) records = 0; altName = NULL; HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { slef = (lefLayer *)HashGetValue(he); if (slef == lefl) diff --git a/lef/lefTech.c b/lef/lefTech.c index aecfa6bb..48e49ca7 100644 --- a/lef/lefTech.c +++ b/lef/lefTech.c @@ -104,7 +104,7 @@ LefTechInit() if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -157,7 +157,7 @@ lefRemoveGeneratedVias() if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -423,7 +423,7 @@ LefTechScale(scalen, scaled) if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -450,7 +450,7 @@ LefTechScale(scalen, scaled) /* Return all refCnt values to normal */ HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -483,7 +483,7 @@ LefTechSetDefaults() if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; diff --git a/lef/lefWrite.c b/lef/lefWrite.c index b88385af..024fdf2a 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -187,7 +187,7 @@ lefFileOpen(def, file, suffix, mode, prealfile) else ends++; - if (endp = strrchr(ends, '.')) + if ((endp = strrchr(ends, '.'))) { if (strcmp(endp, suffix)) { @@ -300,7 +300,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) HashStartSearch(&hs); nprops = 0; - while (he = HashNext(propTable, &hs)) + while ((he = HashNext(propTable, &hs))) { if (nprops == 0) fprintf(f, "PROPERTYDEFINITIONS\n"); nprops++; @@ -312,7 +312,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) if (nprops > 0) fprintf(f, "END PROPERTYDEFINITIONS\n\n"); HashStartSearch(&hs); - while (he = HashNext(siteTable, &hs)) + while ((he = HashNext(siteTable, &hs))) { /* Output the SITE as a macro */ CellDef *siteDef; @@ -374,7 +374,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) float oscale = CIFGetOutputScale(1000); /* lambda->micron conversion */ HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -436,7 +436,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) /* Return reference counts to normal */ HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (lefl && lefl->refCnt < 0) @@ -1219,7 +1219,7 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) TTMaskSetType(&lc.rmask, lab->lab_type); HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefLayer *lefl = (lefLayer *)HashGetValue(he); if (lefl && (lefl->lefClass == CLASS_ROUTE || lefl->lefClass == CLASS_VIA @@ -2247,7 +2247,7 @@ LefWriteAll(rootUse, writeTopCell, lefTech, lefHide, lefPinOnly, lefTopLayer, HashKill(&propHashTbl); HashKill(&siteHashTbl); - while (def = (CellDef *) StackPop(lefDefStack)) + while ((def = (CellDef *) StackPop(lefDefStack))) { def->cd_client = (ClientData) 0; if (!SigInterruptPending) From 4bfed5692439f9432eaad41802bd7e7e9fa6867a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:24:07 +0100 Subject: [PATCH 170/206] 17 x warning: suggest parentheses around assignment used as truth value gaStem.c:225:9: warning: suggest parentheses around assignment used as truth value gaStem.c:350:9: warning: suggest parentheses around assignment used as truth value grouteMain.c:363:12: warning: suggest parentheses around assignment used as truth value grouteMaze.c:573:17: warning: suggest parentheses around assignment used as truth value groutePath.c:127:13: warning: suggest parentheses around assignment used as truth value irCommand.c:901:12: warning: suggest parentheses around assignment used as truth value irCommand.c:999:12: warning: suggest parentheses around assignment used as truth value irCommand.c:1275:13: warning: suggest parentheses around assignment used as truth value irCommand.c:1375:13: warning: suggest parentheses around assignment used as truth value irCommand.c:1931:17: warning: suggest parentheses around assignment used as truth value rtrDcmpose.c:435:12: warning: suggest parentheses around assignment used as truth value rtrPin.c:174:17: warning: suggest parentheses around assignment used as truth value rtrStem.c:373:21: warning: suggest parentheses around assignment used as truth value rtrStem.c:479:9: warning: suggest parentheses around assignment used as truth value rtrStem.c:952:17: warning: suggest parentheses around assignment used as truth value gcrInit.c:239:9: warning: suggest parentheses around assignment used as truth value net2ir.c:123:13: warning: suggest parentheses around assignment used as truth value GCC14 -Wall cleanup series [-Wparentheses] --- garouter/gaStem.c | 4 ++-- gcr/gcrInit.c | 2 +- grouter/grouteMain.c | 2 +- grouter/grouteMaze.c | 2 +- grouter/groutePath.c | 2 +- irouter/irCommand.c | 10 +++++----- net2ir/net2ir.c | 2 +- router/rtrDcmpose.c | 2 +- router/rtrPin.c | 2 +- router/rtrStem.c | 6 +++--- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/garouter/gaStem.c b/garouter/gaStem.c index 9abbbd01..aa191c0e 100644 --- a/garouter/gaStem.c +++ b/garouter/gaStem.c @@ -222,7 +222,7 @@ gaStemAssign(routeUse, doWarn, loc, term, net, netList) * See if this location lies inside a river-routing channel. * If it does, return the channel containing it. */ - if (ch = gaStemContainingChannel(routeUse, doWarn, loc)) + if ((ch = gaStemContainingChannel(routeUse, doWarn, loc))) { if (ch->gcr_type != CHAN_HRIVER && ch->gcr_type != CHAN_VRIVER) goto fail; @@ -347,7 +347,7 @@ gaStemContainingChannelFunc(tile, pCh) { GCRChannel *ch; - if (ch = (GCRChannel *) tile->ti_client) + if ((ch = (GCRChannel *) tile->ti_client)) { if (*pCh) { diff --git a/gcr/gcrInit.c b/gcr/gcrInit.c index 32618449..9f47e868 100644 --- a/gcr/gcrInit.c +++ b/gcr/gcrInit.c @@ -236,7 +236,7 @@ gcrUnlinkPin(pin) { GCRNet *net; - if (net = pin->gcr_pId) + if ((net = pin->gcr_pId)) { ASSERT(pin == net->gcr_lPin, "gcrUnlinkPin"); net->gcr_lPin = pin->gcr_pNext; diff --git a/grouter/grouteMain.c b/grouter/grouteMain.c index e1dfd23d..1a673a5a 100644 --- a/grouter/grouteMain.c +++ b/grouter/grouteMain.c @@ -360,7 +360,7 @@ glProcessLoc(startList, loc, bestCost, doFast) } else glMazeShortest = FALSE; bestPt = (GlPoint *) NULL; - while (lastPt = glMazeFindPath(loc, bestCost)) + while ((lastPt = glMazeFindPath(loc, bestCost))) { adjustedPt = glCrossAdjust((GlPoint *) NULL, lastPt); if (adjustedPt->gl_cost < bestCost) diff --git a/grouter/grouteMaze.c b/grouter/grouteMaze.c index 2615adc7..50d73467 100644 --- a/grouter/grouteMaze.c +++ b/grouter/grouteMaze.c @@ -570,7 +570,7 @@ glMazeResetCost(headPage, headFree) for (gpage = headPage; gpage; gpage = gpage->glp_next) { for (n = headFree; n < gpage->glp_free; n++) - if (pin = gpage->glp_array[n].gl_pin) + if ((pin = gpage->glp_array[n].gl_pin)) { pin->gcr_cost = INFINITY; if (pin->gcr_linked) diff --git a/grouter/groutePath.c b/grouter/groutePath.c index 13e62d9e..f4dd32a9 100644 --- a/grouter/groutePath.c +++ b/grouter/groutePath.c @@ -124,7 +124,7 @@ glListToHeap(list, destPt) * to lie along that channel portion). */ pin = temp->gl_pin; - if (tp = glChanPinToTile((Tile *) NULL, pin)) + if ((tp = glChanPinToTile((Tile *) NULL, pin))) { new = glPathNew(pin, temp->gl_cost, (GlPoint *) NULL); new->gl_tile = tp; diff --git a/irouter/irCommand.c b/irouter/irCommand.c index 83ca2244..b91afa70 100644 --- a/irouter/irCommand.c +++ b/irouter/irCommand.c @@ -898,7 +898,7 @@ irContactsCmd(w, cmd) return; } - if(rC=irFindRouteContact(tileType)) + if((rC=irFindRouteContact(tileType))) { /* Print Contact Heading */ TxPrintf("%-12.12s ", "contact"); @@ -996,7 +996,7 @@ irContactsCmd(w, cmd) return; } - if(rC=irFindRouteContact(tileType)) + if((rC=irFindRouteContact(tileType))) { /* Lookup contact parameter name in table */ which = LookupStruct( @@ -1272,7 +1272,7 @@ irLayersCmd(w, cmd) return; } - if (rL=irFindRouteLayer(tileType)) + if ((rL=irFindRouteLayer(tileType))) { /* Print Route Layer Heading */ TxPrintf("%-12.12s ", "layer"); @@ -1372,7 +1372,7 @@ irLayersCmd(w, cmd) return; } - if (rL=irFindRouteLayer(tileType)) + if ((rL=irFindRouteLayer(tileType))) { /* Lookup route layer parameter name in table */ which = LookupStruct( @@ -1928,7 +1928,7 @@ irSpacingsCmd(w, cmd) return; } - if (rT=irFindRouteType(tileType)) + if ((rT=irFindRouteType(tileType))) { TxPrintf("%s: ", diff --git a/net2ir/net2ir.c b/net2ir/net2ir.c index 4410be6c..42500ea7 100644 --- a/net2ir/net2ir.c +++ b/net2ir/net2ir.c @@ -120,7 +120,7 @@ getfirst: continue; } - if (cp = strchr(line1, '\n')) + if ((cp = strchr(line1, '\n'))) *cp = '\0'; if (nterms >= 2) diff --git a/router/rtrDcmpose.c b/router/rtrDcmpose.c index b0f4e283..1161a672 100644 --- a/router/rtrDcmpose.c +++ b/router/rtrDcmpose.c @@ -432,7 +432,7 @@ rtrHashKill(ht) HashSearch hs; HashStartSearch(&hs); - while (he = HashNext(ht, &hs)) + while ((he = HashNext(ht, &hs))) GCRFreeChannel((GCRChannel *) HashGetValue(he)); HashKill(ht); } diff --git a/router/rtrPin.c b/router/rtrPin.c index 9f71d0dd..3fa77eb8 100644 --- a/router/rtrPin.c +++ b/router/rtrPin.c @@ -171,7 +171,7 @@ rtrPinArrayInit(ch, side, pins, nPins) if (side == GEO_WEST) p.p_x--; if (side == GEO_SOUTH) p.p_y--; tp = TiSrPointNoHint(RtrChannelPlane, &p); - if (adjacent = (GCRChannel *) tp->ti_client) + if ((adjacent = (GCRChannel *) tp->ti_client)) { /* Only link if entering the linked channel from a legal side */ linked = RtrPointToPin(adjacent, otherSide, &point); diff --git a/router/rtrStem.c b/router/rtrStem.c index 120b6827..90d6fe35 100644 --- a/router/rtrStem.c +++ b/router/rtrStem.c @@ -370,7 +370,7 @@ RtrStemAssignExt(use, doWarn, loc, term, net) rtrStemRange(loc, dr->dr_dir, &si); if (si.stem_dir != -1) { - if (pin = rtrStemTip(loc, &si, use)) + if ((pin = rtrStemTip(loc, &si, use))) { /* Mark the pin as taken */ pins++; @@ -476,7 +476,7 @@ rtrStemTip(loc, si, use) * Try each crossing point in the best direction, starting from the * stem_start point and working outward toward stem_lo and stem_hi. */ - if (pin = rtrStemTryPin(loc, si->stem_dir, &si->stem_start, use)) + if ((pin = rtrStemTryPin(loc, si->stem_dir, &si->stem_start, use))) return (pin); plo = phi = si->stem_start; @@ -949,7 +949,7 @@ rtrStemSearch(center, dir, point) tile = TiSrPointNoHint(RtrChannelPlane, point); if (TiGetType(tile) == TT_SPACE) { - if (ch = (GCRChannel *) tile->ti_client) + if ((ch = (GCRChannel *) tile->ti_client)) break; return ((GCRChannel *) NULL); } From 239366d4b6a8020ae5bdfa45367e8fb53f9a72b4 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:24:19 +0100 Subject: [PATCH 171/206] grTk3.c: warning: suggest parentheses around '-' in operand of '&' GCC14 -Wall cleanup series [-Wparentheses] --- graphics/grTk3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/grTk3.c b/graphics/grTk3.c index e942bc5d..0d0a1f28 100644 --- a/graphics/grTk3.c +++ b/graphics/grTk3.c @@ -244,7 +244,7 @@ GrTkReadPixel (w, x, y) image = XGetImage(grXdpy, grCurrent.windowid, x, grMagicToX(y), 1, 1, ~0, ZPixmap); value = XGetPixel(image, 0, 0); - return (value & (1 << grDisplay.depth) - 1); + return (value & ((1 << grDisplay.depth) - 1)); } From be09edb8d8c6cf5393ce1676e68c47dc510a00e1 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:24:47 +0100 Subject: [PATCH 172/206] 12 x warning: suggest parentheses around '&&' within '||' The '&' has higher precedence, so the expression of the '&' side receive extra parentheses. ResMakeRes.c:671:37: warning: suggest parentheses around '&&' within '||' ResMakeRes.c:942:32: warning: suggest parentheses around '&&' within '||' ResSimple.c:201:70: warning: suggest parentheses around '&&' within '||' ResRex.c:1036:28: warning: suggest parentheses around '&&' within '||' ResRex.c:1038:50: warning: suggest parentheses around '&&' within '||' ext2sim.c:1341:47: warning: suggest parentheses around '&&' within '||' ext2spice.c:172:44: warning: suggest parentheses around '&&' within '||' ext2spice.c:173:49: warning: suggest parentheses around '&&' within '||' ext2spice.c:3655:50: warning: suggest parentheses around '&&' within '||' ext2hier.c:1412:50: warning: suggest parentheses around '&&' within '||' gcrDebug.c:638:55: warning: suggest parentheses around '&&' within '||' selEnum.c:323:28: warning: suggest parentheses around '&&' within '||' GCC14 -Wall cleanup series [-Wparentheses] --- ext2sim/ext2sim.c | 4 ++-- ext2spice/ext2hier.c | 2 +- ext2spice/ext2spice.c | 6 +++--- gcr/gcrDebug.c | 2 +- resis/ResMakeRes.c | 12 ++++++------ resis/ResRex.c | 6 +++--- resis/ResSimple.c | 4 ++-- select/selEnum.c | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index 51861ec4..68248401 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -1338,8 +1338,8 @@ FILE *outf; suf = EFHNToStr(suffix); if (fetInfo[type].defSubs && strcasecmp(suf,fetInfo[type].defSubs) == 0) { l = strlen(suf) - 1; - if ( ( EFOutputFlags & EF_TRIMGLOB ) && suf[l] =='!' || - ( EFOutputFlags & EF_TRIMLOCAL ) && suf[l] == '#' ) + if ( (( EFOutputFlags & EF_TRIMGLOB ) && suf[l] =='!') || + (( EFOutputFlags & EF_TRIMLOCAL ) && suf[l] == '#') ) suf[l] = '\0' ; if ( esFormat == SU ) fprintf(outf, "S_"); diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index 543d3dbf..42d6786d 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -1409,7 +1409,7 @@ spcnodeHierVisit(hc, node, res, cap) hierName = (HierName *) node->efnode_name->efnn_hier; nsn = nodeSpiceHierName(hc, hierName); - if (esFormat == SPICE2 || esFormat == HSPICE && !strncmp(nsn, "z@", 2)) { + if (esFormat == SPICE2 || (esFormat == HSPICE && !strncmp(nsn, "z@", 2))) { static char ntmp[MAX_STR_SIZE]; EFHNSprintf(ntmp, hierName); diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 45cc93be..d9d56954 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -169,8 +169,8 @@ esFormatSubs(outf, suf) if (outf) { l = strlen(suf) - 1; - if ((EFOutputFlags & EF_TRIMGLOB ) && suf[l] == '!' || - (EFOutputFlags & EF_TRIMLOCAL) && suf[l] == '#') + if (((EFOutputFlags & EF_TRIMGLOB ) && suf[l] == '!') || + ((EFOutputFlags & EF_TRIMLOCAL) && suf[l] == '#')) suf[l] = '\0' ; if (EFOutputFlags & EF_CONVERTCOMMA) while ((specchar = strchr(suf, ',')) != NULL) @@ -3652,7 +3652,7 @@ spcnodeVisit(node, res, cap) hierName = (HierName *) node->efnode_name->efnn_hier; nsn = nodeSpiceName(hierName, NULL); - if (esFormat == SPICE2 || esFormat == HSPICE && strncmp(nsn, "z@", 2)==0 ) { + if (esFormat == SPICE2 || (esFormat == HSPICE && strncmp(nsn, "z@", 2)==0 )) { static char ntmp[MAX_STR_SIZE]; EFHNSprintf(ntmp, hierName); diff --git a/gcr/gcrDebug.c b/gcr/gcrDebug.c index de233897..146b2ff9 100644 --- a/gcr/gcrDebug.c +++ b/gcr/gcrDebug.c @@ -635,7 +635,7 @@ void gcrPrintCol(ch, i, showResult) } else TxPrintf("#"); } - else if ((res[i][j] & GCRU) || j != 0 && (res[i][j-1] & GCRU)) + else if ((res[i][j] & GCRU) || (j != 0 && (res[i][j-1] & GCRU))) { if((res[i][j]&GCRCC) && (!(res[i][j]&(GCRBLKM|GCRBLKP)))) { diff --git a/resis/ResMakeRes.c b/resis/ResMakeRes.c index 4feeeb07..5a5ff1ad 100644 --- a/resis/ResMakeRes.c +++ b/resis/ResMakeRes.c @@ -667,11 +667,11 @@ ResCalcNearDevice(tile, pendingList, doneList, resList) /* 2. There are devices along two sides at right angles, */ /* and the tile is wider than it is tall. */ - if ((devedge & TOPEDGE) && (devedge & BOTTOMEDGE) && - !(devedge & LEFTEDGE) && !(devedge & RIGHTEDGE) || - (devedge & TOPEDGE || devedge & BOTTOMEDGE) && + if (((devedge & TOPEDGE) && (devedge & BOTTOMEDGE) && + !(devedge & LEFTEDGE) && !(devedge & RIGHTEDGE)) || + ((devedge & TOPEDGE || devedge & BOTTOMEDGE) && (devedge & LEFTEDGE || devedge & RIGHTEDGE) && - (RIGHT(tile) - LEFT(tile)) > (TOP(tile) - BOTTOM(tile))) + (RIGHT(tile) - LEFT(tile)) > (TOP(tile) - BOTTOM(tile)))) { /* re-sort nodes south to north. */ ResSortBreaks(&junk->breakList, FALSE); @@ -939,8 +939,8 @@ ResSortBreaks(masterlist, xsort) p3 = p2->br_next; while (p3 != NULL) { - if (xsort == TRUE && p2->br_loc.p_x > p3->br_loc.p_x || - xsort == FALSE && p2->br_loc.p_y > p3->br_loc.p_y) + if ((xsort == TRUE && p2->br_loc.p_x > p3->br_loc.p_x) || + (xsort == FALSE && p2->br_loc.p_y > p3->br_loc.p_y)) { changed = TRUE; if (p1 == NULL) diff --git a/resis/ResRex.c b/resis/ResRex.c index a2fe3a97..3c5749eb 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -1033,9 +1033,9 @@ ResCheckSimNodes(celldef, resisdata) ResFHFile = NULL; } - if (ResExtFile == NULL && (ResOptionsFlags & ResOpt_DoExtFile) - || (ResOptionsFlags & ResOpt_DoLumpFile) && ResLumpFile == NULL - || (ResOptionsFlags & ResOpt_FastHenry) && ResFHFile == NULL) + if ((ResExtFile == NULL && (ResOptionsFlags & ResOpt_DoExtFile)) + || ((ResOptionsFlags & ResOpt_DoLumpFile) && ResLumpFile == NULL) + || ((ResOptionsFlags & ResOpt_FastHenry) && ResFHFile == NULL)) { TxError("Couldn't open output file\n"); return; diff --git a/resis/ResSimple.c b/resis/ResSimple.c index b0f7aae9..3e87d673 100644 --- a/resis/ResSimple.c +++ b/resis/ResSimple.c @@ -198,8 +198,8 @@ ResSimplifyNet(nodelist, biglist, reslist, tolerance) * Break loop here. More than one driver indicates a loop; * remove deadend, allowing drivers to be merged */ - else if (UnMarkedReceivers == 0 && (MarkedReceivers == 1 && - NumberOfDrivers > 1 || resistor2 != resistor1)) + else if (UnMarkedReceivers == 0 && ((MarkedReceivers == 1 && + NumberOfDrivers > 1) || resistor2 != resistor1)) { otherNode->rn_float.rn_area += resistor1->rr_float.rr_area; diff --git a/select/selEnum.c b/select/selEnum.c index b59b0964..8cb6e7ec 100644 --- a/select/selEnum.c +++ b/select/selEnum.c @@ -320,8 +320,8 @@ selEnumPFunc2(tile, arg) /* Also okay if the X over Y yields a stacking type whose residues */ /* are X and Y. */ - if ((ttype != seltype) && (((ttype == TT_SPACE) && - TTMaskHasType(&DBHomePlaneTypes[arg->sea_plane], seltype))) || + if (((ttype != seltype) && (((ttype == TT_SPACE) && + TTMaskHasType(&DBHomePlaneTypes[arg->sea_plane], seltype)))) || (DBPaintResultTbl[arg->sea_plane][ttype][seltype] != seltype)) { TileType chktype = DBPaintResultTbl[arg->sea_plane][ttype][seltype]; From 04bc9032b92bd2ab90431b51d483c61d34c0f69e Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:24:56 +0100 Subject: [PATCH 173/206] plotPNM.c:521:5: warning: statement with no effect GCC14 -Wall cleanup series [-Wunused-value] --- plot/plotPNM.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plot/plotPNM.c b/plot/plotPNM.c index 6d6cdf59..b382e850 100644 --- a/plot/plotPNM.c +++ b/plot/plotPNM.c @@ -518,7 +518,7 @@ pnmTile (tile, cxp) col = PaintStyles[type].color; t = rtile + x + ds_xsize * y; - for (dy; dy > 0; dy--) + for ( ; dy > 0; dy--) { for (j = 0; j < dx; j++) { From c1aeaa9be5721fe8a08adeebd362c82e94883823 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:29:12 +0100 Subject: [PATCH 174/206] DRCtech.c:4141:21: warning: suggest parentheses around comparison in operand of '==' the expression (a == b == 1) works out like: a, b = result (XNOR) 0, 0 = 1 0, 1 = 0 1, 0 = 0 1, 1 = 1 GCC14 -Wall cleanup series [-Wparentheses] --- drc/DRCtech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drc/DRCtech.c b/drc/DRCtech.c index 44d20f5c..7311de94 100644 --- a/drc/DRCtech.c +++ b/drc/DRCtech.c @@ -4138,7 +4138,7 @@ DRCTechScale(scalen, scaled) int scalegcf; if (DRCCurStyle == NULL) return; - else if (scalen == scaled == 1) return; + else if (scalen == scaled) return; /* Revert DRC rules to original (unscaled) values */ drcScaleUp(DRCCurStyle, DRCCurStyle->DRCScaleFactorN); From 59bfe8f6c01d2f504ba0bc031e86ef4a8af77b23 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:37:46 +0100 Subject: [PATCH 175/206] DBcellsrch.c:2249:22: warning: too many arguments in call to 'dbMovePlane' clang18 default warning cleanup --- database/DBcellsrch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index a8e946c5..c4d91492 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -2241,7 +2241,7 @@ DBMoveCell(cellDef, origx, origy) newplane = DBNewPlane((ClientData) TT_SPACE); DBClearPaintPlane(newplane); if (dbMovePlane(cellDef->cd_planes[pNum], newplane, pNum, - origx, origy, FALSE)) + origx, origy)) cellDef->cd_flags |= (CDMODIFIED | CDGETNEWSTAMP); DBFreePaintPlane(cellDef->cd_planes[pNum]); TiFreePlane(cellDef->cd_planes[pNum]); From b723dc15d82752a5ff1e3e300e3e4ea0299f8788 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:40:24 +0100 Subject: [PATCH 176/206] DBio.c:1604:65: warning: too many arguments in call to 'dbReadOpen' DBio.c:1604:52: warning: expression which evaluates to zero treated as a null pointer constant of type 'int *' [-Wnon-literal-null-conversion] DBOpenOnly() function only has one use which always passed name==NULL. clang18 default warning cleanup --- database/DBio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBio.c b/database/DBio.c index 9848e9ac..dd54d8f4 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -1598,7 +1598,7 @@ DBOpenOnly(cellDef, name, setFileName, errptr) */ int *errptr; /* Pointer to int to hold error value */ { - dbReadOpen(cellDef, name != NULL, setFileName, FALSE, errptr); + dbReadOpen(cellDef, setFileName, FALSE, errptr); } /* From f734e2758760c3eea7c006af3810ad5682c706e1 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:42:01 +0100 Subject: [PATCH 177/206] selOps.c:1000:70: warning: too many arguments in call to 'selShortFindForward' Unclear if there is a programming intention here that hasn't been implemented. clang18 default warning cleanup --- select/selOps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select/selOps.c b/select/selOps.c index 1d1663c5..422a5582 100644 --- a/select/selOps.c +++ b/select/selOps.c @@ -997,7 +997,7 @@ SelectShort(char *lab1, char *lab2) } } - selShortFindForward(srctile, srctype, srcpnum, desttile, desttype); + selShortFindForward(srctile, srctype, srcpnum, desttile/*, desttype*/); /* Now see if destination has been counted */ if (desttile->ti_client == (ClientData)CLIENTDEFAULT) return NULL; From ef48e40f397f4b39114a76a85cf9ae27f8eb76c6 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:42:06 +0100 Subject: [PATCH 178/206] lefRead.c:1334:63: warning: too few arguments in call to 'LefPaintPolygon' When keep!=FALSE a malloc list is returned, so this looks like a memory leak. clang18 default warning cleanup --- lef/lefRead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lef/lefRead.c b/lef/lefRead.c index e8e1ae9b..992c1d1a 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -1331,7 +1331,7 @@ LefReadGeometry(lefMacro, f, oscale, do_list, is_imported) rectList = rectNew; if ((!do_list) && (otherlayer != -1)) - LefPaintPolygon(lefMacro, pointList, points, otherlayer); + LefPaintPolygon(lefMacro, pointList, points, otherlayer, FALSE); } freeMagic(pointList); } From 4460c5f1f5c93a14aafd66c39988f97829bf878f Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:49:38 +0100 Subject: [PATCH 179/206] DBio.c: warning: 'sscanf' may overflow; destination buffer in argument ... DBio.c:2358:21: warning: 'sscanf' may overflow; destination buffer in argument 4 has size 2048, but the corresponding specifier may require size 2049 clang18 default warning cleanup [-Wfortify-source] --- database/DBio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/DBio.c b/database/DBio.c index dd54d8f4..e5c8c40b 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -2315,7 +2315,7 @@ dbReadProperties(cellDef, line, len, f, scalen, scaled) int scalen; /* Scale up by this factor */ int scaled; /* Scale down by this factor */ { - char propertyname[128], propertyvalue[2048], *storedvalue; + char propertyname[128], propertyvalue[2049], *storedvalue; char *pvalueptr; int ntok; unsigned int noeditflag; From ade50dfc88650c0d9ae489e26f375fb8f99cb3d0 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:51:35 +0100 Subject: [PATCH 180/206] irRoute.c: warning: expression which evaluates to zero treated as a null pointer ... Use of FALSE instead of NULL on a pointer type. irRoute.c:1101:19: warning: expression which evaluates to zero treated as a null pointer constant of type 'RouteContact *' (aka 'struct routecontact *') clang18 default warning cleanup [-Wnon-literal-null-conversion] --- irouter/irRoute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irouter/irRoute.c b/irouter/irRoute.c index 8d7e9b9e..dca74a31 100644 --- a/irouter/irRoute.c +++ b/irouter/irRoute.c @@ -1098,7 +1098,7 @@ irChooseEndPtLayers(routeUse,expansionMask,endPt,argLayers,endPtName) } TxPrintf("\n"); - for(pickedRC=FALSE,l=presentContacts; l && !pickedRC; l=LIST_TAIL(l)) + for(pickedRC=NULL,l=presentContacts; l && !pickedRC; l=LIST_TAIL(l)) { rC = (RouteContact *) LIST_FIRST(l); if (!LIST_TAIL(l) && !presentLayers) From 165f1b35b4ce22c903d2d4feae8ad2de869284d7 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:54:24 +0100 Subject: [PATCH 181/206] ExtBasic.c: warning: incompatible pointer types passing 'NodeRegion *' ... The NodeRegion is an extended form of LabRegion (which is smaller) and has the same layout. So we cast into the smaller type. ExtBasic.c:1025:31: warning: incompatible pointer types passing 'NodeRegion *' (aka 'struct nreg *') to parameter of type 'LabRegion *' (aka 'struct lreg *') ExtBasic.c:2291:29: warning: incompatible pointer types passing 'NodeRegion *' (aka 'struct nreg *') to parameter of type 'LabRegion *' (aka 'struct lreg *') ExtBasic.c:2335:46: warning: incompatible pointer types passing 'NodeRegion *' (aka 'struct nreg *') to parameter of type 'LabRegion *' (aka 'struct lreg *') ExtBasic.c:2339:47: warning: incompatible pointer types passing 'NodeRegion *' (aka 'struct nreg *') to parameter of type 'LabRegion *' (aka 'struct lreg *') clang18 default warning cleanup [-Wincompatible-pointer-types] --- extract/ExtBasic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 8ab90e68..4ac2c3fb 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -1022,7 +1022,7 @@ extFindDuplicateLabels(def, nreg) { r.r_ll = r.r_ur = ll2->ll_label->lab_rect.r_ll; r.r_xbot--, r.r_ybot--, r.r_xtop++, r.r_ytop++; - extMakeNodeNumPrint(name, np2); + extMakeNodeNumPrint(name, (LabRegion *)np2); (void) sprintf(message, badmesg, text, name); DBWFeedbackAdd(&r, message, def, 1, STYLE_PALEHIGHLIGHTS); @@ -2288,7 +2288,7 @@ extOutputDevices(def, transList, outFile) if (!TTMaskIsZero(&devptr->exts_deviceSubstrateTypes) && (subsNode = extTransRec.tr_subsnode)) { - subsName = extNodeName(subsNode); + subsName = extNodeName((LabRegion *)subsNode); } #ifdef MAGIC_WRAPPER @@ -2332,11 +2332,11 @@ extOutputDevices(def, transList, outFile) /* gate */ node = (NodeRegion *)extGetRegion(reg->treg_tile); - fprintf(outFile, "\"%s\" ", extNodeName(node)); + fprintf(outFile, "\"%s\" ", extNodeName((LabRegion *)node)); /* First non-gate terminal */ node = (NodeRegion *)extTransRec.tr_termnode[0]; - fprintf(outFile, "\"%s\"\n", extNodeName(node)); + fprintf(outFile, "\"%s\"\n", extNodeName((LabRegion *)node)); continue; } From 8f2acb83f94a82fbb9fdac5d015ce8672928591c Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:57:20 +0100 Subject: [PATCH 182/206] plotHP.c: warning: incompatible pointer types passing 'int *' to ... Perform pointer arithmatic with (int *) first then cast just for calling function. plotHP.c:335:25: warning: incompatible pointer types passing 'int *' to parameter of type 'unsigned char *' plotHP.c:339:25: warning: incompatible pointer types passing 'int *' to parameter of type 'unsigned char *' plotHP.c:343:25: warning: incompatible pointer types passing 'int *' to parameter of type 'unsigned char *' clang18 default warning cleanup [-Wincompatible-pointer-types] --- plot/plotHP.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plot/plotHP.c b/plot/plotHP.c index 76e08bab..e2c6de54 100644 --- a/plot/plotHP.c +++ b/plot/plotHP.c @@ -332,15 +332,15 @@ PlotDumpHPRTL(hpfile, kRaster, cRaster, mRaster, yRaster) /* Compress each plane (C, M, and Y) and output */ - size = PlotRTLCompress(c - ipl, obytes, bpl); + size = PlotRTLCompress((unsigned char *)(c - ipl), obytes, bpl); fprintf(hpfile, "\033*b%dV", size); fwrite(obytes, size, 1, hpfile); - size = PlotRTLCompress(m - ipl, obytes, bpl); + size = PlotRTLCompress((unsigned char *)(m - ipl), obytes, bpl); fprintf(hpfile, "\033*b%dV", size); fwrite(obytes, size, 1, hpfile); - size = PlotRTLCompress(y - ipl, obytes, bpl); + size = PlotRTLCompress((unsigned char *)(y - ipl), obytes, bpl); fprintf(hpfile, "\033*b%dW", size); fwrite(obytes, size, 1, hpfile); } From 9ca869765947ba7cc4fc25edac64dc7d8a350dd0 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 18:59:39 +0100 Subject: [PATCH 183/206] strings.h: add #include required when strict Due to use of strcasecmp() or similar C API. Maybe HAVE_STRINGS_H is needed ? If so which platforms needs this ? clang18 default warning cleanup (strict) --- calma/CalmaWrite.c | 1 + calma/CalmaWriteZ.c | 1 + commands/CmdCD.c | 1 + commands/CmdRS.c | 1 + database/DBlabel.c | 1 + ext2sim/ext2sim.c | 1 + ext2spice/ext2spice.c | 1 + extflat/EFbuild.c | 1 + extract/ExtTech.c | 1 + lef/lefCmd.c | 1 + lef/lefRead.c | 1 + netmenu/NMnetlist.c | 1 + resis/ResRex.c | 1 + utils/macros.c | 1 + utils/main.c | 1 + 15 files changed, 15 insertions(+) diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index 7853148e..b90c6d6f 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/c #include #include /* for random() */ #include +#include #include #include #include /* for htons() */ diff --git a/calma/CalmaWriteZ.c b/calma/CalmaWriteZ.c index d5687189..cb6a01a2 100644 --- a/calma/CalmaWriteZ.c +++ b/calma/CalmaWriteZ.c @@ -34,6 +34,7 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/c #include #include /* for random() */ #include +#include #include #include #include /* for htons() */ diff --git a/commands/CmdCD.c b/commands/CmdCD.c index edd80361..a1f78aec 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -23,6 +23,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include "tcltk/tclmagic.h" #include "utils/magic.h" diff --git a/commands/CmdRS.c b/commands/CmdRS.c index d2a4c6a2..41a66744 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -23,6 +23,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include diff --git a/database/DBlabel.c b/database/DBlabel.c index eb8001fc..388c9da6 100644 --- a/database/DBlabel.c +++ b/database/DBlabel.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include /* For sin(), cos(), and round() functions */ #include diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index 68248401..1008cfab 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -19,6 +19,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include /* for atof() */ #include +#include #include #include /* for sqrt() in bipolar L,W calculation */ diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index d9d56954..06d06900 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -20,6 +20,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include /* for atof() */ #include +#include #include #include /* for fabs() */ diff --git a/extflat/EFbuild.c b/extflat/EFbuild.c index e1688680..902058d7 100644 --- a/extflat/EFbuild.c +++ b/extflat/EFbuild.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$"; #include #include /* for atof() */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" diff --git a/extract/ExtTech.c b/extract/ExtTech.c index 36adeaa2..bf5c4756 100644 --- a/extract/ExtTech.c +++ b/extract/ExtTech.c @@ -25,6 +25,7 @@ static char sccsid[] = "@(#)ExtTech.c 4.8 MAGIC (Berkeley) 10/26/85"; #include #include /* for strtod() */ #include +#include #include #include /* for isspace() */ diff --git a/lef/lefCmd.c b/lef/lefCmd.c index 3ae84132..94650f68 100644 --- a/lef/lefCmd.c +++ b/lef/lefCmd.c @@ -12,6 +12,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include "tcltk/tclmagic.h" diff --git a/lef/lefRead.c b/lef/lefRead.c index 992c1d1a..de347c11 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -21,6 +21,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include #include diff --git a/netmenu/NMnetlist.c b/netmenu/NMnetlist.c index 0cd505a5..26072dd0 100644 --- a/netmenu/NMnetlist.c +++ b/netmenu/NMnetlist.c @@ -23,6 +23,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include +#include #include "utils/magic.h" #include "utils/utils.h" diff --git a/resis/ResRex.c b/resis/ResRex.c index 3c5749eb..83d2f920 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -6,6 +6,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include #include diff --git a/utils/macros.c b/utils/macros.c index 8f683ac2..4d351dd8 100644 --- a/utils/macros.c +++ b/utils/macros.c @@ -22,6 +22,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include +#include #include #include #ifdef XLIB diff --git a/utils/main.c b/utils/main.c index 8865e65b..f1aa9d84 100644 --- a/utils/main.c +++ b/utils/main.c @@ -25,6 +25,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include From fc49b40c52a96c719d6d53691972f5847551b1d8 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:02:16 +0100 Subject: [PATCH 184/206] netlist.c: etext symbol for __clang__ clang does this differently, this method mirrors the linux man page. clang18 default warning cleanup (strict) --- utils/netlist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/netlist.c b/utils/netlist.c index 3a903dcf..af01e081 100644 --- a/utils/netlist.c +++ b/utils/netlist.c @@ -369,6 +369,8 @@ NLNetName(net) static char tempId[100]; #if defined(EMSCRIPTEN) int etext; +#elif defined(linux) && defined(__clang__) + extern char etext; #elif defined(linux) || defined(CYGWIN) extern int etext asm("etext"); #elif defined(__APPLE__) From 489de7fdb4f646204c073dc819fa770ace687262 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:36:02 +0100 Subject: [PATCH 185/206] CmdCD.c: 'option' is used uninitialized CmdCD.c:3693:14: warning: variable 'option' is used uninitialized whenever 'if' condition is false CmdCD.c:3691:9: warning: variable 'option' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- commands/CmdCD.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/CmdCD.c b/commands/CmdCD.c index a1f78aec..77a083d0 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -3684,7 +3684,7 @@ CmdCrash(w, cmd) MagWindow *w; TxCommand *cmd; { - int option; + int option = -1; char *filename = NULL; static char *cmdCrashOpt[] = {"save", "recover", 0}; From cbf97f77ee9dca1034d6bc0a471e7ef5d6843704 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:38:09 +0100 Subject: [PATCH 186/206] DRCcif.c: 'thislayer' is used uninitialized DRCcif.c:1193:17: warning: variable 'thislayer' is used uninitialized whenever 'for' loop exits because its condition is false DRCcif.c:1255:17: warning: variable 'thislayer' is used uninitialized whenever 'for' loop exits because its condition is false clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- drc/DRCcif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drc/DRCcif.c b/drc/DRCcif.c index d597ec57..54a359f3 100644 --- a/drc/DRCcif.c +++ b/drc/DRCcif.c @@ -1184,7 +1184,7 @@ drcCifArea(argc, argv) DRCCookie *dpnext, *dpnew; TileType i, j; int plane; - int thislayer; + int thislayer = -1; int scalefactor; if (drcCifStyle == NULL) @@ -1246,7 +1246,7 @@ drcCifMaxwidth(argc, argv) TileType i, j; int plane; int bend; - int thislayer; + int thislayer = -1; int scalefactor; if (drcCifStyle == NULL) From 4380310e5b2004dcd4ab851003a9f09d419bfea7 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:38:28 +0100 Subject: [PATCH 187/206] EFvisit.c: warning: misleading indentation; I think the warning is bringing to attention the hidden fall-thru case situation. EFvisit.c:897:50: warning: misleading indentation; statement is not part of the previous 'if' clang18 -Wall warning cleanup [-Wmisleading-indentation] --- extflat/EFvisit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/extflat/EFvisit.c b/extflat/EFvisit.c index 335fa716..a57356a8 100644 --- a/extflat/EFvisit.c +++ b/extflat/EFvisit.c @@ -894,9 +894,16 @@ EFHNOut(hierName, outf) } else switch (c) { - case '!': if (!trimGlob) (void) putc(c, outf); break; - case '#': if (trimLocal) break; - default: (void) putc(c, outf); break; + case '!': + if (!trimGlob) + (void) putc(c, outf); + break; + case '#': + if (trimLocal) + break; + default: + (void) putc(c, outf); + break; } } } From 7feb298f7adfc14c2e6f98d471c338c95dd1da95 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:39:45 +0100 Subject: [PATCH 188/206] ExtBasic.c: warning: variable ... is used uninitialized whenever ExtBasic.c:408:7: warning: variable 'urx' is used uninitialized whenever '||' condition is true ExtBasic.c:417:7: warning: variable 'ury' is used uninitialized whenever '||' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- extract/ExtBasic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 4ac2c3fb..903b5866 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -408,8 +408,10 @@ extBasic(def, outFile) if ((token == NULL) || (sscanf(token, "%d", &urx) != 1)) propfound = FALSE; else + { urx *= ExtCurStyle->exts_unitsPerLambda; - if (urx <= llx) urx++; + if (urx <= llx) urx++; + } } if (propfound) { @@ -417,8 +419,10 @@ extBasic(def, outFile) if ((token == NULL) || (sscanf(token, "%d", &ury) != 1)) propfound = FALSE; else + { ury *= ExtCurStyle->exts_unitsPerLambda; - if (ury <= lly) ury++; + if (ury <= lly) ury++; + } } if (propfound) { From 4520112a559ffd85d3e320db303bf3a1ca297c9d Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:41:17 +0100 Subject: [PATCH 189/206] grTk3.c: warning: variable 'font' is used uninitialized grTk3.c:203:5: warning: variable 'font' is used uninitialized whenever switch default is taken clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- graphics/grTk3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/grTk3.c b/graphics/grTk3.c index 0d0a1f28..889ef98d 100644 --- a/graphics/grTk3.c +++ b/graphics/grTk3.c @@ -201,6 +201,7 @@ GrTkTextSize(text, size, r) font = grXLargeFont; break; default: + font = NULL; TxError("%s%d\n", "GrTkTextSize: Unknown character size ", size ); break; From 4206ed2436631e38f32b93e3adccf4decb31c53a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:43:43 +0100 Subject: [PATCH 190/206] grTOGL3.c: warning: variable 'font' is used uninitialized grTOGL3.c:230:5: warning: variable 'font' is used uninitialized whenever switch default is taken clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- graphics/grTOGL3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/grTOGL3.c b/graphics/grTOGL3.c index 192a30df..3414f3a4 100644 --- a/graphics/grTOGL3.c +++ b/graphics/grTOGL3.c @@ -228,6 +228,7 @@ GrTOGLTextSize(text, size, r) font = grXLargeFont; break; default: + font = NULL; TxError("%s%d\n", "GrTOGLTextSize: Unknown character size ", size ); break; From 3919cc5b63bf0dd535ff5c01b84703fb3db62f8b Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:44:40 +0100 Subject: [PATCH 191/206] PlowRandom.c: warning: variable 'f2' is used uninitialized PlowRandom.c:301:9: warning: variable 'f2' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- plow/PlowRandom.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plow/PlowRandom.c b/plow/PlowRandom.c index f77b4f22..89afa018 100644 --- a/plow/PlowRandom.c +++ b/plow/PlowRandom.c @@ -294,7 +294,7 @@ plowFileDiff(file1, file2) char *file2; { char b1[BUFSIZ], b2[BUFSIZ]; - int f1, f2; + int f1 = -1, f2 = -1; int n1, n2; bool ret = FALSE; @@ -310,7 +310,9 @@ plowFileDiff(file1, file2) ret = TRUE; done: - (void) close(f1); - (void) close(f2); + if (f1 >= 0) + (void) close(f1); + if (f2 >= 0) + (void) close(f2); return (ret); } From fa3a01c486d73315d616a620104e755d663bb425 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:45:07 +0100 Subject: [PATCH 192/206] selOps.c: warning: variable 'type' is used uninitialized selOps.c:1942:11: warning: variable 'type' is used uninitialized whenever 'if' condition is false clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- select/selOps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/select/selOps.c b/select/selOps.c index 422a5582..f620e15d 100644 --- a/select/selOps.c +++ b/select/selOps.c @@ -1942,6 +1942,8 @@ selStretchFillFunc3(tile, area) else if (selStretchY < 0) type = (SplitDirection(tile) ? SplitLeftType(tile) : SplitRightType(tile)); + else + type = TT_SPACE; if (type == TT_SPACE) return 0; /* nothing to stretch */ } else From 817efbbccc4137dedcf71195c0a49b278a93dd83 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:45:52 +0100 Subject: [PATCH 193/206] txCommands.c: warning: variable ... is used uninitialized whenever Maybe ASSERT are not always active, so defensive coding solution. txCommands.c:883:6: warning: variable 'but' is used uninitialized whenever switch default is taken txCommands.c:888:6: warning: variable 'act' is used uninitialized whenever switch default is taken clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- textio/txCommands.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/textio/txCommands.c b/textio/txCommands.c index 32b1c5ee..dbf82652 100644 --- a/textio/txCommands.c +++ b/textio/txCommands.c @@ -880,15 +880,16 @@ txLogCommand(cmd) case TX_LEFT_BUTTON: { but = 0; break; }; case TX_MIDDLE_BUTTON: { but = 1; break; }; case TX_RIGHT_BUTTON: { but = 2; break; }; - default: {ASSERT(FALSE, "txLogCommand"); break; }; + default: {ASSERT(FALSE, "txLogCommand"); but = -1; break; }; } switch(cmd->tx_buttonAction) { case TX_BUTTON_DOWN: { act = 0; break; }; case TX_BUTTON_UP: { act = 1; break; }; - default: {ASSERT(FALSE, "txLogCommand"); break; }; + default: {ASSERT(FALSE, "txLogCommand"); act = -1; break; }; } - fprintf(txLogFile, "%spushbutton %s %s\n", + if (but >= 0 && act >= 0) + fprintf(txLogFile, "%spushbutton %s %s\n", pfix, txButTable[but], txActTable[act]); } if (txLogFlags & TX_LOG_UPDATE) From ea41b21f67a13aaa44ce6f7dc7c4eb116a4c1d6a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:48:41 +0100 Subject: [PATCH 194/206] macros.c: warning: variable 'kc' is used uninitialized macros.c:557:12: warning: variable 'kc' is used uninitialized whenever 'if' condition is false clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- utils/macros.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/macros.c b/utils/macros.c index 4d351dd8..6195698c 100644 --- a/utils/macros.c +++ b/utils/macros.c @@ -556,6 +556,8 @@ MacroKey(str, verbose) kc = (int)tc; else if (kmod & ControlMask) kc = (int)(tc - 'A' + 1); + else + kc = (int)tc; if (!(kmod & (Mod1Mask | LockMask))) if (!(kmod & ShiftMask) || !(kmod & ControlMask)) From 2f22ec6293dece046e53dd4b67312b84661a3176 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:51:08 +0100 Subject: [PATCH 195/206] set.c: warning: variable 'result' is used uninitialized set.c:124:9: warning: variable 'result' is used uninitialized whenever 'if' condition is false clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- utils/set.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/utils/set.c b/utils/set.c index f82d8fd2..8c0637bd 100644 --- a/utils/set.c +++ b/utils/set.c @@ -101,7 +101,7 @@ SetNoisyBool(parm,valueS,file) char *valueS; FILE *file; { - int n, which, result; + int n, which, result = -2; /* Bool string Table */ static struct @@ -145,15 +145,19 @@ SetNoisyBool(parm,valueS,file) } else { - TxError("Unrecognized boolean value: \"%s\"\n", valueS); - TxError("Valid values are: "); - for (n = 0; boolStrings[n].bS_name; n++) - TxError(" %s", boolStrings[n].bS_name); - TxError("\n"); result = -2; } } + if (result == -2) + { + TxError("Unrecognized boolean value: \"%s\"\n", valueS); + TxError("Valid values are: "); + for (n = 0; boolStrings[n].bS_name; n++) + TxError(" %s", boolStrings[n].bS_name); + TxError("\n"); + } + /* Print parm value */ if(file) fprintf(file,"%8.8s ", *parm ? "YES" : "NO"); From 2b06c8cee56cf323f108e1e489787b5fdfa593eb Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:52:52 +0100 Subject: [PATCH 196/206] CalmaRdcl.c: warning: variable 'rtype' is used uninitialized FEOF condition of PEEKRH causes variable to possibly not get initialized before use. CalmaRdcl.c:372:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- calma/CalmaRdcl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index ab93664b..c5e014b0 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -351,7 +351,7 @@ calmaParseStructure(filename) char *filename; /* Name of the GDS file read */ { static int structs[] = { CALMA_STRCLASS, CALMA_STRTYPE, -1 }; - int nbytes, rtype, nsrefs, osrefs, npaths; + int nbytes = -1, rtype = 0, nsrefs, osrefs, npaths; char *strname = NULL; HashEntry *he; int timestampval = 0; From fece689c436903c4f96e6557d01180b754b3eb7a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:55:22 +0100 Subject: [PATCH 197/206] CalmaRdpt.c: warning: variable 'rtype' is used uninitialized CalmaRdpt.c:525:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true CalmaRdpt.c:792:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- calma/CalmaRdpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 146f3276..0b4cf92d 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -503,7 +503,7 @@ calmaElementBox() void calmaElementPath() { - int nbytes, rtype, extend1, extend2; + int nbytes = -1, rtype = 0, extend1, extend2; int layer, dt, width, pathtype, ciftype, savescale; int xmin, ymin, xmax, ymax, temp; CIFPath *pathheadp, *pathp, *previousp; @@ -733,7 +733,7 @@ calmaElementText() { static int ignore[] = { CALMA_PATHTYPE, CALMA_WIDTH, -1 }; char *textbody = NULL; - int nbytes, rtype; + int nbytes = -1, rtype = 0; int layer, textt, cifnum, textpres; TileType type; Rect r; From fca0c2945d87f7ee7f0a745d74783edc8917287e Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:56:12 +0100 Subject: [PATCH 198/206] CalmaWrite.c: warning: variable 'rtype' is used uninitialized CalmaWrite.c:442:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- calma/CalmaWrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index b90c6d6f..6809b98d 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -430,7 +430,7 @@ calmaDumpStructure(def, outf, calmaDefHash, filename) HashTable *calmaDefHash; char *filename; { - int nbytes, rtype; + int nbytes = -1, rtype = 0; char *strname = NULL, *newnameptr; HashEntry *he, *he2; CellDef *edef; From 60e78f4ab4d45a1983083702cbb4afb09b213348 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:57:15 +0100 Subject: [PATCH 199/206] CalmaWriteZ.c: warning: variable 'rtype' is used uninitialized CalmaWriteZ.c:418:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- calma/CalmaWriteZ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calma/CalmaWriteZ.c b/calma/CalmaWriteZ.c index cb6a01a2..80d0dbdb 100644 --- a/calma/CalmaWriteZ.c +++ b/calma/CalmaWriteZ.c @@ -406,7 +406,7 @@ calmaDumpStructureZ(def, outf, calmaDefHash, filename) HashTable *calmaDefHash; char *filename; { - int nbytes, rtype; + int nbytes = -1, rtype = 0; char *strname = NULL, *newnameptr; HashEntry *he, *he2; CellDef *edef; From 1bb6a7f6c538952b92fce424d8e015703e855147 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:57:57 +0100 Subject: [PATCH 200/206] plotPNM.c: warning: variable 'strip' is used uninitialized The compiler warning concerns the use of 'goto done;' has cleanup that accesses 'strip' before initialization. While evaluating this I also notice the other 2 variables 'rtile' and 'lkstep' are globals, but their pointers are not invalidated at the time of free. plotPNM.c:821:6: warning: variable 'strip' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- plot/plotPNM.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plot/plotPNM.c b/plot/plotPNM.c index b382e850..be620121 100644 --- a/plot/plotPNM.c +++ b/plot/plotPNM.c @@ -582,7 +582,7 @@ PlotPNM(fileName, scx, layers, xMask, width) int i, x, y, tile_ydelta; int save_ds, iter; int scale_over_2, ds_over_2; - float *strip; + float *strip = NULL; float scale, invscale, scaledown, normal; #ifdef VERSATEC @@ -937,8 +937,10 @@ PlotPNM(fileName, scx, layers, xMask, width) done: PlotPNMdownsample = save_ds; freeMagic(rtile); + rtile = NULL; freeMagic(strip); freeMagic(lkstep); + lkstep = NULL; return; } From 35604400edf5a354319f0266d66041bd53e45117 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:59:00 +0100 Subject: [PATCH 201/206] irRoute.c: warning: variable '...' is used uninitialized "shouldn't happen" but if it did. irRoute.c:594:2: warning: variable 'startPt' is used uninitialized whenever switch default is taken irRoute.c:719:2: warning: variable 'destRect' is used uninitialized whenever switch default is taken clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- irouter/irRoute.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/irouter/irRoute.c b/irouter/irRoute.c index dca74a31..96a96e3b 100644 --- a/irouter/irRoute.c +++ b/irouter/irRoute.c @@ -595,6 +595,7 @@ irGetStartPoint(startType, argStartPt, argStartLabel, startLayerPtr, routeUse) /* shouldn't happen */ { ASSERT(FALSE,"irGetStartPoint"); + goto abort; } break; } @@ -720,6 +721,7 @@ irGetDestRect(destType, argDestRect, argDestLabel, destLayerPtr, routeUse) /* shouldn't happen */ { ASSERT(FALSE,"irGetDestRect"); + goto abort; } break; } From 7fd116c828ed01c44faf7b6897f8afd442a3977c Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:59:55 +0100 Subject: [PATCH 202/206] tclmagic.c: warning: variable 'arg0' is used uninitialized tclmagic.c:448:9: warning: variable 'arg0' is used uninitialized whenever 'if' condition is false clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- tcltk/tclmagic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcltk/tclmagic.c b/tcltk/tclmagic.c index 9c92bf55..4408fc16 100644 --- a/tcltk/tclmagic.c +++ b/tcltk/tclmagic.c @@ -445,6 +445,8 @@ _tk_dispatch(ClientData clientData, char *arg0; Point txp; + arg0 = argv[0]; + if (GrWindowIdPtr) { /* Key macros set the point from the graphics module code but */ @@ -466,7 +468,6 @@ _tk_dispatch(ClientData clientData, txp.p_y = 20; } TxSetPoint(txp.p_x, txp.p_y, id); - arg0 = argv[0]; argc--; argv++; } From 38c14a0ad9b2446f94f0a7d45f5ba45a0a3bd2f8 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 20:02:23 +0100 Subject: [PATCH 203/206] gaMain.c: warning: variable 'errs' is used uninitialized gaMain.c:287:9: warning: variable 'errs' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- garouter/gaMain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/garouter/gaMain.c b/garouter/gaMain.c index 42e2c833..07c9bc4d 100644 --- a/garouter/gaMain.c +++ b/garouter/gaMain.c @@ -262,7 +262,7 @@ GARouteCmd(routeUse, netListName) CellUse *routeUse; char *netListName; { - int errs; + int errs = -1; NLNetList netList; GCRChannel *ch; NLNet *net; From d5ef80acda8376f65c62cda9bf5b63ba31c8012b Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 20:03:49 +0100 Subject: [PATCH 204/206] gaStem.c: warning: variable '...' is used uninitialized An error return indication was added, as there as no other way to abort execution but indicate to caller the data was not filled in. No call sites have been modified to check the error return as the assertion is still in place and expects to catch this unexpected scenario. gaStem.c:914:2: warning: variable 'start' is used uninitialized whenever switch default is taken gaStem.c:914:2: warning: variable 'min' is used uninitialized whenever switch default is taken gaStem.c:914:2: warning: variable 'max' is used uninitialized whenever switch default is taken clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- garouter/gaStem.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/garouter/gaStem.c b/garouter/gaStem.c index aa191c0e..cd58da3d 100644 --- a/garouter/gaStem.c +++ b/garouter/gaStem.c @@ -84,7 +84,7 @@ int gaNumSimplePaint, gaNumMazePaint, gaNumExtPaint; /* Forward declarations */ int gaStemContainingChannelFunc(); bool gaStemAssign(); -void gaStemGridRange(); +int gaStemGridRange(); void gaStemPaint(); bool gaStemNetClear(); bool gaStemInternalFunc(); @@ -869,7 +869,7 @@ gaStemNetClear(termArea, point, side, netList) * of 'r'. * * Results: - * None. + * 0 on success, -1 on error (no side effects). * * Side effects: * Sets *pMinGrid, *pMaxGrid, and *pStart. @@ -877,7 +877,7 @@ gaStemNetClear(termArea, point, side, netList) * ---------------------------------------------------------------------------- */ -void +int gaStemGridRange(type, r, pMinGrid, pMaxGrid, pStart) int type; Rect *r; @@ -914,7 +914,7 @@ gaStemGridRange(type, r, pMinGrid, pMaxGrid, pStart) default: { ASSERT(FALSE, "Bad channel type in gaStemGridRange"); - break; + return -1; } } max = MAX(max, start); @@ -922,6 +922,7 @@ gaStemGridRange(type, r, pMinGrid, pMaxGrid, pStart) *pMaxGrid = max; *pMinGrid = min; *pStart = start; + return 0; } /* From 95d3e9f85d75daa5d402d70a2e7b9bf965eaee70 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 20:05:44 +0100 Subject: [PATCH 205/206] CalmaRead.c: warning: variable 'libnameptr' is used uninitialized The local variable 'libnameptr' is used from the 'goto done;' label cleanup but it may not be initiailzied at the time of the first use of the label. When evaluating this I also notice the global 'calmaErrorFile' when closed does not have the handle invalidated. CalmaRead.c:233:9: warning: variable 'libnameptr' is used uninitialized whenever 'if' condition is true CalmaRead.c:231:9: warning: variable 'libnameptr' is used uninitialized whenever 'if' condition is true CalmaRead.c:225:9: warning: variable 'libnameptr' is used uninitialized whenever 'if' condition is true clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- calma/CalmaRead.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/calma/CalmaRead.c b/calma/CalmaRead.c index 08b0c0b6..04919c02 100644 --- a/calma/CalmaRead.c +++ b/calma/CalmaRead.c @@ -172,7 +172,7 @@ CalmaReadFile(file, filename) char *filename; /* The real name of the file read */ { int k, version; - char *libname = NULL, *libnameptr; + char *libname = NULL, *libnameptr = NULL; MagWindow *mw; static int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS, CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE, @@ -309,7 +309,11 @@ done: HashKill(&calmaDefInitHash); UndoEnable(); - if (calmaErrorFile != NULL) fclose(calmaErrorFile); + if (calmaErrorFile != NULL) + { + fclose(calmaErrorFile); + calmaErrorFile = NULL; + } } /* From d0eb5349a57f8478a9045b50980c0976ec3482c8 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 9 Oct 2024 21:38:03 -0400 Subject: [PATCH 206/206] Updated the version to go along with a bunch of pull request merges from syntax and error cleanup work done by Darryl Miles (thanks, Darryl!). --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0f06d4df..8b3ac721 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.495 +8.3.496