muffle compiler warnings

This commit is contained in:
rlar 2010-07-24 18:51:06 +00:00
parent d0a7220f6f
commit 4cdd842cd8
20 changed files with 113 additions and 49 deletions

View File

@ -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 ,

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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));

View File

@ -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) {

View File

@ -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 <file name> <lib name> */
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 <file name> <lib name> */
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);

View File

@ -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) ;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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 == /*(*/')')

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;
}