Fixed unused-parameters/unused-variables warnings

Added a ARG_UNUSED macro in utils/magic.h, which
produces a simple cast to void to silence the warnings.
The reasons this is used as opposed to an attribute is
that most compilers should support this.
Besides this, the macro can be easily searched for in
the future to potentially remove (where possible) the
unused parameters.
This commit is contained in:
Patrick Kurth
2025-10-10 22:12:19 +02:00
parent 27c423c2ed
commit ea03883829
183 changed files with 642 additions and 528 deletions
-1
View File
@@ -61,7 +61,6 @@ DBBoundCellPlane(def, extended, rect)
TreeFilter filter;
DBCellBoundStruct cbs;
int dbCellBoundFunc();
Plane *plane;
filter.tf_func = NULL;
filter.tf_arg = (ClientData)&cbs;
-7
View File
@@ -150,10 +150,6 @@ DBPlaceCell (use, def)
CellUse * use; /* new celluse to add to subcell tile plane */
CellDef * def; /* parent cell's definition */
{
Rect rect; /* argument to DBSrCellPlaneArea(), placeCellFunc() */
BPlane *bplane; /* argument to DBSrCellPlaneArea(), placeCellFunc() */
struct searchArg arg; /* argument to placeCellFunc() */
ASSERT(use != (CellUse *) NULL, "DBPlaceCell");
ASSERT(def, "DBPlaceCell");
@@ -184,9 +180,6 @@ DBPlaceCellNoModify (use, def)
CellUse * use; /* new celluse to add to subcell tile plane */
CellDef * def; /* parent cell's definition */
{
Rect rect; /* argument to DBSrCellPlaneArea(), placeCellFunc() */
BPlane *bplane; /* argument to DBSrCellPlaneArea(), placeCellFunc() */
struct searchArg arg; /* argument to placeCellFunc() */
ASSERT(use != (CellUse *) NULL, "DBPlaceCell");
ASSERT(def, "DBPlaceCell");
+2 -3
View File
@@ -388,7 +388,7 @@ dbCopyMaskHintsFunc(key, value, puds)
CellDef *dest = puds->puds_dest;
Transform *trans = puds->puds_trans;
char *propstr = (char *)value;
char *parentprop, *newvalue, *vptr;
char *parentprop, *newvalue;
Rect r, rnew;
bool propfound;
@@ -615,7 +615,6 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels, doclear)
for (lab = dest->cu_def->cd_labels; lab; lab = lab->lab_next)
{
Label *newlab;
char *newtext;
if (lab->lab_flags & LABEL_GENERATE)
@@ -917,7 +916,6 @@ DBCellGenerateSimpleSubstrate(scx, subType, notSubMask, targetDef)
int plane;
Rect rect;
TileTypeBitMask allButSubMask;
TileTypeBitMask defaultSubTypeMask;
int dbEraseSubFunc();
int dbPaintSubFunc();
int dbEraseNonSub();
@@ -1192,6 +1190,7 @@ dbCopyAllLabels(scx, lab, tpath, arg)
TerminalPath *tpath;
struct copyLabelArg *arg;
{
ARG_UNUSED(tpath);
Rect labTargetRect;
Point labOffset;
int targetPos, labRotate;
+4 -1
View File
@@ -455,7 +455,6 @@ dbCellPrintInfo(StartDef, who, dolist)
CellDef *celldef;
CellUse *celluse;
char *cu_name;
bool topdone;
switch (who) {
case SELF:
@@ -1254,6 +1253,7 @@ dbLockUseFunc(selUse, use, transform, data)
Transform *transform;
ClientData data;
{
ARG_UNUSED(transform);
bool dolock = *((bool *)data);
if (EditCellUse && !DBIsChild(use, EditCellUse))
@@ -1450,6 +1450,7 @@ dbOrientUseFunc(selUse, use, transform, data)
Transform *transform;
ClientData data;
{
ARG_UNUSED(transform);
bool *dodef = (bool *)data;
int orient;
@@ -1608,6 +1609,8 @@ dbAbutmentUseFunc(selUse, use, transform, data)
Transform *transform;
ClientData data;
{
ARG_UNUSED(selUse);
ARG_UNUSED(transform);
Rect bbox, refbox;
Transform *trans;
char *propvalue;
+1 -3
View File
@@ -1802,7 +1802,7 @@ int dbScaleProp(name, value, cps)
CellPropStruct *cps;
{
int scalen, scaled;
char *newvalue, *vptr;
char *newvalue;
Rect r;
if ((strlen(name) > 5) && !strncmp(name + strlen(name) - 5, "_BBOX", 5))
@@ -1940,7 +1940,6 @@ dbScaleCell(cellDef, scalen, scaled)
int dbCellScaleFunc(), dbCellUseEnumFunc();
Label *lab;
int pNum;
LinkedTile *lhead, *lt;
LinkedCellUse *luhead, *lu;
Plane *newplane;
BPlane *cellPlane, *cellPlaneOrig;
@@ -2155,7 +2154,6 @@ DBMoveCell(cellDef, origx, origy)
int dbCellTileEnumFunc(), dbCellUseEnumFunc();
Label *lab;
int pNum;
LinkedTile *lhead, *lt;
LinkedCellUse *luhead, *lu;
Plane *newplane;
BPlane *cellPlane, *cellPlaneOrig;
+2 -2
View File
@@ -737,8 +737,9 @@ int
dbcUnconnectFunc(tile, clientData)
Tile *tile; /* Current tile */
ClientData clientData; /* Unused. */
{
ARG_UNUSED(tile);
ARG_UNUSED(clientData);
return 1;
}
@@ -946,7 +947,6 @@ dbcConnectFunc(tile, cx)
TileTypeBitMask notConnectMask;
Rect *srArea;
SearchContext *scx = cx->tc_scx;
SearchContext scx2;
TileType loctype = TiGetTypeExact(tile);
TileType dinfo = 0;
int retval, i, pNum = cx->tc_plane;
-1
View File
@@ -183,7 +183,6 @@ dbExpandFunc(scx, arg)
struct expandArg *arg; /* Client data from caller */
{
CellUse *childUse = scx->scx_use;
int n = DBLambda[1];
/*
* Change the expansion status of this cell if necessary. Call the
+9 -12
View File
@@ -225,11 +225,10 @@ DBSearchForTech(techname, techroot, pathroot, level)
char *pathroot;
int level;
{
char *newpath, *found, *dptr;
char *newpath, *found;
struct dirent *tdent;
DIR *tdir;
LinkedDirent *dlist = NULL, *ld, *ldlast = NULL;
int dlen;
/* Avoid potential infinite looping. Any tech file should not be very */
/* far down the path. 10 levels is already excessive. */
@@ -525,13 +524,11 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference)
{
int cellStamp = 0, rectCount = 0, rectReport = 10000;
char line[2048], tech[50], layername[50];
PaintResultType *ptable;
bool result = TRUE, scaleLimit = FALSE, has_mismatch;
Rect *rp;
int c;
TileType type, rtype, loctype;
TileTypeBitMask *rmask, typemask;
Plane *plane;
Rect r;
int n = 1, d = 1;
HashTable dbUseTable;
@@ -1232,7 +1229,6 @@ DBReadBackup(name, archive, usederef)
char *filename, *rootname, *chrptr, *suffix, *filetype;
char line[256];
CellDef *cellDef;
bool result = TRUE;
if (archive)
{
@@ -1447,7 +1443,7 @@ dbReadOpen(cellDef, setFileName, dereference, errptr)
{
FILETYPE f = NULL;
int fd;
char *filename, *realname, *savename;
char *filename, *realname;
bool is_locked;
#ifdef FILE_LOCKS
@@ -1654,6 +1650,7 @@ DBOpenOnly(cellDef, name, setFileName, errptr)
*/
int *errptr; /* Pointer to int to hold error value */
{
ARG_UNUSED(name);
dbReadOpen(cellDef, setFileName, FALSE, errptr);
}
@@ -3261,7 +3258,7 @@ dbFindPropGCFFunc(key, value, ggcf)
int *ggcf; /* Client data */
{
Rect bbox;
char *vptr = value, *sptr;
char *vptr = value;
int numvals, n;
if (!strcmp(key, "FIXED_BBOX"))
@@ -3398,6 +3395,7 @@ dbCountUseFunc(cellUse, count)
CellUse *cellUse; /* Cell use whose "call" is to be written to a file */
int *count;
{
ARG_UNUSED(cellUse);
(*count)++;
return 0;
}
@@ -3491,6 +3489,8 @@ dbCountPropFunc(key, value, count)
ClientData value;
int *count; /* Client data */
{
ARG_UNUSED(key);
ARG_UNUSED(value);
(*count)++;
return 0;
}
@@ -3551,9 +3551,6 @@ DBCellWriteFile(cellDef, f)
int reducer;
char *estring;
char lstring[2048];
char *propvalue;
bool propfound;
CellUse **useList;
int i, numUses = 0, numProps = 0;
struct cellUseList cul;
pwfrec pwf;
@@ -4187,12 +4184,10 @@ dbWritePaintCommandsFunc(tile, cdarg)
Tile *tile;
ClientData cdarg;
{
char pstring[256];
struct writeArg *arg = (struct writeArg *) cdarg;
FILE *f = arg->wa_file;
TileType type = TiGetType(tile);
TileTypeBitMask *lMask, *rMask;
int diridx;
static const char *directionNames[] = {"nw", "se", "sw", "ne", 0};
@@ -4760,6 +4755,7 @@ dbClearCellFunc(cellUse, cdarg)
CellUse *cellUse; /* Cell use */
ClientData cdarg; /* Not used */
{
ARG_UNUSED(cdarg);
cellUse->cu_def->cd_flags &= ~CDVISITED;
return 0;
}
@@ -5231,6 +5227,7 @@ dbCheckModifiedCellsFunc(def, cdata)
CellDef *def; /* Pointer to CellDef to be saved */
ClientData cdata; /* Unused */
{
ARG_UNUSED(cdata);
if (def->cd_flags & (CDINTERNAL | CDNOEDIT | CDNOTFOUND)) return 0;
else if (!(def->cd_flags & CDAVAILABLE)) return 0;
return 1;
+2 -3
View File
@@ -1316,8 +1316,7 @@ DBFontLabelSetBBox(label)
char *tptr;
Point *coffset, rcenter;
Rect *cbbox, locbbox, *frect;
Transform labTransform = GeoIdentityTransform;
int i, ysave, size;
int i, ysave;
double rrad, cr, sr, tmpx, tmpy;
bool expand;
@@ -1563,7 +1562,7 @@ DBLoadFont(fontfile, scale)
"v", "w", "x", "y", "z", "braceleft", "bar", "braceright",
"asciitilde", ".notdef", NULL
};
int i, j, x, y, asciiidx, chardef, numidx;
int i, j, asciiidx, chardef, numidx;
int numtok[NUMBUF];
char *token, *psname = NULL;
MagicFont *newFont = NULL, **newDBFontList;
+1 -3
View File
@@ -744,7 +744,7 @@ DBSplitTile(plane, point, splitx)
Point *point;
int splitx;
{
Tile *tile, *newtile, *tp;
Tile *tile, *newtile;
tile = PlaneGetHint(plane);
GOTOPOINT(tile, point);
@@ -805,7 +805,6 @@ DBFracturePlane(plane, area, resultTbl, undo)
TileType oldType;
Tile *tile, *newtile;
Tile *tpnew; /* Used for area search */
Tile *tp; /* Used for paint */
if (area->r_xtop <= area->r_xbot || area->r_ytop <= area->r_ybot)
return;
@@ -1511,7 +1510,6 @@ DBNMPaintPlane0(plane, exacttype, area, resultTbl, undo, method)
if (exacttype & TT_DIAGONAL)
{
int dbNMEnumFunc(); /* Forward reference */
TileRect arg;
dinfo.resultTbl = resultTbl;
dinfo.dir = (exacttype & TT_DIRECTION) ? 1 : 0;
+1 -2
View File
@@ -171,6 +171,7 @@ DBTechAddContact(sectionName, argc, argv)
int argc;
char *argv[];
{
ARG_UNUSED(sectionName);
TileType contactType;
int nresidues;
@@ -216,7 +217,6 @@ DBTechAddContact(sectionName, argc, argv)
else
{
TileType lastType = TT_SPACE;
char *primary;
while (--argc > 1)
{
@@ -826,7 +826,6 @@ DBTechTypesOnPlane(src, plane)
int plane;
{
int i;
PlaneMask pmask;
for (i = 0; i < DBNumTypes; i++)
if (TTMaskHasType(src, i))
+3
View File
@@ -106,6 +106,7 @@ DBTechSetTech(sectionName, argc, argv)
int argc;
char *argv[];
{
ARG_UNUSED(sectionName);
if (argc != 1)
{
if (argc == 2)
@@ -174,6 +175,7 @@ DBTechSetVersion(sectionName, argc, argv)
int argc;
char *argv[];
{
ARG_UNUSED(sectionName);
char *contline;
int n, slen;
@@ -312,6 +314,7 @@ DBTechAddConnect(sectionName, argc, argv)
int argc;
char *argv[];
{
ARG_UNUSED(sectionName);
TileTypeBitMask types1, types2;
TileType t1, t2;
-1
View File
@@ -155,7 +155,6 @@ DBTechNameTypes(typename, bitmask)
char *slash;
TileType type;
int plane;
LayerInfo *lp;
TTMaskZero(bitmask);
slash = strchr(typename, '/');
+2 -2
View File
@@ -269,6 +269,7 @@ DBTechAddPlane(
int argc,
char *argv[])
{
ARG_UNUSED(sectionName);
const char *cp;
if (DBNumPlanes >= PL_MAXTYPES)
@@ -344,8 +345,7 @@ DBTechAddAlias(sectionName, argc, argv)
int argc;
char *argv[];
{
char *cp;
int pNum;
ARG_UNUSED(sectionName);
HashEntry *he;
TileType atype;
TileTypeBitMask *amask, tmask;
+1 -1
View File
@@ -829,7 +829,7 @@ DBClearCellPlane(def)
int dbDeleteCellUse(CellUse *use, ClientData arg)
{
CellDef *def = (CellDef *)arg;
ARG_UNUSED(arg);
CellUse *defuses, *lastuse;
dbInstanceUnplace(use);
+1
View File
@@ -597,6 +597,7 @@ dbTechAddPaintErase(type, sectionName, argc, argv)
int argc;
char *argv[];
{
ARG_UNUSED(sectionName);
int pNum;
PlaneMask pMask, rMask;
TileType t1, t2, tres;
+5 -6
View File
@@ -734,10 +734,10 @@ void
DBLockContact(ctype)
TileType ctype;
{
LayerInfo *lpImage, *lpPaint;
TileType c, n, itype, eresult;
LayerInfo *lpPaint;
TileType n;
TileTypeBitMask *rmask;
int m, pNum;
int pNum;
/* Have type, Erase * --> Result is type */
@@ -778,9 +778,7 @@ DBUnlockContact(ctype)
TileType ctype;
{
LayerInfo *lpImage, *lpPaint;
TileType n, itype, eresult;
TileTypeBitMask *rmask;
int m, pNum;
TileType n;
lpImage = &dbLayerInfo[ctype];
@@ -868,6 +866,7 @@ dbComposeDecompose(imageType, componentType, remainingType)
TileType componentType;
TileType remainingType;
{
ARG_UNUSED(remainingType);
int pNum = DBPlane(imageType);
TileType resultType;