Darryl L. Miles
882d82a8ae
Lookup() constify call-site with Tcl_SetResult()
...
ext2spice/ext2spice.c: Lookup() constify call-site
ext2sim/ext2sim.c: Lookup() constify call-site
windows/windCmdAM.c: Lookup() constify call-site
Tcl_SetResult() uses cast to remove 'const' from type, the pointer
is only used to take a copy of the data, the lack of 'const' is due
to Tcl heritage when supporting C89 era compilers.
TCL9 appears to fix this, in that the macro used ends up at
Tcl_NewStringObj() which has 'const' here.
2024-12-26 15:20:58 -05:00
Darryl L. Miles
a3dce62887
LookupFull() constify call-site
...
lef/lefRead.c LookupFull() constify call-site
lef/defRead.c LookupFull() constify call-site
graphics/grDStyle.c: LookupFull() 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
fb8f7b94aa
LookupStructFull() constify call-site
...
txInput.c: LookupStructFull() constify call-site
DBlabel.c: LookupStructFull() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
f5b41a06d6
utils/lookup*.c: constify the API
...
extern int Lookup(const char *str, const char * const *table);
extern int LookupAny(char, const char * const *);
extern int LookupFull(const char *, const char **);
extern int LookupStruct(const char *str, const LookupTable *table_start, int size);
extern int LookupStructFull(const char *str, const char * const *table, int size);
2024-12-26 15:20:58 -05:00
Darryl L. Miles
aa43cc164e
geometry.h: constify global wellknown Geometry data values
...
This then rippled through into callers
Fixed merge conflicts in cif/CIFrdutils.c and cif/CIFread.h
2024-12-26 15:20:39 -05:00
Darryl L. Miles
a224c7e21a
GeoDisjoint() unify return type of callback to bool
...
GeoDisjoint() handles this as 'bool' type internally so make all
consumer call-sites consistent with this type.
2024-12-26 15:10:35 -05:00
Darryl L. Miles
fd6c30a380
geometry.c: constify and add prototypes
2024-12-26 15:10:35 -05:00
Darryl L. Miles
efb5d9001c
util/hash.[ch]: const hash 'key' for API and internal type
...
This is mainly to modify the function signature to accept const
data pointers to keys.
Patch required to ease use of const by API consumers.
2024-12-26 15:10:35 -05:00
Darryl L. Miles
91da638579
utils/strdup.c: StrDup() and mode constifiy impl
2024-12-26 15:10:35 -05:00
Darryl L. Miles
77f04b4e80
K&R debug.h: conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:15:29 -05:00
Darryl L. Miles
c7f99e076e
DBcount.c: DBTreeCountPaint() unify return type of hiercount() callback
...
The call-site does not expect a return value.
The use case in command/Cmdwizard.c is written to be void.
So a resolution was needed.
2024-12-26 13:13:14 -05:00
Darryl L. Miles
bd03a550d3
CmdCD.c: DBOrientUse() called with too many arguments.
...
Comment added to come back to later.
DBOrientUse(cellname, dodef/*, orient*/);
2024-12-26 13:13:13 -05:00
Darryl L. Miles
f08793ddd7
CmdTZ.c: use strict prototype for qsort() compar callback function
2024-12-26 13:13:13 -05:00
Darryl L. Miles
2123f7090d
CmdCD.c: removed unnecessary fwd decl for function in included header
...
commands.h contains the prototype for cmdFlushCell() which is already
being included in CmdCD.c
2024-12-26 13:13:13 -05:00
Darryl L. Miles
7ebaba6b39
DBcount.c: clarify function documentation of hiercount() callback
...
DBTreeCountPaint(def, count, hiercount, cleanup, cdata)
callback hiercount()
The K&R function prototype syntax in the documentation might confuse
reader into which argument order is correct (as a modern developer
might be out of practice with interpreting K&R syntax)
2024-12-26 13:13:13 -05:00
Darryl L. Miles
3a41bf6ae2
DBWprocs.c: removed fwd decl for non-existant function
...
void DisplayWindow();
Found during K&R removal of commands/**
2024-12-26 13:13:13 -05:00
Darryl L. Miles
56139b48eb
K&R commands/*.c: bulk forward reference function prototype conversion
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
afd1b0b2df
K&R commands: 2 x missing forward declaration removal
...
Functions do not appear to exist:
extern void DisplayWindow();
extern void DisplayWindow();
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
b3d4ab7980
K&R commands/*.c: bulk function implementation conversion
...
Argument order and type declaration mismatches:
Label *
portFindLabel(editDef, port, unique, nonEdit)
CellDef *editDef;
bool unique;
bool port; // If TRUE, only look for labels that are ports
bool *nonEdit; // TRUE if label is not in the edit cell
This warrants inspection at call site CmdLQ.c:1712 as both types are bool
is it not so straightforward to check.
It looks like when PORT_MAKE is the option 'port make [index] [dir...]'
port=FALSE is this the correct intention ? This looks ok in that
we're searching for labels to make (upgrade) into ports.
Where as all other 'port ....' commands are operating on items that are
already ports, and ignoring labels.
So the K&R argument name order is also how the call-sites are using it.
void
cmdStatsHier(parent, nuses, child)
CellDef *parent, *child;
int nuses;
This was checked and found ok as callback to ../database/DBcount.c
DBTreeCountPaint(... hiercount, ...)
Due to this not-obvious K&R style also being used in the documentation
this was changed as well (in another commit0.
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
8a4464f443
commands.h: add #include "textio/txcommands.h"
...
The type TxCommand is used in the function signatures.
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
06b5870035
K&R commands.h: conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
866699f353
K&R commands.h: 3 x missing prototype removal
...
Functions do not appear to exist:
extern MagWindow *CmdGetRootBox();
extern void CmdAddSlop();
extern void CmdDoMacro();
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
7a7d1ab25b
K&R cmwind/*.c: bulk function implementation conversion
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:07:52 -05:00
Darryl L. Miles
2a4c66e222
K&R CMWundo.c: move typedef to before forward declaration usage
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:07:52 -05:00
Darryl L. Miles
0e715ce98e
K&R: cmwind/*.c bulk forward reference function prototype conversion
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:07:52 -05:00
Darryl L. Miles
b716aaa59d
K&R: cmwind.h conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:07:52 -05:00
Darryl L. Miles
83f7a71ff3
GHA: canary-matrix.yml
2024-12-26 13:06:26 -05:00
Darryl L. Miles
102f7ad3f2
CIFrdcl.c: bool to int filetype
...
This direction was chosen due to #define integer use of special values
instead of TRUE/FALSE. This makes the prototype and use consistent
removing compiler warning from recent K&R removal.
2024-12-26 13:05:14 -05:00
Darryl L. Miles
2f7f76bf9c
K&R: cif/*.c bulk function implementation conversion
...
Beware of the MISMATCH with the prototype found in original
source, with the type declaration below.
External call sites checked to confirm argument order is
correct with the argument name order.
// nedges <> dir
bool
cifOrient(edges, nedges, dir)
CIFPath *edges[], /* Array of edges to be categorized. */
int dir[], /* Array to hold directions. */
int nedges) /* Size of arrays. */
// spacing <> border
int
CIFGetContactSize(type, edge, spacing, border)
TileType type,
int *edge,
int *border,
int *spacing)
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
ff412b74d8
K&R graphics/W3Dmain.c: too few args in CIFNameToMask()
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
f92d9d469f
K&R: cif/*.h move function prototypes to the correct file
...
The data types CIFPath and CIFReadStyle are part of CIFread.h
and all users outside include CIFread.h already.
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
4e83c7fcdd
CIFgen.c:309:10: warning: prototype for ‘SetMinBoxGrid’ follows non-prototype definition
...
This reference is not a forward reference, the function implementation
for SetMinBoxGrid() is above this line being removed.
2024-12-26 13:05:14 -05:00
Darryl L. Miles
bf45f9ea31
K&R: cif/*.c bulk forward reference function prototype conversion
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
89ed5d735c
K&R: CIFread.h conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
ca2d6d40dd
K&R: CIFint.h conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
b8c3060f3b
K&R: cif.h conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
a1ae272dc5
K&R: prototype for non-existent function: CIFGetDefaultContactSize()
...
Remove prototype from header file to correct error.
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:05:14 -05:00
Darryl L. Miles
114ddf1b0c
grX11su1.c: GrX11IconUpdate() potential -1 out-of-bound access
...
SonarCloud
Access of 'char' element in the region at index -1
https://sonarcloud.io/project/issues?open=AZJB163RNGfDNup0Ri4r&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
3a35d4d28d
grTOGL1.c: GrTOGLIconUpdate() potential -1 out-of-bound access
...
SonarCloud
Access of 'char' element in the region at index -1
This was not picked up, even though similar code was.
2024-12-26 13:01:24 -05:00
Darryl L. Miles
89fa935416
grTk1.c: GrTkIconUpdate() potential -1 out-of-bound access
...
SonarCloud
Access of 'char' element in the region at index -1
This was not picked up, even though similar code was.
2024-12-26 13:01:24 -05:00
Darryl L. Miles
ef7f989da6
grTCairo1.c: GrTCairoIconUpdate() potential -1 out-of-bound access
...
SonarCloud
Access of 'char' element in the region at index -1
This was not picked up, even though similar code was.
2024-12-26 13:01:24 -05:00
Darryl L. Miles
ee9d4df081
lefRead.c: LefError() add ASSERT(type) for incorrect caller usage
...
'type' maybe used as array index without being initialized.
Sonarcloud
Array subscript is undefined
https://sonarcloud.io/project/issues?open=AZJB17LDNGfDNup0Rjyn&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
86b5d591d6
grOGL3.c: add GrOGLTextSize() error return
...
'textrect' is not filled in when GrOGLTextSize() fails.
Add error return and abort groglPutText() easrly on error.
graphics/grOGL3.c:783 Rect textrect;
SonarCloud
The right operand of '+' is a garbage value
https://sonarcloud.io/project/issues?open=AZJB160qNGfDNup0Riv5&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
56317e6583
grOGL3.c: font, The left operand of '==' is a garbage value
...
SonarCloud
The left operand of '==' is a garbage value
https://sonarcloud.io/project/issues?open=AZJB160qNGfDNup0Riv4&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
55413d6b3a
grOGL1.c: GrOGLIconUpdate() potential -1 out-of-bound access
...
SonarCloud
Access of 'char' element in the region at index -1
https://sonarcloud.io/project/issues?open=AZJB16z6NGfDNup0Rist&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
da80d5c75d
grOGL1.c: pipehandler() XEvent processing NULL deref
...
SonarCloud
Access to field 'w_flags' results in a dereference of a null pointer (loaded from variable 'mw')
https://sonarcloud.io/project/issues?open=AZJB16z6NGfDNup0Risq&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
26d6af464a
grDStyle.c: newres, Branch condition evaluates to a garbage value
...
'newres' initialization is performed the wrong side of the label
to be effective to the code that uses it.
SonarCloud
Branch condition evaluates to a garbage value
https://sonarcloud.io/project/issues?open=AZJB16zUNGfDNup0RiqG&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
60f308826d
grDStyle.c: GrLoadStyles() scount, The left operand of '<' is a garbage value
...
The use of 'scount' in this function looks complex, it seems to be reset to
zero sometimes and incremented at others. Analysis shows there is a possible
path where is maybe used uninitialized.
Setting to zero seems like a good choice.
SonarCloud
grDStyle.c:514 The left operand of '<' is a garbage value
https://sonarcloud.io/project/issues?open=AZJB16zUNGfDNup0RiqE&id=dlmiles_magic
2024-12-26 13:01:24 -05:00
Darryl L. Miles
bbe447423b
gaStem.c: type, The left operand of '==' is a garbage value
...
Theoretical use of unintialized data.
Added 'default' case into switch to throw ASSERT(), otherwise
when assertions disabled treat consistently as GEO_NORTH.
SonarCloud
The left operand of '==' is a garbage value
https://sonarcloud.io/project/issues?open=AZJB17fSNGfDNup0Rkoh&id=dlmiles_magic
2024-12-26 13:01:24 -05:00