forked from enlightenment/efl
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:
parent
0099729e09
commit
62bca66249
|
@ -449,11 +449,11 @@ sc_compile(int argc, char *argv[])
|
|||
}
|
||||
|
||||
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 */
|
||||
sc_status = statIDLE;
|
||||
add_constant(name, value, sGLOBAL, tag);
|
||||
add_constant(name, val, sGLOBAL, tag);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1585,7 +1585,7 @@ static void
|
|||
decl_enum(int vclass)
|
||||
{
|
||||
char enumname[sNAMEMAX + 1], constname[sNAMEMAX + 1];
|
||||
cell val, value, size;
|
||||
cell lexval, enumvalue, size;
|
||||
char *str;
|
||||
int tok, tag, explicittag;
|
||||
cell increment, multiplier;
|
||||
|
@ -1594,7 +1594,7 @@ decl_enum(int vclass)
|
|||
* explicit tag was passed, even if that explicit tag was "_:", so we
|
||||
* cannot call sc_addtag() here
|
||||
*/
|
||||
if (lex(&val, &str) == tLABEL)
|
||||
if (lex(&lexval, &str) == tLABEL)
|
||||
{
|
||||
tag = sc_addtag(str);
|
||||
explicittag = TRUE;
|
||||
|
@ -1608,7 +1608,7 @@ decl_enum(int vclass)
|
|||
|
||||
/* get optional enum name (also serves as a tag if no explicit
|
||||
* tag was set) */
|
||||
if (lex(&val, &str) == tSYMBOL)
|
||||
if (lex(&lexval, &str) == tSYMBOL)
|
||||
{ /* read in (new) token */
|
||||
strcpy(enumname, str); /* save enum name (last constant) */
|
||||
if (!explicittag)
|
||||
|
@ -1635,8 +1635,8 @@ decl_enum(int vclass)
|
|||
}
|
||||
else if (matchtoken(taSHL))
|
||||
{
|
||||
constexpr(&val, NULL);
|
||||
while (val-- > 0)
|
||||
constexpr(&lexval, NULL);
|
||||
while (lexval-- > 0)
|
||||
multiplier *= 2;
|
||||
} /* if */
|
||||
needtoken(')');
|
||||
|
@ -1644,7 +1644,7 @@ decl_enum(int vclass)
|
|||
|
||||
needtoken('{');
|
||||
/* go through all constants */
|
||||
value = 0; /* default starting value */
|
||||
enumvalue = 0; /* default starting value */
|
||||
do
|
||||
{
|
||||
if (matchtoken('}'))
|
||||
|
@ -1652,7 +1652,7 @@ decl_enum(int vclass)
|
|||
lexpush();
|
||||
break;
|
||||
} /* if */
|
||||
tok = lex(&val, &str); /* read in (new) token */
|
||||
tok = lex(&lexval, &str); /* read in (new) token */
|
||||
if (tok != tSYMBOL && tok != tLABEL)
|
||||
error(20, str); /* invalid symbol name */
|
||||
strcpy(constname, str); /* save symbol name */
|
||||
|
@ -1660,14 +1660,14 @@ decl_enum(int vclass)
|
|||
if (tok == tLABEL || matchtoken(':'))
|
||||
constexpr(&size, NULL); /* get size */
|
||||
if (matchtoken('='))
|
||||
constexpr(&value, NULL); /* get value */
|
||||
constexpr(&enumvalue, NULL); /* get value */
|
||||
/* add_constant() checks whether a variable (global or local) or
|
||||
* a constant with the same name already exists */
|
||||
add_constant(constname, value, vclass, tag);
|
||||
add_constant(constname, enumvalue, vclass, tag);
|
||||
if (multiplier == 1)
|
||||
value += size;
|
||||
enumvalue += size;
|
||||
else
|
||||
value *= size * multiplier;
|
||||
enumvalue *= size * multiplier;
|
||||
}
|
||||
while (matchtoken(','));
|
||||
needtoken('}'); /* terminates the constant list */
|
||||
|
@ -1675,7 +1675,7 @@ decl_enum(int vclass)
|
|||
|
||||
/* set the enum name to the last value plus one */
|
||||
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))
|
||||
{
|
||||
/* save the name of the argument whose size id to take */
|
||||
char *name;
|
||||
char *argname;
|
||||
cell val;
|
||||
|
||||
tokeninfo(&val, &name);
|
||||
if (!(arg->defvalue.size.symname = strdup(name)))
|
||||
tokeninfo(&val, &argname);
|
||||
if (!(arg->defvalue.size.symname = strdup(argname)))
|
||||
error(103); /* insufficient memory */
|
||||
arg->defvalue.size.level = 0;
|
||||
if (size_tag_token == uSIZEOF)
|
||||
|
@ -3406,7 +3406,7 @@ constexpr(cell * val, int *tag)
|
|||
* Global references: intest (altered, but restored upon termination)
|
||||
*/
|
||||
static void
|
||||
test(int label, int parens, int invert)
|
||||
test(int label, int parens, int inv)
|
||||
{
|
||||
int idx, tok;
|
||||
cell cidx;
|
||||
|
@ -3469,8 +3469,8 @@ test(int label, int parens, int invert)
|
|||
} /* if */
|
||||
if (lval.tag != 0 && lval.tag != sc_addtag("bool"))
|
||||
if (check_userop(lneg, lval.tag, 0, 1, NULL, &lval.tag))
|
||||
invert = !invert; /* user-defined ! operator inverted result */
|
||||
if (invert)
|
||||
inv = !inv; /* user-defined ! operator inverted result */
|
||||
if (inv)
|
||||
jmp_ne0(label); /* jump to label if true (different from 0) */
|
||||
else
|
||||
jmp_eq0(label); /* jump to label if false (equal to 0) */
|
||||
|
|
|
@ -157,12 +157,12 @@ plungefile(char *name, int try_currentpath, int try_includepaths)
|
|||
}
|
||||
|
||||
static void
|
||||
check_empty(char *lptr)
|
||||
check_empty(const char *sptr)
|
||||
{
|
||||
/* verifies that the string contains only whitespace */
|
||||
while (*lptr <= ' ' && *lptr != '\0')
|
||||
lptr++;
|
||||
if (*lptr != '\0')
|
||||
while (*sptr <= ' ' && *sptr != '\0')
|
||||
sptr++;
|
||||
if (*sptr != '\0')
|
||||
error(38); /* extra characters on line */
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,6 @@ static void
|
|||
readline(char *line)
|
||||
{
|
||||
int i, num, cont;
|
||||
char *ptr;
|
||||
|
||||
if (lptr == term_expr)
|
||||
return;
|
||||
|
@ -285,15 +284,16 @@ readline(char *line)
|
|||
}
|
||||
else
|
||||
{
|
||||
char *ptr;
|
||||
/* check whether to erase leading spaces */
|
||||
if (cont)
|
||||
{
|
||||
char *ptr = line;
|
||||
char *sptr = line;
|
||||
|
||||
while (*ptr == ' ' || *ptr == '\t')
|
||||
ptr++;
|
||||
if (ptr != line)
|
||||
memmove(line, ptr, strlen(ptr) + 1);
|
||||
while (*sptr == ' ' || *sptr == '\t')
|
||||
sptr++;
|
||||
if (sptr != line)
|
||||
memmove(line, sptr, strlen(sptr) + 1);
|
||||
} /* if */
|
||||
cont = FALSE;
|
||||
/* check whether a full line was read */
|
||||
|
@ -694,13 +694,13 @@ static int
|
|||
number(cell * val, char *curptr)
|
||||
{
|
||||
int i;
|
||||
cell value;
|
||||
cell curval;
|
||||
|
||||
if ((i = btoi(&value, curptr)) != 0 /* binary? */
|
||||
|| (i = htoi(&value, curptr)) != 0 /* hexadecimal? */
|
||||
|| (i = dtoi(&value, curptr)) != 0) /* decimal? */
|
||||
if ((i = btoi(&curval, curptr)) != 0 /* binary? */
|
||||
|| (i = htoi(&curval, curptr)) != 0 /* hexadecimal? */
|
||||
|| (i = dtoi(&curval, curptr)) != 0) /* decimal? */
|
||||
{
|
||||
*val = value;
|
||||
*val = curval;
|
||||
return i;
|
||||
}
|
||||
else
|
||||
|
@ -983,10 +983,10 @@ command(void)
|
|||
}
|
||||
else if (strcmp(str, "compress") == 0)
|
||||
{
|
||||
cell val;
|
||||
cell compval;
|
||||
|
||||
preproc_expr(&val, NULL);
|
||||
sc_compress = (int)val; /* switch code packing on/off */
|
||||
preproc_expr(&compval, NULL);
|
||||
sc_compress = (int)compval; /* switch code packing on/off */
|
||||
}
|
||||
else if (strcmp(str, "dynamic") == 0)
|
||||
{
|
||||
|
@ -1029,10 +1029,10 @@ command(void)
|
|||
}
|
||||
else if (strcmp(str, "pack") == 0)
|
||||
{
|
||||
cell val;
|
||||
cell packval;
|
||||
|
||||
preproc_expr(&val, NULL); /* default = packed/unpacked */
|
||||
sc_packstr = (int)val;
|
||||
preproc_expr(&packval, NULL); /* default = packed/unpacked */
|
||||
sc_packstr = (int)packval;
|
||||
}
|
||||
else if (strcmp(str, "rational") == 0)
|
||||
{
|
||||
|
@ -1080,17 +1080,17 @@ command(void)
|
|||
}
|
||||
else if (strcmp(str, "semicolon") == 0)
|
||||
{
|
||||
cell val;
|
||||
cell semicolval;
|
||||
|
||||
preproc_expr(&val, NULL);
|
||||
sc_needsemicolon = (int)val;
|
||||
preproc_expr(&semicolval, NULL);
|
||||
sc_needsemicolon = (int)semicolval;
|
||||
}
|
||||
else if (strcmp(str, "tabsize") == 0)
|
||||
{
|
||||
cell val;
|
||||
cell tabsizeval;
|
||||
|
||||
preproc_expr(&val, NULL);
|
||||
sc_tabsize = (int)val;
|
||||
preproc_expr(&tabsizeval, NULL);
|
||||
sc_tabsize = (int)tabsizeval;
|
||||
}
|
||||
else if (strcmp(str, "align") == 0)
|
||||
{
|
||||
|
@ -1479,7 +1479,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
|
|||
{
|
||||
int prefixlen;
|
||||
char *p, *s, *e, *args[10];
|
||||
int match, arg, len;
|
||||
int is_match, arg, len;
|
||||
|
||||
memset(args, 0, sizeof args);
|
||||
|
||||
|
@ -1495,8 +1495,8 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
|
|||
*/
|
||||
s = line + prefixlen;
|
||||
p = pattern + prefixlen;
|
||||
match = TRUE; /* so far, pattern matches */
|
||||
while (match && *s != '\0' && *p != '\0')
|
||||
is_match = TRUE; /* so far, pattern matches */
|
||||
while (is_match && *s != '\0' && *p != '\0')
|
||||
{
|
||||
if (*p == '%')
|
||||
{
|
||||
|
@ -1543,14 +1543,14 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
|
|||
else
|
||||
{
|
||||
assert(*e == '\0' || *e == '\n');
|
||||
match = FALSE;
|
||||
is_match = FALSE;
|
||||
s = e;
|
||||
} /* if */
|
||||
p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
match = FALSE;
|
||||
is_match = FALSE;
|
||||
} /* if */
|
||||
}
|
||||
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')
|
||||
s++; /* skip white space */
|
||||
if (*s != ';' && *s != '\0')
|
||||
match = FALSE;
|
||||
is_match = FALSE;
|
||||
p++; /* skip the semicolon in the pattern */
|
||||
}
|
||||
else
|
||||
|
@ -1575,23 +1575,23 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
|
|||
s++; /* skip white space */
|
||||
ch = litchar(&p, FALSE); /* this increments "p" */
|
||||
if (*s != ch)
|
||||
match = FALSE;
|
||||
is_match = FALSE;
|
||||
else
|
||||
s++; /* this character matches */
|
||||
} /* if */
|
||||
} /* while */
|
||||
|
||||
if (match && *p == '\0')
|
||||
if (is_match && *p == '\0')
|
||||
{
|
||||
/* if the last character to match is an alphanumeric character, the
|
||||
* current character in the source may not be alphanumeric
|
||||
*/
|
||||
assert(p > pattern);
|
||||
if (alphanum(*(p - 1)) && alphanum(*s))
|
||||
match = FALSE;
|
||||
is_match = FALSE;
|
||||
} /* if */
|
||||
|
||||
if (match)
|
||||
if (is_match)
|
||||
{
|
||||
/* calculate the length of the substituted string */
|
||||
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])
|
||||
free(args[arg]);
|
||||
|
||||
return match;
|
||||
return is_match;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1742,63 +1742,63 @@ preprocess(void)
|
|||
}
|
||||
|
||||
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 */
|
||||
if (*lptr == '\"')
|
||||
if (*sptr == '\"')
|
||||
{
|
||||
/* check whether there's another pair of quotes following.
|
||||
* If so, paste the two strings together, thus
|
||||
* "pants""off" becomes "pantsoff"
|
||||
*/
|
||||
if (*(lptr + 1) == '\"')
|
||||
lptr += 2;
|
||||
if (*(sptr + 1) == '\"')
|
||||
sptr += 2;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (*lptr == '\a')
|
||||
if (*sptr == '\a')
|
||||
{ /* ignore '\a' (which was inserted at a line concatenation) */
|
||||
lptr++;
|
||||
sptr++;
|
||||
continue;
|
||||
} /* if */
|
||||
stowlit(litchar(&lptr, rawstring)); /* litchar() alters "lptr" */
|
||||
stowlit(litchar(&sptr, rawstring)); /* litchar() alters "lptr" */
|
||||
} /* while */
|
||||
stowlit(0); /* terminate string */
|
||||
return lptr;
|
||||
return sptr;
|
||||
}
|
||||
|
||||
static char *
|
||||
packedstring(char *lptr, int rawstring)
|
||||
packedstring(char *sptr, int rawstring)
|
||||
{
|
||||
int i;
|
||||
ucell val, c;
|
||||
|
||||
i = sizeof(ucell) - (charbits / 8); /* start at most significant byte */
|
||||
val = 0;
|
||||
while (*lptr != '\0')
|
||||
while (*sptr != '\0')
|
||||
{
|
||||
/* check for doublequotes indicating the end of the string */
|
||||
if (*lptr == '\"')
|
||||
if (*sptr == '\"')
|
||||
{
|
||||
/* check whether there's another pair of quotes following.
|
||||
* If so, paste the two strings together, thus
|
||||
* "pants""off" becomes "pantsoff"
|
||||
*/
|
||||
if (*(lptr + 1) == '\"')
|
||||
lptr += 2;
|
||||
if (*(sptr + 1) == '\"')
|
||||
sptr += 2;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (*lptr == '\a')
|
||||
if (*sptr == '\a')
|
||||
{ /* ignore '\a' (which was inserted at a line concatenation) */
|
||||
lptr++;
|
||||
sptr++;
|
||||
continue;
|
||||
} /* if */
|
||||
c = litchar(&lptr, rawstring); /* litchar() alters "lptr" */
|
||||
c = litchar(&sptr, rawstring); /* litchar() alters "sptr" */
|
||||
if (c >= (ucell) (1 << charbits))
|
||||
error(43); /* character constant exceeds range */
|
||||
val |= (c << 8 * i);
|
||||
|
@ -1814,7 +1814,7 @@ packedstring(char *lptr, int rawstring)
|
|||
stowlit(val); /* at least one zero character in "val" */
|
||||
else
|
||||
stowlit(0); /* add full cell of zeros */
|
||||
return lptr;
|
||||
return sptr;
|
||||
}
|
||||
|
||||
/* lex(lexvalue,lexsym) Lexical Analysis
|
||||
|
@ -2230,7 +2230,7 @@ match(char *st, int end)
|
|||
* litq (altered)
|
||||
*/
|
||||
void
|
||||
stowlit(cell value)
|
||||
stowlit(cell val)
|
||||
{
|
||||
if (litidx >= litmax)
|
||||
{
|
||||
|
@ -2243,7 +2243,7 @@ stowlit(cell value)
|
|||
litq = p;
|
||||
} /* if */
|
||||
assert(litidx < litmax);
|
||||
litq[litidx++] = value;
|
||||
litq[litidx++] = val;
|
||||
}
|
||||
|
||||
/* litchar
|
||||
|
@ -2256,12 +2256,12 @@ stowlit(cell value)
|
|||
* but ddd must be decimal!
|
||||
*/
|
||||
static cell
|
||||
litchar(char **lptr, int rawmode)
|
||||
litchar(char **p_str, int rawmode)
|
||||
{
|
||||
cell c = 0;
|
||||
unsigned char *cptr;
|
||||
|
||||
cptr = (unsigned char *)*lptr;
|
||||
cptr = (unsigned char *)*p_str;
|
||||
if (rawmode || *cptr != sc_ctrlchar)
|
||||
{ /* no escape character */
|
||||
c = *cptr;
|
||||
|
@ -2333,7 +2333,7 @@ litchar(char **lptr, int rawmode)
|
|||
} /* switch */
|
||||
} /* if */
|
||||
} /* if */
|
||||
*lptr = (char *)cptr;
|
||||
*p_str = (char *)cptr;
|
||||
assert(c >= 0 && c < 256);
|
||||
return c;
|
||||
}
|
||||
|
@ -2502,7 +2502,7 @@ namehash(char *name)
|
|||
}
|
||||
|
||||
static symbol *
|
||||
find_symbol(symbol * root, char *name, int fnumber)
|
||||
find_symbol(symbol * root, char *name, int fnum)
|
||||
{
|
||||
symbol *ptr = root->next;
|
||||
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
|
||||
&& !ptr->parent && (ptr->fnumber < 0
|
||||
|| ptr->fnumber == fnumber))
|
||||
|| ptr->fnumber == fnum))
|
||||
return ptr;
|
||||
ptr = ptr->next;
|
||||
} /* while */
|
||||
|
|
|
@ -759,7 +759,7 @@ calc(cell left, void (*oper) (), cell right, char *boolresult)
|
|||
}
|
||||
|
||||
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 };
|
||||
|
||||
|
@ -767,12 +767,12 @@ expression(int *constant, cell * val, int *tag, int chkfuncresult)
|
|||
rvalue(&lval);
|
||||
if (lval.ident == iCONSTEXPR)
|
||||
{ /* constant expression */
|
||||
*constant = TRUE;
|
||||
*is_constant = TRUE;
|
||||
*val = lval.constval;
|
||||
}
|
||||
else
|
||||
{
|
||||
*constant = FALSE;
|
||||
*is_constant = FALSE;
|
||||
*val = 0;
|
||||
} /* if */
|
||||
if (tag)
|
||||
|
@ -1013,7 +1013,7 @@ hier14(value * lval1)
|
|||
/* check the sizes of all sublevels too */
|
||||
symbol *sym1 = lval3.sym;
|
||||
symbol *sym2 = lval2.sym;
|
||||
int i;
|
||||
int clvl;
|
||||
|
||||
assert(sym1 != NULL && sym2 != NULL);
|
||||
/* ^^^ 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
|
||||
*/
|
||||
assert(exactmatch);
|
||||
for (i = 0; i < level; i++)
|
||||
for (clvl = 0; clvl < level; clvl++)
|
||||
{
|
||||
sym1 = finddepend(sym1);
|
||||
sym2 = finddepend(sym2);
|
||||
|
@ -2118,37 +2118,37 @@ callfunction(symbol * sym)
|
|||
}
|
||||
else
|
||||
{
|
||||
symbol *sym = lval.sym;
|
||||
symbol *lsym = lval.sym;
|
||||
short level = 0;
|
||||
|
||||
assert(sym != NULL);
|
||||
if (sym->dim.array.level + 1 != arg[argidx].numdim)
|
||||
assert(lsym != NULL);
|
||||
if (lsym->dim.array.level + 1 != arg[argidx].numdim)
|
||||
error(48); /* array dimensions must match */
|
||||
/* the lengths for all dimensions must match, unless the dimension
|
||||
* length was defined at zero (which means "undefined")
|
||||
*/
|
||||
while (sym->dim.array.level > 0)
|
||||
while (lsym->dim.array.level > 0)
|
||||
{
|
||||
assert(level < sDIMEN_MAX);
|
||||
if (arg[argidx].dim[level] != 0
|
||||
&& sym->dim.array.length !=
|
||||
&& lsym->dim.array.length !=
|
||||
arg[argidx].dim[level])
|
||||
error(47); /* array sizes must match */
|
||||
append_constval(&arrayszlst, arg[argidx].name,
|
||||
sym->dim.array.length, level);
|
||||
sym = finddepend(sym);
|
||||
assert(sym != NULL);
|
||||
lsym->dim.array.length, level);
|
||||
lsym = finddepend(lsym);
|
||||
assert(lsym != NULL);
|
||||
level++;
|
||||
} /* if */
|
||||
/* the last dimension is checked too, again, unless it is zero */
|
||||
assert(level < sDIMEN_MAX);
|
||||
assert(sym != NULL);
|
||||
assert(lsym != NULL);
|
||||
if (arg[argidx].dim[level] != 0
|
||||
&& sym->dim.array.length !=
|
||||
&& lsym->dim.array.length !=
|
||||
arg[argidx].dim[level])
|
||||
error(47); /* array sizes must match */
|
||||
append_constval(&arrayszlst, arg[argidx].name,
|
||||
sym->dim.array.length, level);
|
||||
lsym->dim.array.length, level);
|
||||
} /* if */
|
||||
/* address already in PRI */
|
||||
if (!checktag
|
||||
|
@ -2280,13 +2280,13 @@ callfunction(symbol * sym)
|
|||
}
|
||||
else
|
||||
{
|
||||
symbol *sym;
|
||||
symbol *lsym;
|
||||
|
||||
assert((arg[argidx].hasdefault & uTAGOF) != 0);
|
||||
sym = findloc(arg[argidx].defvalue.size.symname);
|
||||
if (!sym)
|
||||
sym = findglb(arg[argidx].defvalue.size.symname);
|
||||
array_sz = (sym) ? sym->tag : 0;
|
||||
lsym = findloc(arg[argidx].defvalue.size.symname);
|
||||
if (!lsym)
|
||||
lsym = findglb(arg[argidx].defvalue.size.symname);
|
||||
array_sz = (lsym) ? lsym->tag : 0;
|
||||
exporttag(array_sz);
|
||||
} /* if */
|
||||
const1(array_sz);
|
||||
|
@ -2365,7 +2365,7 @@ commutative(void (*oper) ())
|
|||
static int
|
||||
constant(value * lval)
|
||||
{
|
||||
int tok, idx, constant;
|
||||
int tok, idx, is_constant;
|
||||
cell val, item, cidx;
|
||||
char *st;
|
||||
symbol *sym;
|
||||
|
@ -2414,9 +2414,9 @@ constant(value * lval)
|
|||
* on at this point */
|
||||
assert(staging);
|
||||
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 */
|
||||
if (constant == 0)
|
||||
if (is_constant == 0)
|
||||
error(8); /* must be constant expression */
|
||||
if (lasttag < 0)
|
||||
lasttag = tag;
|
||||
|
|
|
@ -132,10 +132,10 @@ begdseg(void)
|
|||
}
|
||||
|
||||
void
|
||||
setactivefile(int fnumber)
|
||||
setactivefile(int fnum)
|
||||
{
|
||||
stgwrite("curfile ");
|
||||
outval(fnumber, TRUE);
|
||||
outval(fnum, TRUE);
|
||||
}
|
||||
|
||||
cell
|
||||
|
|
|
@ -524,7 +524,7 @@ static char *
|
|||
replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
|
||||
int *repl_length)
|
||||
{
|
||||
char *lptr;
|
||||
char *sptr;
|
||||
int var;
|
||||
char *buffer;
|
||||
|
||||
|
@ -535,15 +535,15 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
|
|||
*/
|
||||
assert(repl_length != NULL);
|
||||
*repl_length = 0;
|
||||
lptr = pattern;
|
||||
while (*lptr)
|
||||
sptr = pattern;
|
||||
while (*sptr)
|
||||
{
|
||||
switch (*lptr)
|
||||
switch (*sptr)
|
||||
{
|
||||
case '%':
|
||||
lptr++; /* skip '%' */
|
||||
assert(sc_isdigit(*lptr));
|
||||
var = atoi(lptr) - 1;
|
||||
sptr++; /* skip '%' */
|
||||
assert(sc_isdigit(*sptr));
|
||||
var = atoi(sptr) - 1;
|
||||
assert(var >= 0 && var < _maxoptvars);
|
||||
assert(symbols[var][0] != '\0'); /* variable should be defined */
|
||||
*repl_length += strlen(symbols[var]);
|
||||
|
@ -554,7 +554,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
|
|||
default:
|
||||
*repl_length += 1;
|
||||
} /* switch */
|
||||
lptr++;
|
||||
sptr++;
|
||||
} /* while */
|
||||
|
||||
/* 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 */
|
||||
lptr = buffer;
|
||||
*lptr++ = '\t'; /* the "replace" patterns do not have tabs */
|
||||
sptr = buffer;
|
||||
*sptr++ = '\t'; /* the "replace" patterns do not have tabs */
|
||||
while (*pattern)
|
||||
{
|
||||
assert((int)(lptr - buffer) < *repl_length);
|
||||
assert((int)(sptr - buffer) < *repl_length);
|
||||
switch (*pattern)
|
||||
{
|
||||
case '%':
|
||||
|
@ -579,23 +579,23 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
|
|||
var = atoi(pattern) - 1;
|
||||
assert(var >= 0 && var < _maxoptvars);
|
||||
assert(symbols[var][0] != '\0'); /* variable should be defined */
|
||||
strcpy(lptr, symbols[var]);
|
||||
lptr += strlen(symbols[var]);
|
||||
strcpy(sptr, symbols[var]);
|
||||
sptr += strlen(symbols[var]);
|
||||
break;
|
||||
case '!':
|
||||
/* finish the line, optionally start the next line with an indent */
|
||||
*lptr++ = '\n';
|
||||
*lptr++ = '\0';
|
||||
*sptr++ = '\n';
|
||||
*sptr++ = '\0';
|
||||
if (*(pattern + 1) != '\0')
|
||||
*lptr++ = '\t';
|
||||
*sptr++ = '\t';
|
||||
break;
|
||||
default:
|
||||
*lptr++ = *pattern;
|
||||
*sptr++ = *pattern;
|
||||
} /* switch */
|
||||
pattern++;
|
||||
} /* while */
|
||||
|
||||
assert((int)(lptr - buffer) == *repl_length);
|
||||
assert((int)(sptr - buffer) == *repl_length);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue