From 4cdd842cd867d05c242425a503babe1c1660cb3a Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 24 Jul 2010 18:51:06 +0000 Subject: [PATCH] muffle compiler warnings --- ChangeLog | 24 ++++++++++++ src/ciderlib/input/meshset.c | 6 ++- src/frontend/breakp.c | 3 +- src/frontend/com_alias.c | 3 +- src/frontend/define.c | 9 +++-- src/frontend/dotcards.c | 3 +- src/frontend/inpcom.c | 60 +++++++++++++++++++----------- src/frontend/numparam/xpressn.c | 4 +- src/frontend/parser/backq.c | 3 +- src/frontend/parser/lexical.c | 4 +- src/frontend/runcoms.c | 6 ++- src/frontend/shyu.c | 5 ++- src/frontend/variable.c | 11 ++++-- src/misc/string.c | 2 +- src/misc/util.c | 3 +- src/misc/wlist.c | 3 +- src/spicelib/devices/cpl/cplload.c | 3 +- src/spicelib/devices/txl/txlload.c | 3 +- src/spicelib/parser/inp2dot.c | 4 +- src/xspice/cmpp/mod_yacc.y | 3 +- 20 files changed, 113 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 671e342a0..c097e43bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2010-07-24 Robert Larice + * src/ciderlib/input/meshset.c , + * src/frontend/breakp.c , + * src/frontend/com_alias.c , + * src/frontend/define.c , + * src/frontend/dotcards.c , + * src/frontend/inpcom.c , + * src/frontend/numparam/xpressn.c , + * src/frontend/parser/backq.c , + * src/frontend/parser/lexical.c , + * src/frontend/runcoms.c , + * src/frontend/shyu.c , + * src/frontend/variable.c , + * src/misc/string.c , + * src/misc/util.c , + * src/misc/wlist.c , + * src/spicelib/devices/cpl/cplload.c , + * src/spicelib/devices/txl/txlload.c , + * src/spicelib/parser/inp2dot.c , + * src/xspice/cmpp/mod_yacc.y : + muffle compiler warnings + suggest a space before ';' or explicit braces around empty + and similar things. + 2010-07-24 Robert Larice * src/frontend/inpcom.c , * src/spicelib/devices/ndev/ndevparm.c , diff --git a/src/ciderlib/input/meshset.c b/src/ciderlib/input/meshset.c index 21392f25b..3613fc16a 100644 --- a/src/ciderlib/input/meshset.c +++ b/src/ciderlib/input/meshset.c @@ -92,7 +92,8 @@ MESHiBounds(MESHcoord *coordList, int *ixMin, int *ixMax) if (coordList) { *ixMin = coordList->number; - for ( last = coordList; last->next != NIL(MESHcoord); last = last->next ); + for ( last = coordList; last->next != NIL(MESHcoord); last = last->next ) + ; *ixMax = last->number; } else { @@ -118,7 +119,8 @@ MESHlBounds(MESHcoord *coordList, double *lcMin, double *lcMax) if (coordList) { *lcMin = coordList->location; - for ( last = coordList; last->next != NIL(MESHcoord); last = last->next ); + for ( last = coordList; last->next != NIL(MESHcoord); last = last->next ) + ; *lcMax = last->location; } else { diff --git a/src/frontend/breakp.c b/src/frontend/breakp.c index a55e4dc67..4ae94c830 100644 --- a/src/frontend/breakp.c +++ b/src/frontend/breakp.c @@ -112,7 +112,8 @@ com_stop(wordlist *wl) } if (thisone) { if (dbs) { - for (d = dbs; d->db_next; d = d->db_next); + for (d = dbs; d->db_next; d = d->db_next) + ; d->db_next = thisone; } else dbs = thisone; diff --git a/src/frontend/com_alias.c b/src/frontend/com_alias.c index 645dc004d..805ff035c 100644 --- a/src/frontend/com_alias.c +++ b/src/frontend/com_alias.c @@ -41,7 +41,8 @@ asubst(wordlist *wlist) cp_lastone->hi_wlist = wl_copy(wl); } else { /* If it had no history args, then append the rest of the wl */ - for (w = wl; w->wl_next; w = w->wl_next); + for (w = wl; w->wl_next; w = w->wl_next) + ; w->wl_next = wl_copy(wlist->wl_next); if (w->wl_next) w->wl_next->wl_prev = w; diff --git a/src/frontend/define.c b/src/frontend/define.c index fa9094b3c..d7c3c0e0e 100644 --- a/src/frontend/define.c +++ b/src/frontend/define.c @@ -62,7 +62,8 @@ com_define(wordlist *wlist) wl = wl->wl_next) (void) strcat(buf, wl->wl_word); if (wl) { - for (t = buf; *t; t++); + for (t = buf; *t; t++) + ; for (s = wl->wl_word; *s && (*s != /* ( */ ')'); s++, t++) *t = *s; *t++ = /* ( */ ')'; @@ -219,7 +220,8 @@ prtree(struct udfunc *ud) /* Print the head. */ buf[0] = '\0'; (void) strcat(buf, ud->ud_name); - for (s = ud->ud_name; *s; s++); + for (s = ud->ud_name; *s; s++) + ; (void) strcat(buf, " ("); s++; while (*s) { @@ -329,7 +331,8 @@ trcopy(struct pnode *tree, char *args, struct pnode *nn) break; else i++; - while (*s++); /* Get past the last '\0'. */ + while (*s++) /* Get past the last '\0'. */ + ; } if (*s) return (ntharg(i, nn)); diff --git a/src/frontend/dotcards.c b/src/frontend/dotcards.c index 9324e85b7..37afcef80 100644 --- a/src/frontend/dotcards.c +++ b/src/frontend/dotcards.c @@ -369,9 +369,10 @@ ft_cktcoms(bool terse) } nocmds: - /* Now the node table */ + /* Now the node table if (ft_nodesprint) ; + */ /* The options */ if (ft_optsprint) { diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 75b327070..9bfd85d78 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1162,7 +1162,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c /* now handle .title statement */ if (ciprefix(".title", buffer)) { - for ( s = buffer; *s && !isspace(*s); s++ ); /* skip over .title */ + for ( s = buffer; *s && !isspace(*s); s++ ) /* skip over .title */ + ; while ( isspace(*s) ) s++; /* advance past space chars */ /* only the last title line remains valid */ @@ -1173,19 +1174,22 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c /* now handle .lib statements */ if (ciprefix(".lib", buffer)) { - for ( s = buffer; *s && !isspace(*s); s++ ); /* skip over .lib */ + for ( s = buffer; *s && !isspace(*s); s++ ) /* skip over .lib */ + ; while ( isspace(*s) || isquote(*s) ) s++; /* advance past space chars */ if ( !*s ) { /* if at end of line, error */ fprintf(cp_err, "Error: .lib filename missing\n"); tfree(buffer); /* was allocated by readline() */ continue; } /* Now s points to first char after .lib */ - for ( t = s; *t && !isspace(*t) && !isquote(*t); t++ ); /* skip to end of word */ + for ( t = s; *t && !isspace(*t) && !isquote(*t); t++ ) /* skip to end of word */ + ; y = t; while ( isspace(*y) || isquote(*y) ) y++; /* advance past space chars */ // check if rest of line commented out if ( *y && *y != '$' ) { /* .lib */ - for ( z = y; *z && !isspace(*z) && !isquote(*z); z++ ); + for ( z = y; *z && !isspace(*z) && !isquote(*z); z++ ) + ; c = *t; *t = '\0'; *z = '\0'; @@ -1442,9 +1446,11 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c controlled_exit(EXIT_FAILURE); } - for ( s = buffer; *s && !isspace(*s); s++ ); /* skip over .lib */ + for ( s = buffer; *s && !isspace(*s); s++ ) /* skip over .lib */ + ; while ( isspace(*s) || isquote(*s) ) s++; /* advance past space chars */ - for ( t = s; *t && !isspace(*t) && !isquote(*t); t++ ); /* skip to end of word */ + for ( t = s; *t && !isspace(*t) && !isquote(*t); t++ ) /* skip to end of word */ + ; keep_char = *t; *t = '\0'; /* see if library we want to copy */ @@ -1803,9 +1809,11 @@ inp_fix_subckt( char *s ) if ( !strstr( s, "params:" ) && equal != NULL ) { /* get subckt name (ptr1 will point to name) */ - for ( ptr1 = s; *ptr1 && !isspace(*ptr1); ptr1++ ); + for ( ptr1 = s; *ptr1 && !isspace(*ptr1); ptr1++ ) + ; while ( isspace(*ptr1) ) ptr1++; - for ( ptr2 = ptr1; *ptr2 && !isspace(*ptr2) && !isquote(*ptr2); ptr2++ ); + for ( ptr2 = ptr1; *ptr2 && !isspace(*ptr2) && !isquote(*ptr2); ptr2++ ) + ; keep = *ptr2; *ptr2 = '\0'; @@ -1817,8 +1825,10 @@ inp_fix_subckt( char *s ) /* go to beginning of first parameter word */ /* s will contain only subckt definition */ /* beg will point to start of param list */ - for ( beg = equal-1; *beg && isspace(*beg); beg-- ); - for ( ; *beg && !isspace(*beg); beg-- ); + for ( beg = equal-1; *beg && isspace(*beg); beg-- ) + ; + for ( ; *beg && !isspace(*beg); beg-- ) + ; *beg = '\0'; beg++; @@ -2005,9 +2015,11 @@ inp_determine_libraries( struct line *deck, char *lib_name ) if ( ciprefix( ".endl", line ) && lib_name != NULL ) read_line = FALSE; if ( ciprefix( "*lib", line ) || ciprefix( ".lib", line ) ) { - for ( s = line; *s && !isspace(*s); s++); + for ( s = line; *s && !isspace(*s); s++) + ; while ( isspace(*s) || isquote(*s) ) s++; - for ( t = s; *t && !isspace(*t) && !isquote(*t); t++ ); + for ( t = s; *t && !isspace(*t) && !isquote(*t); t++ ) + ; y = t; while ( isspace(*y) || isquote(*y) ) y++; @@ -2021,7 +2033,8 @@ inp_determine_libraries( struct line *deck, char *lib_name ) } /* .lib */ else if ( read_line == TRUE ) { - for ( z = y; *z && !isspace(*z) && !isquote(*z); z++ ); + for ( z = y; *z && !isspace(*z) && !isquote(*z); z++ ) + ; keep_char1 = *t; keep_char2 = *z; *t = '\0'; *z = '\0'; @@ -2071,14 +2084,16 @@ inp_get_subckt_name( char *s ) if ( end_ptr != NULL ) { end_ptr--; while ( isspace(*end_ptr) ) end_ptr--; - for( ;*end_ptr && !isspace(*end_ptr); end_ptr--); + for(; *end_ptr && !isspace(*end_ptr); end_ptr--) + ; } else { end_ptr = s + strlen(s); } subckt_name = end_ptr; while ( isspace( *subckt_name ) ) subckt_name--; - for( ; !isspace(*subckt_name); subckt_name-- ); + for(; !isspace(*subckt_name); subckt_name-- ) + ; subckt_name++; keep = *end_ptr; @@ -2294,7 +2309,8 @@ inp_fix_inst_calls_for_numparam(struct line *deck) while ( d != NULL ) { subckt_line = d->li_line; if ( ciprefix( ".subckt", subckt_line ) ) { - for ( ; *subckt_line && !isspace(*subckt_line); subckt_line++ ); + for ( ; *subckt_line && !isspace(*subckt_line); subckt_line++ ) + ; while ( isspace(*subckt_line) ) subckt_line++; sprintf( name_w_space, "%s ", subckt_name ); @@ -2344,7 +2360,8 @@ inp_fix_inst_calls_for_numparam(struct line *deck) while ( d != NULL ) { subckt_line = d->li_line; if ( ciprefix( ".subckt", subckt_line ) ) { - for ( ; *subckt_line && !isspace(*subckt_line); subckt_line++ ); + for ( ; *subckt_line && !isspace(*subckt_line); subckt_line++ ) + ; while ( isspace(*subckt_line) ) subckt_line++; if ( strncmp( subckt_line, name_w_space, strlen(name_w_space) ) == 0 ) { @@ -2571,7 +2588,8 @@ inp_expand_macro_in_str( char *str ) while ( ( open_paren_ptr = strstr( search_ptr, "(" ) ) ) { fcn_name = open_paren_ptr; if ( open_paren_ptr != search_ptr) { - while ( --fcn_name != search_ptr && (isalnum(*fcn_name) || *fcn_name == '_') ); + while ( --fcn_name != search_ptr && (isalnum(*fcn_name) || *fcn_name == '_') ) + ; if ( !isalnum(*fcn_name) && *fcn_name != '_' ) fcn_name++; } @@ -3917,7 +3935,7 @@ static void inp_compat(struct line *deck) */ else if ( *curr_line == '.' ) { // replace .probe by .save - if(str_ptr = strstr(curr_line, ".probe")) + if((str_ptr = strstr(curr_line, ".probe")) != NULL) memcpy(str_ptr, ".save ", 6); /* Various formats for measure statement: @@ -3964,7 +3982,7 @@ static void inp_compat(struct line *deck) if (strstr(curr_line, "par") == NULL) continue; cut_line = curr_line; // search for 'par' - while(str_ptr = strstr(cut_line, "par")) { + while((str_ptr = strstr(cut_line, "par")) != NULL) { if (i > 99) { fprintf(stderr, "ERROR: No more than 99 'par' per input file\n", curr_line); @@ -4081,7 +4099,7 @@ static void inp_compat(struct line *deck) if (strstr(curr_line, "par") == NULL) continue; cut_line = curr_line; // search for 'par' - while(str_ptr = strstr(cut_line, "par")) { + while((str_ptr = strstr(cut_line, "par")) != NULL) { if (pai > 99) { fprintf(stderr, "ERROR: No more than 99 'par' per input file!\n", curr_line); diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 12eda60da..b6e077900 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -2139,8 +2139,8 @@ nupa_assignment (tdico * dico, char *s, char mode) if ((i < ls) && (s[i - 1] != ';')) error = message (dico, " ; sign expected."); - else - /* i++ */; + /* else + i++; */ } spice_dstring_free(&tstr) ; spice_dstring_free(&ustr) ; diff --git a/src/frontend/parser/backq.c b/src/frontend/parser/backq.c index fe15697ce..823314542 100644 --- a/src/frontend/parser/backq.c +++ b/src/frontend/parser/backq.c @@ -61,7 +61,8 @@ loop: s =strchr(t, cp_back); (void) strcpy(tbuf, t); wl = wl_splice(wl, nwl); - for(wlist = wl; wlist->wl_prev; wlist = wlist->wl_prev); + for(wlist = wl; wlist->wl_prev; wlist = wlist->wl_prev) + ; /* MW. We must move to the begging of new wordlist. */ (void) strcpy(buf, wl->wl_word); diff --git a/src/frontend/parser/lexical.c b/src/frontend/parser/lexical.c index 8845989e7..ee034cdb6 100644 --- a/src/frontend/parser/lexical.c +++ b/src/frontend/parser/lexical.c @@ -165,8 +165,8 @@ gotchar: if ((c == cp_hash) && !cp_interactive && (j == 1)) { if (string) return (NULL); - while (((c = input(cp_inp_cur)) != '\n') && - (c != EOF)); + while (((c = input(cp_inp_cur)) != '\n') && (c != EOF)) + ; goto nloop; } diff --git a/src/frontend/runcoms.c b/src/frontend/runcoms.c index 700f641ba..1ebed7ebe 100644 --- a/src/frontend/runcoms.c +++ b/src/frontend/runcoms.c @@ -72,7 +72,8 @@ com_scirc(wordlist *wl) clearerr(cp_in); if ((sscanf(buf, " %d ", &i) != 1) || (i < 0) || (i > j)) return; - for (p = ft_circuits; --i > 0; p = p->ci_next); + for (p = ft_circuits; --i > 0; p = p->ci_next) + ; } else { for (p = ft_circuits; p; p = p->ci_next) j++; @@ -80,7 +81,8 @@ com_scirc(wordlist *wl) p=NULL; if ((sscanf(wl->wl_word, " %d ", &i) != 1) || (i < 0) || (i > j)); else - for (p = ft_circuits; --i > 0; p = p->ci_next); + for (p = ft_circuits; --i > 0; p = p->ci_next) + ; /* for (p = ft_circuits; p; p = p->ci_next) * if (ciprefix(wl->wl_word, p->ci_name)) * break; diff --git a/src/frontend/shyu.c b/src/frontend/shyu.c index 8715c22d7..31b67b7b8 100644 --- a/src/frontend/shyu.c +++ b/src/frontend/shyu.c @@ -90,8 +90,9 @@ if_sens_run(CKTcircuit *t, wordlist *args, INPtables *tab) } ft_curckt->ci_curOpt = ft_curckt->ci_specOpt; } - else ; - { /* in DEEP trouble */ + else { + /* in DEEP trouble */ + ; } ft_curckt->ci_curTask = ft_curckt->ci_specTask; which = -1; diff --git a/src/frontend/variable.c b/src/frontend/variable.c index 37e7b8fc5..81e49a450 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -552,9 +552,14 @@ cp_getvar(char *name, enum cp_types type, void *retval) fprintf(stderr,"in cp_getvar, trying to get value of variable %s.\n", name); #endif - for (v = variables; v && !eq(name, v->va_name); v = v->va_next); - if (v == NULL) for (v = uv1; v && !eq(name, v->va_name); v = v->va_next); - if (v == NULL) for (v = uv2; v && !eq(name, v->va_name); v = v->va_next); + for (v = variables; v && !eq(name, v->va_name); v = v->va_next) + ; + if (v == NULL) + for (v = uv1; v && !eq(name, v->va_name); v = v->va_next) + ; + if (v == NULL) + for (v = uv2; v && !eq(name, v->va_name); v = v->va_next) + ; if (v == NULL) { if (type == CP_BOOL && retval) diff --git a/src/misc/string.c b/src/misc/string.c index 1c93f2201..f5e8475b0 100644 --- a/src/misc/string.c +++ b/src/misc/string.c @@ -258,7 +258,7 @@ gettok_iv(char **s) spice_dstring_init(&buf); // add v or i to buf spice_dstring_append_char( &buf, *(*s)++ ) ; - while (c = **s) { + while ((c = **s) != '\0') { if (c == '('/*)*/) paren += 1; else if (c == /*(*/')') diff --git a/src/misc/util.c b/src/misc/util.c index 930fa28d7..7a05243d8 100644 --- a/src/misc/util.c +++ b/src/misc/util.c @@ -93,7 +93,8 @@ canonicalize_pathname(char *path) /* Handle `../' or trailing `..' by itself. */ if (result[i + 1] == '.' && (result[i + 2] == '/' || !result[i + 2])) { - while (--start > -1 && result[start] != '/'); + while (--start > -1 && result[start] != '/') + ; strcpy(result + start + 1, result + i + 2); i = (start < 0) ? 0 : start; continue; diff --git a/src/misc/wlist.c b/src/misc/wlist.c index 32eeb01d3..db0bd0eb0 100644 --- a/src/misc/wlist.c +++ b/src/misc/wlist.c @@ -163,7 +163,8 @@ wl_append(wordlist *wlist, wordlist *nwl) return (nwl); if (nwl == NULL) return (wlist); - for (wl = wlist; wl->wl_next; wl = wl->wl_next); + for (wl = wlist; wl->wl_next; wl = wl->wl_next) + ; wl->wl_next = nwl; nwl->wl_prev = wl; return (wlist); diff --git a/src/spicelib/devices/cpl/cplload.c b/src/spicelib/devices/cpl/cplload.c index 63272e2d5..2f3bfccfb 100644 --- a/src/spicelib/devices/cpl/cplload.c +++ b/src/spicelib/devices/cpl/cplload.c @@ -748,7 +748,8 @@ get_pvs_vi(int t1, int t2, ratio[i] = f = (tb[i] - t1) / (t2 - t1); if (vi) - for (; vi->next; vi = vi->next); + for (; vi->next; vi = vi->next) + ; else vi = vi1; f = 1 - f; diff --git a/src/spicelib/devices/txl/txlload.c b/src/spicelib/devices/txl/txlload.c index e8aea01d5..48843dbff 100644 --- a/src/spicelib/devices/txl/txlload.c +++ b/src/spicelib/devices/txl/txlload.c @@ -446,7 +446,8 @@ get_pvs_vi_txl(int t1, int t2, TXLine *tx, double *v1_i, double *v2_i, double *i */ ratio[0] = f = (tb - t1) / (t2 - t1); if (vi) - for (; vi->time != t1; vi = vi->next); + for (; vi->time != t1; vi = vi->next) + ; else vi = vi1; f = 1 - f; diff --git a/src/spicelib/parser/inp2dot.c b/src/spicelib/parser/inp2dot.c index 211451d2b..abee0859a 100644 --- a/src/spicelib/parser/inp2dot.c +++ b/src/spicelib/parser/inp2dot.c @@ -96,8 +96,8 @@ dot_noise(char *line, CKTcircuit *ckt, INPtables *tab, card *current, /* now see if "ptspersum" has been specified by the user */ - for (found = 0, point = line; (!found) && (*point != '\0'); - found = ((*point != ' ') && (*(point++) != '\t'))); + for (found = 0, point = line; (!found) && (*point != '\0'); found = ((*point != ' ') && (*(point++) != '\t'))) + ; if (found) { parm = INPgetValue(ckt, &line, IF_INTEGER, tab); error = INPapName(ckt, which, foo, "ptspersum", parm); diff --git a/src/xspice/cmpp/mod_yacc.y b/src/xspice/cmpp/mod_yacc.y index 0c9d56685..83ee5839f 100755 --- a/src/xspice/cmpp/mod_yacc.y +++ b/src/xspice/cmpp/mod_yacc.y @@ -128,7 +128,8 @@ int local_strcmpi(char *s, char *t) /* string compare - case insensitive */ { - for (; *s && t && tolower(*s) == tolower(*t); s++, t++); + for (; *s && t && tolower(*s) == tolower(*t); s++, t++) + ; if (*s && !*t) { return 1; }