mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-07 03:21:20 +02:00
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:
@@ -946,6 +946,8 @@ GeoDummyFunc(
|
||||
const Rect *box,
|
||||
ClientData cdarg)
|
||||
{
|
||||
ARG_UNUSED(box);
|
||||
ARG_UNUSED(cdarg);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ GetRect(fin, skip, rect, scalen, scaled)
|
||||
int scaled; /* Scale down by this amount */
|
||||
{
|
||||
int n, c;
|
||||
char *cp;
|
||||
bool isNegative;
|
||||
int dir = 0x1;
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
#define DEREF(ptr,offset) (((char*)ptr)+(offset))
|
||||
|
||||
static char rcsid[] = "$Header$";
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "utils/magic.h"
|
||||
@@ -128,8 +127,6 @@ void *IHashLookUpNext(IHashTable *table, void *prevEntry)
|
||||
{
|
||||
void *entry;
|
||||
void *key = DEREF(prevEntry,table->iht_keyOffset);
|
||||
int hash = (table->iht_hashFn)(key);
|
||||
int bucket = ABS(hash) % table->iht_nBuckets;
|
||||
|
||||
for(entry = *((void **) DEREF(prevEntry,table->iht_nextOffset));
|
||||
entry && !(table->iht_sameKeyFn)(key,DEREF(entry,table->iht_keyOffset));
|
||||
|
||||
+1
-2
@@ -101,7 +101,7 @@ MacroDefineByName(clientName, xc, str, help, imacro)
|
||||
bool imacro; /* is this an interactive macro? */
|
||||
{
|
||||
HashEntry *h;
|
||||
HashTable *clienttable, newTable;
|
||||
HashTable *clienttable;
|
||||
macrodef *oldMacro, *newMacro;
|
||||
|
||||
/* If a macro exists, delete the old string and redefine it */
|
||||
@@ -464,7 +464,6 @@ MacroCopy(client, clientkey)
|
||||
char *clientkey; /* Name of client to copy macros to */
|
||||
{
|
||||
HashTable *clienttable;
|
||||
HashTable *copytable;
|
||||
HashEntry *h, *he;
|
||||
HashSearch hs;
|
||||
char *clientName;
|
||||
|
||||
+3
-3
@@ -189,8 +189,6 @@ extern char AbortMessage[];
|
||||
#define ANALYSER_CSTRING(n) __attribute__((null_terminated_string_arg(n)))
|
||||
#define ANALYSER_FD_ARG(fd) __attribute__((fd_arg(fd)))
|
||||
#define ANALYSER_MALLOC(dealloc, idx) __attribute__((malloc, malloc(dealloc, idx)))
|
||||
/* looking to squash excessive -Wpedantic warnings ? add into defs.mak: CPPFLAGS += -Wno-variadic-macros */
|
||||
#define ANALYSER_NONNULL(n...) __attribute__((nonnull(n)))
|
||||
#define ANALYSER_RETURNS_NONNULL __attribute__((returns_nonnull))
|
||||
#else
|
||||
#define ATTR_FORMAT_PRINTF_1 /* */
|
||||
@@ -203,10 +201,12 @@ extern char AbortMessage[];
|
||||
#define ANALYSER_CSTRING(n) /* */
|
||||
#define ANALYSER_FD_ARG(fd) /* */
|
||||
#define ANALYSER_MALLOC(dealloc, idx) /* */
|
||||
#define ANALYSER_NONNULL(n...) /* */
|
||||
#define ANALYSER_RETURNS_NONNULL /* */
|
||||
#endif
|
||||
|
||||
/* ---------------- Miscellaneous Helper Macros -------------------------- */
|
||||
#define ARG_UNUSED(arg) (void) arg
|
||||
|
||||
/* ---------------- Start of Machine Configuration Section ----------------- */
|
||||
|
||||
/* ------- Configuration: Handle Missing Routines/Definitions ------- */
|
||||
|
||||
@@ -511,6 +511,8 @@ mainInitBeforeArgs(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
TechOverridesDefault = FALSE;
|
||||
if (Path == NULL)
|
||||
Path = StrDup((char **) NULL, ".");
|
||||
|
||||
+1
-4
@@ -32,8 +32,6 @@ genCanonicalMaxwidth(bbox, starttile, plane, mask)
|
||||
Plane *plane; /* Plane being searched */
|
||||
TileTypeBitMask *mask; /* Mask of types to check */
|
||||
{
|
||||
int s;
|
||||
Tile *tile, *tp;
|
||||
TileTypeBitMask wrongtypes;
|
||||
static MaxRectsData *mrd = (MaxRectsData *)NULL;
|
||||
Rect boundorig;
|
||||
@@ -251,9 +249,9 @@ FindMaxRectangle(bbox, startpoint, plane, expandtypes)
|
||||
Plane *plane; /* plane of types to expand */
|
||||
TileTypeBitMask *expandtypes; /* types to expand in */
|
||||
{
|
||||
ARG_UNUSED(expandtypes);
|
||||
MaxRectsData *mrd;
|
||||
Tile *starttile;
|
||||
TileType tt;
|
||||
int rectArea;
|
||||
int maxarea = 0;
|
||||
int s, sidx = -1;
|
||||
@@ -310,7 +308,6 @@ FindMaxRectangle2(bbox, starttile, plane, expandtypes)
|
||||
TileTypeBitMask *expandtypes; /* types to expand in, may be NULL */
|
||||
{
|
||||
MaxRectsData *mrd;
|
||||
TileType tt;
|
||||
int rectArea;
|
||||
int maxarea = 0;
|
||||
int s, sidx = -1;
|
||||
|
||||
@@ -218,6 +218,7 @@ nlLabelFunc(area, name, label, term)
|
||||
Label *label; /* Label within scx->scx_use->cu_def */
|
||||
NLTerm *term; /* Prepend new NLTermLoc to this terminal */
|
||||
{
|
||||
ARG_UNUSED(name);
|
||||
NLTermLoc *loc;
|
||||
|
||||
loc = (NLTermLoc *) mallocMagic((unsigned) (sizeof (NLTermLoc)));
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ void
|
||||
DumpCore()
|
||||
{
|
||||
int parentPid = getpid();
|
||||
int cpid, gcpid, wpid;
|
||||
int cpid, gcpid;
|
||||
FILE *commentFile, *crashFile;
|
||||
time_t now;
|
||||
char pidString[20], line[150], command[512], tempName[200], *crashDir;
|
||||
|
||||
@@ -164,6 +164,7 @@ SigRemoveTimer()
|
||||
sigRetVal
|
||||
sigOnAlarm(int signo)
|
||||
{
|
||||
ARG_UNUSED(signo);
|
||||
if (GrDisplayStatus == DISPLAY_IN_PROGRESS)
|
||||
GrDisplayStatus = DISPLAY_BREAK_PENDING;
|
||||
|
||||
@@ -205,6 +206,7 @@ SigTimerInterrupts()
|
||||
sigRetVal
|
||||
sigOnStop(int signo)
|
||||
{
|
||||
ARG_UNUSED(signo);
|
||||
/* fix things up */
|
||||
TxResetTerminal(TRUE);
|
||||
GrStop();
|
||||
@@ -410,6 +412,7 @@ SigUnWatchFile(filenum, filename)
|
||||
* calls (such as windows: /dev/winXX).
|
||||
*/
|
||||
{
|
||||
ARG_UNUSED(filename);
|
||||
int flags;
|
||||
|
||||
flags = fcntl(filenum, F_GETFL, 0);
|
||||
@@ -448,6 +451,7 @@ SigUnWatchFile(filenum, filename)
|
||||
sigRetVal
|
||||
sigOnInterrupt(int signo)
|
||||
{
|
||||
ARG_UNUSED(signo);
|
||||
if (sigNumDisables != 0)
|
||||
sigInterruptReceived = TRUE;
|
||||
else
|
||||
@@ -476,6 +480,7 @@ sigOnInterrupt(int signo)
|
||||
sigRetVal
|
||||
sigOnTerm(int signo)
|
||||
{
|
||||
ARG_UNUSED(signo);
|
||||
DBWriteBackup(NULL);
|
||||
exit (1);
|
||||
}
|
||||
@@ -499,6 +504,7 @@ sigOnTerm(int signo)
|
||||
sigRetVal
|
||||
sigOnWinch(int signo)
|
||||
{
|
||||
ARG_UNUSED(signo);
|
||||
SigGotSigWinch = TRUE;
|
||||
sigReturn;
|
||||
}
|
||||
@@ -520,6 +526,7 @@ sigOnWinch(int signo)
|
||||
sigRetVal
|
||||
sigIO(int signo)
|
||||
{
|
||||
ARG_UNUSED(signo);
|
||||
SigIOReady = TRUE;
|
||||
if (SigInterruptOnSigIO == 1) sigOnInterrupt(0);
|
||||
sigReturn;
|
||||
|
||||
@@ -281,6 +281,7 @@ stackCopyFn(stackItem, i, cd)
|
||||
int i;
|
||||
ClientData cd;
|
||||
{
|
||||
ARG_UNUSED(i);
|
||||
if(stackCopyStr)
|
||||
StackPush((ClientData) StrDup((char **) NULL, (char *)stackItem), (Stack *) cd);
|
||||
else
|
||||
|
||||
@@ -234,6 +234,8 @@ UndoInit(logFileName, mode)
|
||||
*/
|
||||
char *mode; /* Mode for opening. Must be "r", "rw", or "w" */
|
||||
{
|
||||
ARG_UNUSED(logFileName);
|
||||
ARG_UNUSED(mode);
|
||||
UndoDisableCount = 0;
|
||||
undoLogTail = NULL;
|
||||
undoLogCur = NULL;
|
||||
@@ -336,6 +338,8 @@ UndoAddClient(init, done, readEvent, writeEvent, forwEvent, backEvent, name)
|
||||
void (*forwEvent)(), (*backEvent)();
|
||||
char *name;
|
||||
{
|
||||
ARG_UNUSED(readEvent);
|
||||
ARG_UNUSED(writeEvent);
|
||||
if (undoNumClients >= MAXUNDOCLIENTS)
|
||||
return ((UndoType) -1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user