From a7961f1a978a9aa00398d0dc62cc4fdbd469d5f0 Mon Sep 17 00:00:00 2001 From: Brian Taylor Date: Sun, 11 May 2025 15:54:18 -0700 Subject: [PATCH] Fix some compiler warnings when -Wextra is added to CFLAGS. --- src/frontend/com_sysinfo.c | 1 + src/frontend/device.c | 2 ++ src/frontend/inpcom.c | 20 ++++++++++---------- src/spicelib/parser/inpeval.c | 6 +++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/frontend/com_sysinfo.c b/src/frontend/com_sysinfo.c index 0e65d7966..cf75a50b3 100644 --- a/src/frontend/com_sysinfo.c +++ b/src/frontend/com_sysinfo.c @@ -399,6 +399,7 @@ static void set_static_system_info(void) /* Get memory information */ static int get_sysmem(struct sys_memory *memall) { + NG_IGNORE(memall); fprintf(stderr, "System memory info is not available\n"); return -1; } diff --git a/src/frontend/device.c b/src/frontend/device.c index dbf39ffe7..0062bbeef 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -1641,11 +1641,13 @@ check_ifparm_compare(const void *a, const void *b) } +#ifdef HAVE_TDESTROY static void check_ifparm_freenode(void *node) { NG_IGNORE(node); } +#endif static void diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 6b12c2b7c..af230c9c1 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2573,7 +2573,7 @@ static void replace_freq(struct card *c, int *line_number) ++keywd; cp = key; while (*keywd && !isspace_c(*keywd) && *keywd != '}' && - cp - key < sizeof key - 1) { + cp - key < (long)(sizeof key - 1)) { *cp++ = *keywd++; } *cp = 0; @@ -6826,7 +6826,7 @@ static void inp_compat(struct card *card) K13 L2 L3 1 */ else if (*curr_line == 'k') { - int tokcount = 0; + int tokcount = 0, idx1, idx2; char* kinst, **ltok, *couple; cut_line = curr_line; /* get number of tokens */ @@ -6841,20 +6841,20 @@ static void inp_compat(struct card *card) cut_line = curr_line; kinst = gettok(&cut_line); ltok = TMALLOC(char*, tokcount); - for (i = 0; i < tokcount; i++) { - ltok[i] = gettok(&cut_line); + for (idx1 = 0; idx1 < tokcount; idx1++) { + ltok[idx1] = gettok(&cut_line); } couple = gettok(&cut_line); *curr_line = '*'; - for (i = 0; i < tokcount - 1; i++) - for (ii = i + 1; ii < tokcount; ii++) { - char* newline = tprintf("%s_%d_%d %s %s %s", kinst, (int)i + 1, (int)ii + 1, ltok[i], ltok[ii], couple); - card = insert_new_line(card, newline, (int)i + 1, currlinenumber, card->linesource); + for (idx1 = 0; idx1 < tokcount - 1; idx1++) + for (idx2 = idx1 + 1; idx2 < tokcount; idx2++) { + char* newline = tprintf("%s_%d_%d %s %s %s", kinst, idx1 + 1, idx2 + 1, ltok[idx1], ltok[idx2], couple); + card = insert_new_line(card, newline, idx1 + 1, currlinenumber, card->linesource); } tfree(kinst); tfree(couple); - for (i = 0; i < tokcount; i++) { - tfree(ltok[i]); + for (idx1 = 0; idx1 < tokcount; idx1++) { + tfree(ltok[idx1]); } } } diff --git a/src/spicelib/parser/inpeval.c b/src/spicelib/parser/inpeval.c index bd17eebbf..fed10c687 100644 --- a/src/spicelib/parser/inpeval.c +++ b/src/spicelib/parser/inpeval.c @@ -372,7 +372,7 @@ INPevaluateRKM_R(char** line, int* error, int gobble) int num; char ch; if (sscanf(here + 1, "%i%c", &num, &ch) == 1) { - expo1 = expo1; + //expo1 = expo1; hasmulti = TRUE; } else { @@ -612,7 +612,7 @@ INPevaluateRKM_C(char** line, int* error, int gobble) case 'r': case 'R': - expo1 = expo1; + //expo1 = expo1; hasmulti = TRUE; break; case 'n': @@ -850,7 +850,7 @@ INPevaluateRKM_L(char** line, int* error, int gobble) case 'r': case 'R': - expo1 = expo1; + //expo1 = expo1; hasmulti = TRUE; break; case 'n':