embryo: remove simple -Wshadow errors. Dangerous/uncertain left.

The follow are left:
{{{
bin/embryo/embryo_cc_sc1.c: In function ‘dowhile’:
bin/embryo/embryo_cc_sc1.c:3524:24: warning: declaration of ‘wq’ shadows a global declaration [-Wshadow]
bin/embryo/embryo_cc_sc1.c:115:21: warning: shadowed declaration is here [-Wshadow]
bin/embryo/embryo_cc_sc1.c: In function ‘dodo’:
bin/embryo/embryo_cc_sc1.c:3546:24: warning: declaration of ‘wq’ shadows a global declaration [-Wshadow]
bin/embryo/embryo_cc_sc1.c:115:21: warning: shadowed declaration is here [-Wshadow]
bin/embryo/embryo_cc_sc1.c: In function ‘dofor’:
bin/embryo/embryo_cc_sc1.c:3565:24: warning: declaration of ‘wq’ shadows a global declaration [-Wshadow]
bin/embryo/embryo_cc_sc1.c:115:21: warning: shadowed declaration is here [-Wshadow]
}}}

looking at their code, they say to alloc a local "wq", but then they
call functions such as delwhile() that changes the global... VERY suspicious!!




SVN revision: 82734
This commit is contained in:
Gustavo Sverzut Barbieri 2013-01-13 23:54:21 +00:00
parent 0099729e09
commit 62bca66249
5 changed files with 127 additions and 127 deletions

View File

@ -449,11 +449,11 @@ sc_compile(int argc, char *argv[])
} }
int int
sc_addconstant(char *name, cell value, int tag) sc_addconstant(char *name, cell val, int tag)
{ {
errorset(sFORCESET); /* make sure error engine is silenced */ errorset(sFORCESET); /* make sure error engine is silenced */
sc_status = statIDLE; sc_status = statIDLE;
add_constant(name, value, sGLOBAL, tag); add_constant(name, val, sGLOBAL, tag);
return 1; return 1;
} }
@ -1585,7 +1585,7 @@ static void
decl_enum(int vclass) decl_enum(int vclass)
{ {
char enumname[sNAMEMAX + 1], constname[sNAMEMAX + 1]; char enumname[sNAMEMAX + 1], constname[sNAMEMAX + 1];
cell val, value, size; cell lexval, enumvalue, size;
char *str; char *str;
int tok, tag, explicittag; int tok, tag, explicittag;
cell increment, multiplier; cell increment, multiplier;
@ -1594,7 +1594,7 @@ decl_enum(int vclass)
* explicit tag was passed, even if that explicit tag was "_:", so we * explicit tag was passed, even if that explicit tag was "_:", so we
* cannot call sc_addtag() here * cannot call sc_addtag() here
*/ */
if (lex(&val, &str) == tLABEL) if (lex(&lexval, &str) == tLABEL)
{ {
tag = sc_addtag(str); tag = sc_addtag(str);
explicittag = TRUE; explicittag = TRUE;
@ -1608,7 +1608,7 @@ decl_enum(int vclass)
/* get optional enum name (also serves as a tag if no explicit /* get optional enum name (also serves as a tag if no explicit
* tag was set) */ * tag was set) */
if (lex(&val, &str) == tSYMBOL) if (lex(&lexval, &str) == tSYMBOL)
{ /* read in (new) token */ { /* read in (new) token */
strcpy(enumname, str); /* save enum name (last constant) */ strcpy(enumname, str); /* save enum name (last constant) */
if (!explicittag) if (!explicittag)
@ -1635,8 +1635,8 @@ decl_enum(int vclass)
} }
else if (matchtoken(taSHL)) else if (matchtoken(taSHL))
{ {
constexpr(&val, NULL); constexpr(&lexval, NULL);
while (val-- > 0) while (lexval-- > 0)
multiplier *= 2; multiplier *= 2;
} /* if */ } /* if */
needtoken(')'); needtoken(')');
@ -1644,7 +1644,7 @@ decl_enum(int vclass)
needtoken('{'); needtoken('{');
/* go through all constants */ /* go through all constants */
value = 0; /* default starting value */ enumvalue = 0; /* default starting value */
do do
{ {
if (matchtoken('}')) if (matchtoken('}'))
@ -1652,7 +1652,7 @@ decl_enum(int vclass)
lexpush(); lexpush();
break; break;
} /* if */ } /* if */
tok = lex(&val, &str); /* read in (new) token */ tok = lex(&lexval, &str); /* read in (new) token */
if (tok != tSYMBOL && tok != tLABEL) if (tok != tSYMBOL && tok != tLABEL)
error(20, str); /* invalid symbol name */ error(20, str); /* invalid symbol name */
strcpy(constname, str); /* save symbol name */ strcpy(constname, str); /* save symbol name */
@ -1660,14 +1660,14 @@ decl_enum(int vclass)
if (tok == tLABEL || matchtoken(':')) if (tok == tLABEL || matchtoken(':'))
constexpr(&size, NULL); /* get size */ constexpr(&size, NULL); /* get size */
if (matchtoken('=')) if (matchtoken('='))
constexpr(&value, NULL); /* get value */ constexpr(&enumvalue, NULL); /* get value */
/* add_constant() checks whether a variable (global or local) or /* add_constant() checks whether a variable (global or local) or
* a constant with the same name already exists */ * a constant with the same name already exists */
add_constant(constname, value, vclass, tag); add_constant(constname, enumvalue, vclass, tag);
if (multiplier == 1) if (multiplier == 1)
value += size; enumvalue += size;
else else
value *= size * multiplier; enumvalue *= size * multiplier;
} }
while (matchtoken(',')); while (matchtoken(','));
needtoken('}'); /* terminates the constant list */ needtoken('}'); /* terminates the constant list */
@ -1675,7 +1675,7 @@ decl_enum(int vclass)
/* set the enum name to the last value plus one */ /* set the enum name to the last value plus one */
if (enumname[0] != '\0') if (enumname[0] != '\0')
add_constant(enumname, value, vclass, tag); add_constant(enumname, enumvalue, vclass, tag);
} }
/* /*
@ -2728,11 +2728,11 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
if (needtoken(tSYMBOL)) if (needtoken(tSYMBOL))
{ {
/* save the name of the argument whose size id to take */ /* save the name of the argument whose size id to take */
char *name; char *argname;
cell val; cell val;
tokeninfo(&val, &name); tokeninfo(&val, &argname);
if (!(arg->defvalue.size.symname = strdup(name))) if (!(arg->defvalue.size.symname = strdup(argname)))
error(103); /* insufficient memory */ error(103); /* insufficient memory */
arg->defvalue.size.level = 0; arg->defvalue.size.level = 0;
if (size_tag_token == uSIZEOF) if (size_tag_token == uSIZEOF)
@ -3406,7 +3406,7 @@ constexpr(cell * val, int *tag)
* Global references: intest (altered, but restored upon termination) * Global references: intest (altered, but restored upon termination)
*/ */
static void static void
test(int label, int parens, int invert) test(int label, int parens, int inv)
{ {
int idx, tok; int idx, tok;
cell cidx; cell cidx;
@ -3469,8 +3469,8 @@ test(int label, int parens, int invert)
} /* if */ } /* if */
if (lval.tag != 0 && lval.tag != sc_addtag("bool")) if (lval.tag != 0 && lval.tag != sc_addtag("bool"))
if (check_userop(lneg, lval.tag, 0, 1, NULL, &lval.tag)) if (check_userop(lneg, lval.tag, 0, 1, NULL, &lval.tag))
invert = !invert; /* user-defined ! operator inverted result */ inv = !inv; /* user-defined ! operator inverted result */
if (invert) if (inv)
jmp_ne0(label); /* jump to label if true (different from 0) */ jmp_ne0(label); /* jump to label if true (different from 0) */
else else
jmp_eq0(label); /* jump to label if false (equal to 0) */ jmp_eq0(label); /* jump to label if false (equal to 0) */

View File

@ -157,12 +157,12 @@ plungefile(char *name, int try_currentpath, int try_includepaths)
} }
static void static void
check_empty(char *lptr) check_empty(const char *sptr)
{ {
/* verifies that the string contains only whitespace */ /* verifies that the string contains only whitespace */
while (*lptr <= ' ' && *lptr != '\0') while (*sptr <= ' ' && *sptr != '\0')
lptr++; sptr++;
if (*lptr != '\0') if (*sptr != '\0')
error(38); /* extra characters on line */ error(38); /* extra characters on line */
} }
@ -235,7 +235,6 @@ static void
readline(char *line) readline(char *line)
{ {
int i, num, cont; int i, num, cont;
char *ptr;
if (lptr == term_expr) if (lptr == term_expr)
return; return;
@ -285,15 +284,16 @@ readline(char *line)
} }
else else
{ {
char *ptr;
/* check whether to erase leading spaces */ /* check whether to erase leading spaces */
if (cont) if (cont)
{ {
char *ptr = line; char *sptr = line;
while (*ptr == ' ' || *ptr == '\t') while (*sptr == ' ' || *sptr == '\t')
ptr++; sptr++;
if (ptr != line) if (sptr != line)
memmove(line, ptr, strlen(ptr) + 1); memmove(line, sptr, strlen(sptr) + 1);
} /* if */ } /* if */
cont = FALSE; cont = FALSE;
/* check whether a full line was read */ /* check whether a full line was read */
@ -694,13 +694,13 @@ static int
number(cell * val, char *curptr) number(cell * val, char *curptr)
{ {
int i; int i;
cell value; cell curval;
if ((i = btoi(&value, curptr)) != 0 /* binary? */ if ((i = btoi(&curval, curptr)) != 0 /* binary? */
|| (i = htoi(&value, curptr)) != 0 /* hexadecimal? */ || (i = htoi(&curval, curptr)) != 0 /* hexadecimal? */
|| (i = dtoi(&value, curptr)) != 0) /* decimal? */ || (i = dtoi(&curval, curptr)) != 0) /* decimal? */
{ {
*val = value; *val = curval;
return i; return i;
} }
else else
@ -983,10 +983,10 @@ command(void)
} }
else if (strcmp(str, "compress") == 0) else if (strcmp(str, "compress") == 0)
{ {
cell val; cell compval;
preproc_expr(&val, NULL); preproc_expr(&compval, NULL);
sc_compress = (int)val; /* switch code packing on/off */ sc_compress = (int)compval; /* switch code packing on/off */
} }
else if (strcmp(str, "dynamic") == 0) else if (strcmp(str, "dynamic") == 0)
{ {
@ -1029,10 +1029,10 @@ command(void)
} }
else if (strcmp(str, "pack") == 0) else if (strcmp(str, "pack") == 0)
{ {
cell val; cell packval;
preproc_expr(&val, NULL); /* default = packed/unpacked */ preproc_expr(&packval, NULL); /* default = packed/unpacked */
sc_packstr = (int)val; sc_packstr = (int)packval;
} }
else if (strcmp(str, "rational") == 0) else if (strcmp(str, "rational") == 0)
{ {
@ -1080,17 +1080,17 @@ command(void)
} }
else if (strcmp(str, "semicolon") == 0) else if (strcmp(str, "semicolon") == 0)
{ {
cell val; cell semicolval;
preproc_expr(&val, NULL); preproc_expr(&semicolval, NULL);
sc_needsemicolon = (int)val; sc_needsemicolon = (int)semicolval;
} }
else if (strcmp(str, "tabsize") == 0) else if (strcmp(str, "tabsize") == 0)
{ {
cell val; cell tabsizeval;
preproc_expr(&val, NULL); preproc_expr(&tabsizeval, NULL);
sc_tabsize = (int)val; sc_tabsize = (int)tabsizeval;
} }
else if (strcmp(str, "align") == 0) else if (strcmp(str, "align") == 0)
{ {
@ -1479,7 +1479,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
{ {
int prefixlen; int prefixlen;
char *p, *s, *e, *args[10]; char *p, *s, *e, *args[10];
int match, arg, len; int is_match, arg, len;
memset(args, 0, sizeof args); memset(args, 0, sizeof args);
@ -1495,8 +1495,8 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
*/ */
s = line + prefixlen; s = line + prefixlen;
p = pattern + prefixlen; p = pattern + prefixlen;
match = TRUE; /* so far, pattern matches */ is_match = TRUE; /* so far, pattern matches */
while (match && *s != '\0' && *p != '\0') while (is_match && *s != '\0' && *p != '\0')
{ {
if (*p == '%') if (*p == '%')
{ {
@ -1543,14 +1543,14 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
else else
{ {
assert(*e == '\0' || *e == '\n'); assert(*e == '\0' || *e == '\n');
match = FALSE; is_match = FALSE;
s = e; s = e;
} /* if */ } /* if */
p++; p++;
} }
else else
{ {
match = FALSE; is_match = FALSE;
} /* if */ } /* if */
} }
else if (*p == ';' && *(p + 1) == '\0' && !sc_needsemicolon) else if (*p == ';' && *(p + 1) == '\0' && !sc_needsemicolon)
@ -1559,7 +1559,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
while (*s <= ' ' && *s != '\0') while (*s <= ' ' && *s != '\0')
s++; /* skip white space */ s++; /* skip white space */
if (*s != ';' && *s != '\0') if (*s != ';' && *s != '\0')
match = FALSE; is_match = FALSE;
p++; /* skip the semicolon in the pattern */ p++; /* skip the semicolon in the pattern */
} }
else else
@ -1575,23 +1575,23 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
s++; /* skip white space */ s++; /* skip white space */
ch = litchar(&p, FALSE); /* this increments "p" */ ch = litchar(&p, FALSE); /* this increments "p" */
if (*s != ch) if (*s != ch)
match = FALSE; is_match = FALSE;
else else
s++; /* this character matches */ s++; /* this character matches */
} /* if */ } /* if */
} /* while */ } /* while */
if (match && *p == '\0') if (is_match && *p == '\0')
{ {
/* if the last character to match is an alphanumeric character, the /* if the last character to match is an alphanumeric character, the
* current character in the source may not be alphanumeric * current character in the source may not be alphanumeric
*/ */
assert(p > pattern); assert(p > pattern);
if (alphanum(*(p - 1)) && alphanum(*s)) if (alphanum(*(p - 1)) && alphanum(*s))
match = FALSE; is_match = FALSE;
} /* if */ } /* if */
if (match) if (is_match)
{ {
/* calculate the length of the substituted string */ /* calculate the length of the substituted string */
for (e = substitution, len = 0; *e != '\0'; e++) for (e = substitution, len = 0; *e != '\0'; e++)
@ -1644,7 +1644,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
if (args[arg]) if (args[arg])
free(args[arg]); free(args[arg]);
return match; return is_match;
} }
static void static void
@ -1742,63 +1742,63 @@ preprocess(void)
} }
static char * static char *
unpackedstring(char *lptr, int rawstring) unpackedstring(char *sptr, int rawstring)
{ {
while (*lptr != '\0') while (*sptr != '\0')
{ {
/* check for doublequotes indicating the end of the string */ /* check for doublequotes indicating the end of the string */
if (*lptr == '\"') if (*sptr == '\"')
{ {
/* check whether there's another pair of quotes following. /* check whether there's another pair of quotes following.
* If so, paste the two strings together, thus * If so, paste the two strings together, thus
* "pants""off" becomes "pantsoff" * "pants""off" becomes "pantsoff"
*/ */
if (*(lptr + 1) == '\"') if (*(sptr + 1) == '\"')
lptr += 2; sptr += 2;
else else
break; break;
} }
if (*lptr == '\a') if (*sptr == '\a')
{ /* ignore '\a' (which was inserted at a line concatenation) */ { /* ignore '\a' (which was inserted at a line concatenation) */
lptr++; sptr++;
continue; continue;
} /* if */ } /* if */
stowlit(litchar(&lptr, rawstring)); /* litchar() alters "lptr" */ stowlit(litchar(&sptr, rawstring)); /* litchar() alters "lptr" */
} /* while */ } /* while */
stowlit(0); /* terminate string */ stowlit(0); /* terminate string */
return lptr; return sptr;
} }
static char * static char *
packedstring(char *lptr, int rawstring) packedstring(char *sptr, int rawstring)
{ {
int i; int i;
ucell val, c; ucell val, c;
i = sizeof(ucell) - (charbits / 8); /* start at most significant byte */ i = sizeof(ucell) - (charbits / 8); /* start at most significant byte */
val = 0; val = 0;
while (*lptr != '\0') while (*sptr != '\0')
{ {
/* check for doublequotes indicating the end of the string */ /* check for doublequotes indicating the end of the string */
if (*lptr == '\"') if (*sptr == '\"')
{ {
/* check whether there's another pair of quotes following. /* check whether there's another pair of quotes following.
* If so, paste the two strings together, thus * If so, paste the two strings together, thus
* "pants""off" becomes "pantsoff" * "pants""off" becomes "pantsoff"
*/ */
if (*(lptr + 1) == '\"') if (*(sptr + 1) == '\"')
lptr += 2; sptr += 2;
else else
break; break;
} }
if (*lptr == '\a') if (*sptr == '\a')
{ /* ignore '\a' (which was inserted at a line concatenation) */ { /* ignore '\a' (which was inserted at a line concatenation) */
lptr++; sptr++;
continue; continue;
} /* if */ } /* if */
c = litchar(&lptr, rawstring); /* litchar() alters "lptr" */ c = litchar(&sptr, rawstring); /* litchar() alters "sptr" */
if (c >= (ucell) (1 << charbits)) if (c >= (ucell) (1 << charbits))
error(43); /* character constant exceeds range */ error(43); /* character constant exceeds range */
val |= (c << 8 * i); val |= (c << 8 * i);
@ -1814,7 +1814,7 @@ packedstring(char *lptr, int rawstring)
stowlit(val); /* at least one zero character in "val" */ stowlit(val); /* at least one zero character in "val" */
else else
stowlit(0); /* add full cell of zeros */ stowlit(0); /* add full cell of zeros */
return lptr; return sptr;
} }
/* lex(lexvalue,lexsym) Lexical Analysis /* lex(lexvalue,lexsym) Lexical Analysis
@ -2230,7 +2230,7 @@ match(char *st, int end)
* litq (altered) * litq (altered)
*/ */
void void
stowlit(cell value) stowlit(cell val)
{ {
if (litidx >= litmax) if (litidx >= litmax)
{ {
@ -2243,7 +2243,7 @@ stowlit(cell value)
litq = p; litq = p;
} /* if */ } /* if */
assert(litidx < litmax); assert(litidx < litmax);
litq[litidx++] = value; litq[litidx++] = val;
} }
/* litchar /* litchar
@ -2256,12 +2256,12 @@ stowlit(cell value)
* but ddd must be decimal! * but ddd must be decimal!
*/ */
static cell static cell
litchar(char **lptr, int rawmode) litchar(char **p_str, int rawmode)
{ {
cell c = 0; cell c = 0;
unsigned char *cptr; unsigned char *cptr;
cptr = (unsigned char *)*lptr; cptr = (unsigned char *)*p_str;
if (rawmode || *cptr != sc_ctrlchar) if (rawmode || *cptr != sc_ctrlchar)
{ /* no escape character */ { /* no escape character */
c = *cptr; c = *cptr;
@ -2333,7 +2333,7 @@ litchar(char **lptr, int rawmode)
} /* switch */ } /* switch */
} /* if */ } /* if */
} /* if */ } /* if */
*lptr = (char *)cptr; *p_str = (char *)cptr;
assert(c >= 0 && c < 256); assert(c >= 0 && c < 256);
return c; return c;
} }
@ -2502,7 +2502,7 @@ namehash(char *name)
} }
static symbol * static symbol *
find_symbol(symbol * root, char *name, int fnumber) find_symbol(symbol * root, char *name, int fnum)
{ {
symbol *ptr = root->next; symbol *ptr = root->next;
unsigned long hash = namehash(name); unsigned long hash = namehash(name);
@ -2511,7 +2511,7 @@ find_symbol(symbol * root, char *name, int fnumber)
{ {
if (hash == ptr->hash && strcmp(name, ptr->name) == 0 if (hash == ptr->hash && strcmp(name, ptr->name) == 0
&& !ptr->parent && (ptr->fnumber < 0 && !ptr->parent && (ptr->fnumber < 0
|| ptr->fnumber == fnumber)) || ptr->fnumber == fnum))
return ptr; return ptr;
ptr = ptr->next; ptr = ptr->next;
} /* while */ } /* while */

View File

@ -759,7 +759,7 @@ calc(cell left, void (*oper) (), cell right, char *boolresult)
} }
int int
expression(int *constant, cell * val, int *tag, int chkfuncresult) expression(int *is_constant, cell * val, int *tag, int chkfuncresult)
{ {
value lval = { NULL, 0, 0, 0, 0, NULL }; value lval = { NULL, 0, 0, 0, 0, NULL };
@ -767,12 +767,12 @@ expression(int *constant, cell * val, int *tag, int chkfuncresult)
rvalue(&lval); rvalue(&lval);
if (lval.ident == iCONSTEXPR) if (lval.ident == iCONSTEXPR)
{ /* constant expression */ { /* constant expression */
*constant = TRUE; *is_constant = TRUE;
*val = lval.constval; *val = lval.constval;
} }
else else
{ {
*constant = FALSE; *is_constant = FALSE;
*val = 0; *val = 0;
} /* if */ } /* if */
if (tag) if (tag)
@ -1013,7 +1013,7 @@ hier14(value * lval1)
/* check the sizes of all sublevels too */ /* check the sizes of all sublevels too */
symbol *sym1 = lval3.sym; symbol *sym1 = lval3.sym;
symbol *sym2 = lval2.sym; symbol *sym2 = lval2.sym;
int i; int clvl;
assert(sym1 != NULL && sym2 != NULL); assert(sym1 != NULL && sym2 != NULL);
/* ^^^ sym2 must be valid, because only variables can be /* ^^^ sym2 must be valid, because only variables can be
@ -1021,7 +1021,7 @@ hier14(value * lval1)
* sym1 must be valid because it must be an lvalue * sym1 must be valid because it must be an lvalue
*/ */
assert(exactmatch); assert(exactmatch);
for (i = 0; i < level; i++) for (clvl = 0; clvl < level; clvl++)
{ {
sym1 = finddepend(sym1); sym1 = finddepend(sym1);
sym2 = finddepend(sym2); sym2 = finddepend(sym2);
@ -2118,37 +2118,37 @@ callfunction(symbol * sym)
} }
else else
{ {
symbol *sym = lval.sym; symbol *lsym = lval.sym;
short level = 0; short level = 0;
assert(sym != NULL); assert(lsym != NULL);
if (sym->dim.array.level + 1 != arg[argidx].numdim) if (lsym->dim.array.level + 1 != arg[argidx].numdim)
error(48); /* array dimensions must match */ error(48); /* array dimensions must match */
/* the lengths for all dimensions must match, unless the dimension /* the lengths for all dimensions must match, unless the dimension
* length was defined at zero (which means "undefined") * length was defined at zero (which means "undefined")
*/ */
while (sym->dim.array.level > 0) while (lsym->dim.array.level > 0)
{ {
assert(level < sDIMEN_MAX); assert(level < sDIMEN_MAX);
if (arg[argidx].dim[level] != 0 if (arg[argidx].dim[level] != 0
&& sym->dim.array.length != && lsym->dim.array.length !=
arg[argidx].dim[level]) arg[argidx].dim[level])
error(47); /* array sizes must match */ error(47); /* array sizes must match */
append_constval(&arrayszlst, arg[argidx].name, append_constval(&arrayszlst, arg[argidx].name,
sym->dim.array.length, level); lsym->dim.array.length, level);
sym = finddepend(sym); lsym = finddepend(lsym);
assert(sym != NULL); assert(lsym != NULL);
level++; level++;
} /* if */ } /* if */
/* the last dimension is checked too, again, unless it is zero */ /* the last dimension is checked too, again, unless it is zero */
assert(level < sDIMEN_MAX); assert(level < sDIMEN_MAX);
assert(sym != NULL); assert(lsym != NULL);
if (arg[argidx].dim[level] != 0 if (arg[argidx].dim[level] != 0
&& sym->dim.array.length != && lsym->dim.array.length !=
arg[argidx].dim[level]) arg[argidx].dim[level])
error(47); /* array sizes must match */ error(47); /* array sizes must match */
append_constval(&arrayszlst, arg[argidx].name, append_constval(&arrayszlst, arg[argidx].name,
sym->dim.array.length, level); lsym->dim.array.length, level);
} /* if */ } /* if */
/* address already in PRI */ /* address already in PRI */
if (!checktag if (!checktag
@ -2280,13 +2280,13 @@ callfunction(symbol * sym)
} }
else else
{ {
symbol *sym; symbol *lsym;
assert((arg[argidx].hasdefault & uTAGOF) != 0); assert((arg[argidx].hasdefault & uTAGOF) != 0);
sym = findloc(arg[argidx].defvalue.size.symname); lsym = findloc(arg[argidx].defvalue.size.symname);
if (!sym) if (!lsym)
sym = findglb(arg[argidx].defvalue.size.symname); lsym = findglb(arg[argidx].defvalue.size.symname);
array_sz = (sym) ? sym->tag : 0; array_sz = (lsym) ? lsym->tag : 0;
exporttag(array_sz); exporttag(array_sz);
} /* if */ } /* if */
const1(array_sz); const1(array_sz);
@ -2365,7 +2365,7 @@ commutative(void (*oper) ())
static int static int
constant(value * lval) constant(value * lval)
{ {
int tok, idx, constant; int tok, idx, is_constant;
cell val, item, cidx; cell val, item, cidx;
char *st; char *st;
symbol *sym; symbol *sym;
@ -2414,9 +2414,9 @@ constant(value * lval)
* on at this point */ * on at this point */
assert(staging); assert(staging);
stgget(&idx, &cidx); /* mark position in code generator */ stgget(&idx, &cidx); /* mark position in code generator */
expression(&constant, &item, &tag, FALSE); expression(&is_constant, &item, &tag, FALSE);
stgdel(idx, cidx); /* scratch generated code */ stgdel(idx, cidx); /* scratch generated code */
if (constant == 0) if (is_constant == 0)
error(8); /* must be constant expression */ error(8); /* must be constant expression */
if (lasttag < 0) if (lasttag < 0)
lasttag = tag; lasttag = tag;

View File

@ -132,10 +132,10 @@ begdseg(void)
} }
void void
setactivefile(int fnumber) setactivefile(int fnum)
{ {
stgwrite("curfile "); stgwrite("curfile ");
outval(fnumber, TRUE); outval(fnum, TRUE);
} }
cell cell

View File

@ -524,7 +524,7 @@ static char *
replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1], replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
int *repl_length) int *repl_length)
{ {
char *lptr; char *sptr;
int var; int var;
char *buffer; char *buffer;
@ -535,15 +535,15 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
*/ */
assert(repl_length != NULL); assert(repl_length != NULL);
*repl_length = 0; *repl_length = 0;
lptr = pattern; sptr = pattern;
while (*lptr) while (*sptr)
{ {
switch (*lptr) switch (*sptr)
{ {
case '%': case '%':
lptr++; /* skip '%' */ sptr++; /* skip '%' */
assert(sc_isdigit(*lptr)); assert(sc_isdigit(*sptr));
var = atoi(lptr) - 1; var = atoi(sptr) - 1;
assert(var >= 0 && var < _maxoptvars); assert(var >= 0 && var < _maxoptvars);
assert(symbols[var][0] != '\0'); /* variable should be defined */ assert(symbols[var][0] != '\0'); /* variable should be defined */
*repl_length += strlen(symbols[var]); *repl_length += strlen(symbols[var]);
@ -554,7 +554,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
default: default:
*repl_length += 1; *repl_length += 1;
} /* switch */ } /* switch */
lptr++; sptr++;
} /* while */ } /* while */
/* allocate a buffer to replace the sequence in */ /* allocate a buffer to replace the sequence in */
@ -565,11 +565,11 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
} }
/* replace the pattern into this temporary buffer */ /* replace the pattern into this temporary buffer */
lptr = buffer; sptr = buffer;
*lptr++ = '\t'; /* the "replace" patterns do not have tabs */ *sptr++ = '\t'; /* the "replace" patterns do not have tabs */
while (*pattern) while (*pattern)
{ {
assert((int)(lptr - buffer) < *repl_length); assert((int)(sptr - buffer) < *repl_length);
switch (*pattern) switch (*pattern)
{ {
case '%': case '%':
@ -579,23 +579,23 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
var = atoi(pattern) - 1; var = atoi(pattern) - 1;
assert(var >= 0 && var < _maxoptvars); assert(var >= 0 && var < _maxoptvars);
assert(symbols[var][0] != '\0'); /* variable should be defined */ assert(symbols[var][0] != '\0'); /* variable should be defined */
strcpy(lptr, symbols[var]); strcpy(sptr, symbols[var]);
lptr += strlen(symbols[var]); sptr += strlen(symbols[var]);
break; break;
case '!': case '!':
/* finish the line, optionally start the next line with an indent */ /* finish the line, optionally start the next line with an indent */
*lptr++ = '\n'; *sptr++ = '\n';
*lptr++ = '\0'; *sptr++ = '\0';
if (*(pattern + 1) != '\0') if (*(pattern + 1) != '\0')
*lptr++ = '\t'; *sptr++ = '\t';
break; break;
default: default:
*lptr++ = *pattern; *sptr++ = *pattern;
} /* switch */ } /* switch */
pattern++; pattern++;
} /* while */ } /* while */
assert((int)(lptr - buffer) == *repl_length); assert((int)(sptr - buffer) == *repl_length);
return buffer; return buffer;
} }