Commit Graph

33 Commits

Author SHA1 Message Date
Darryl L. Miles d55a2b74ac header file #ifndef guard namespace consistency (global change)
This add an effective namespace prefix to the guard ifndef
2025-07-29 10:50:32 -04:00
Darryl L. Miles 8b7e0aaec6 Makefile: whitespace only change 2025-07-29 10:50:32 -04:00
Darryl L. Miles 046401cbd8 Use HAVE_SYS_TIME_H and TIME_WITH_SYS_TIME from autoconf where possible 2025-07-27 12:43:04 -04:00
Darryl L. Miles fd50bc1f4d TiJoin[XY]1 API introduction at all call sites 2025-07-27 12:42:05 -04:00
Darryl L. Miles 9e181f0d2e rtrTravers.c: missing const
This is to remove the constness warning.
2025-07-26 17:38:19 -04:00
Darryl L. Miles 606f37cc80 Ti[GS]etClient() usage enforcement
All naked access to `ti_client` now uses the function-like-macro
to encapsulate this action.  This macro existed before this just
makes all sites utilize it.

Added additional INT and PTR variants to remove the programmer
load on thinking about casing and casts polluting the point
of use.  So the use now looks cleaner.

Equivalent prototypes:

 void TiSetClient(Tile*, ClientData)
 void TiSetClientINT(Tile*, intptr_t) /* pointertype */
 void TiSetClientPTR(Tile*, void*)

 ClientData TiGetClient(Tile*)
 intptr_t TiGetClientINT(Tile*) /* pointertype */
 void *TiGetClientPTR(Tile*)
2025-04-09 14:55:58 -04:00
Darryl L. Miles c33b6be2bb CodeQL MemoryMayNotBeFreed.ql rtrChannel.c RtrChannelRoute()
Unclear with all the flip operations if there is some kind of attachment
(exchange of channels), the other 2 channels created in the function
are also cleaned up.
2025-02-22 21:35:23 -05:00
Darryl L. Miles cb9333804a CodeQL MemoryMayNotBeFreed.ql rtrCmd.c CmdRoute()
temporary channel created to run command is not cleaned up
2025-02-22 21:35:23 -05:00
Darryl L. Miles 6a537c4659 CodeQL IncorrectNotOperatorUsage.ql rtrDcmppose.c rtrCLEAR() usages
Maybe it was a single bit and '!' operator inverted a single bit, but it
 appears to be a 4-bit mask today.

TODO check rtrMARKED() this looks like it uses '&' operator is in use
 but from the context of a bitmask maybe this should be '|' operator.
2025-02-22 21:31:22 -05:00
Darryl L. Miles e88dcba1c5 CodeQL File{MayNot,Never}BeClosed.ql file-handle resource leaks
Guided by CodeQL static code analyser.

FileMayNotBeClosed.ql
FileMayNeverBeClosed.ql

The trick with "if(fp != stdout)" is problematic (to analyser) as
technically 'stdout' can be a global pointer that COULD be modified any
time, so it might have changed between the fopen() and fclose() calls so
the close MAY NEVER occurs (which is problem the analyzer can see).

So local state is maintained as a bool which will also clarify to the
compiler see the intention without concern for external stdout
modification.

Some items appear to be out and out leaks when certain commands are use.
2025-02-22 21:02:49 -05:00
Darryl L. Miles 07f9bbe1fb gcc11 -Wall -Wpedantic cleanup 2025-01-06 16:12:11 +00:00
Darryl L. Miles 661b66a143 TCL9: Tcl_InitStubs(version="9.0") 2025-01-04 11:08:01 -05:00
Darryl L. Miles 0ce8265570 TCL9: ClientData macro assignment and access usage 2025-01-04 11:08:01 -05:00
Darryl L. Miles 79f2ab0f4b TCL9: ClientData macro header file changes
Header files documentation indicates the macros are of type ClientData
but previously did not cast to ensure that. So now follow this intention.
2025-01-04 11:08:01 -05:00
Darryl L. Miles 3dbcb0759e Lookup() constify call-site
plow/PlowCmd.c: Lookup() constify call-site
plot/plotVers.c: Lookup() constify call-site
plot/plotMain.c: Lookup() constify call-site
plot/plotCmd.c: Lookup() constify call-site
netmenu/NMnetlist.c: Lookup() constify call-site
netmenu/NMcmdLZ.c: Lookup() constify call-site
netmenu/NMcmdAK.c: Lookup() constify call-site
lef/lefTech.c: Lookup() constify call-site
lef/lefCmd.c: Lookup() constify call-site
irouter/irRoute.c: Lookup() constify call-site
irouter/irCommand.c: Lookup() constify call-site
router/rtrCmd.c: Lookup() constify call-site
resis/ResRex.c: Lookup() constify call-site
gcr/gcrShwFlgs.c: Lookup() constify call-site
windows/windCmdSZ.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles 14b6453707 LookupStruct() constify call-site
irouter/irTestCmd.c: LookupStruct() constify call-site
irouter/irCommand.c: LookupStruct() constify call-site
mzrouter/mzTestCmd.c: LookupStruct() constify call-site
mzrouter/mzTech.c: LookupStruct() constify call-site
router/rtrCmd.c: LookupStruct() constify call-site
plow/PlowTest.c: LookupStruct() constify call-site
plow/PlowTech.c: LookupStruct() constify call-site
plot/plotVers.c: LookupStruct() constify call-site
grouter/grouteTest.c: LookupStruct() constify call-site
garouter/gaTest.c: LookupStruct() constify call-site
extract/ExtTest.c: LookupStruct() constify call-site
extract/ExtTech.c: LookupStruct() constify call-site
extflat/EFread.c: LookupStruct() constify call-site
DRCtech.c: LookupStruct() constify call-site
debugFlags.c: LookupStruct() constify call-site
CmdSubrs.c: LookupStruct() constify call-site
geometry.c: LookupStruct() constify call-site
set.c: LookupStruct() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles 4bfed56924 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]
2024-10-09 21:12:55 -04:00
Darryl L. Miles 967b41343b GCC14: warning: missing braces around initializer
GCC14 -Wall cleanup series [-Wmissing-braces]
2024-10-09 21:12:55 -04:00
Darryl L. Miles c749d01eb7 rtrStem.c: fix: warning: statement with no effect
Looks like a logic bug hidden in the warning.

GCC14 -Wall cleanup series [-Wunused-value]
2024-10-09 20:50:00 -04:00
Darryl Miles 64d94ae588 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>
2024-10-01 12:36:12 -04:00
Alessandro De Laurenzis b306a39560 Compatibility with C99 standard
This commit makes the code (mostly) C99-compatible, enabling to compile
it without the -Wno-error=implicit-function-declaration flag. This
way, Magic becomes usable on arm64 architectures, specifically on Apple
computers with M1/M2 SoC.
2022-10-29 06:07:46 +02:00
Anton Blanchard 73fee3e5fd Add missing types in function prototypes
It would be nice to convert the codebase from K&R to ANSI function
prototypes, but for now just clean up the warnings.
2022-01-10 14:04:37 -05:00
Tim Edwards 59fc24729c Corrected issues in the extresist function found after the previous
commit, mostly relating to the scale of values in the ".nodes" file
produced by ext2sim.  Making this file CIF syntax seemed unnecessary,
so I removed the CIF syntax and scaling.  "extresist" can now produce
an apparently valid output on a standard cell layout.  Even with the
change, the extresist output is still only pseudo-hierarchical, so
this does not preclude the need for eliminating the .sim format file
in favor of the .ext file, but it provides a working intermediate
form.
2021-04-21 13:03:26 -04:00
Tim Edwards 2af38a4191 Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
Tim Edwards ff0ba7f89d Merge branch 'master' into bplane
Conflicts:
	VERSION

Merged recent changes from master back into bplane, as the efficiency of
bplane for doing extraction on large layouts is unquestionably better.
Fixed the implementation of DBMoveCell() for bplane.  Corrected an error
in the bplane version of dbScaleCell() that enumerates cell uses but
does not free the list.
2020-03-22 14:07:25 -04:00
Tim Edwards 276bf1d78a Corrected a bad error from a few commits ago, probably 198, which
can deallocate the cell name and causes all sorts of unexpected and
unwanted behavior.
2020-03-21 12:40:35 -04:00
Tim Edwards be1c0d1368 Merge branch 'master' into bplane
Conflicts:
	VERSION
	calma/Depend
	cif/Depend
	cmwind/Depend
	commands/Depend
	database/Depend
	dbwind/Depend
	debug/Depend
	drc/Depend
	ext2sim/Depend
	ext2spice/Depend
	extflat/Depend
	extract/Depend
	garouter/Depend
	gcr/Depend
	graphics/Depend
	grouter/Depend
	irouter/Depend
	lef/Depend
	lisp/Depend
	mzrouter/Depend
	netmenu/Depend
	plot/Depend
	plow/Depend
	resis/Depend
	router/Depend
	select/Depend
	sim/Depend
	tcltk/Depend
	textio/Depend
	tiles/Depend
	utils/Depend
	windows/Depend
	wiring/Depend

Merged recent changes from master branch into bplane branch.  Testing the
bplane implementation which has about a 5x improvement in extraction times
for large layouts, which is significant enough to move ahead with the bplane
implementation;  however, the bplane implementation has not been thoroughly
vetted yet, so it will remain a branch until such time that it has been
validated.
2020-03-15 13:23:24 -04:00
Tim Edwards 80fa495103 Removed the Depend files, which were being tracked with .gitignore
pointing to Depend instead of */Depend.
2020-03-13 15:39:08 -04:00
Tim Edwards 197c3f3448 Merge branch 'master' into bplane
Conflicts:
	commands/CmdCD.c
	database/DBcellsrch.c
	database/DBconnect.c
	database/DBio.c
	lef/lefRead.c
	select/selDisplay.c

Updated the bplane implementation with all recent updates (merged master).
2019-07-24 20:36:55 -04:00
Tim Edwards 547f0448d9 Cleanup of a number of uninitialized variable issues flagged by
the compiler.  Some are obscure functions (plot verstatec hasn't
been used in years) but others (like SPICE distributed junctions)
are potentially significant sources of unexpected crashes on
systems that don't zero uninitialized memory.
2019-06-07 14:13:50 -04:00
Tim Edwards 1d04f20f5d Moved new work on magic-8.4 (experimental merging of micromagic bplane structure
into magic-8.2) into the newly-reorganized git repo as branch "bplane".
2019-03-22 19:58:47 -04:00
Tim Edwards cfccdb84c1 Rewrote the configuration scripts, makefiles, and some initialization
routines to use the Tcl and Tk stubs libraries.
2017-10-13 10:28:07 -04:00
Tim Edwards 231a299b16 Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00