prototypes override old style function definitions
this is a gnu extension to ansi c
This commit is contained in:
parent
ef83266200
commit
6910cf7927
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: decl.c,v 1.5 1995/10/02 17:18:57 jpo Exp $ */
|
||||
/* $NetBSD: decl.c,v 1.6 1995/10/02 17:21:24 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: decl.c,v 1.5 1995/10/02 17:18:57 jpo Exp $";
|
||||
static char rcsid[] = "$NetBSD: decl.c,v 1.6 1995/10/02 17:21:24 jpo Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -66,7 +66,7 @@ static void align __P((int, int));
|
||||
static sym_t *newtag __P((sym_t *, scl_t, int, int));
|
||||
static int eqargs __P((type_t *, type_t *, int *));
|
||||
static int mnoarg __P((type_t *, int *));
|
||||
static void chkosdef __P((sym_t *, sym_t *));
|
||||
static int chkosdef __P((sym_t *, sym_t *));
|
||||
static int chkptdecl __P((sym_t *, sym_t *));
|
||||
static sym_t *nsfunc __P((sym_t *, sym_t *));
|
||||
static void osfunc __P((sym_t *, sym_t *));
|
||||
@ -295,7 +295,7 @@ addscl(sc)
|
||||
{
|
||||
if (sc == INLINE) {
|
||||
/* syntax error */
|
||||
gnuism(249);
|
||||
(void)gnuism(249);
|
||||
if (dcs->d_inline)
|
||||
/* duplicate '%s' */
|
||||
warning(10, "inline");
|
||||
@ -380,6 +380,8 @@ addtype(tp)
|
||||
/* "long long" or "long ... long" */
|
||||
t = QUAD;
|
||||
dcs->d_lmod = NOTSPEC;
|
||||
/* %s C does not support 'long long' */
|
||||
(void)gnuism(265, tflag ? "traditional" : "ANSI");
|
||||
}
|
||||
|
||||
if (dcs->d_type != NULL && dcs->d_type->t_typedef) {
|
||||
@ -1273,8 +1275,8 @@ addfunc(decl, args)
|
||||
* The symbols are removed from the symbol table by popdecl() after
|
||||
* addfunc(). To be able to restore them if this is a function
|
||||
* definition, a pointer to the list of all symbols is stored in
|
||||
* dcs->d_nxt->fpsyms. Also a list of the arguments (concatenated
|
||||
* by s_nxt) is stored in dcs->d_nxt->f_args.
|
||||
* dcs->d_nxt->d_fpsyms. Also a list of the arguments (concatenated
|
||||
* by s_nxt) is stored in dcs->d_nxt->d_fargs.
|
||||
* (dcs->d_nxt must be used because *dcs is the declaration stack
|
||||
* element created for the list of params and is removed after
|
||||
* addfunc())
|
||||
@ -1632,13 +1634,13 @@ newtag(tag, scl, decl, semi)
|
||||
if (tag->s_scl != scl) {
|
||||
/* (%s) tag redeclared */
|
||||
error(46, scltoa(tag->s_scl));
|
||||
prevdecl(tag);
|
||||
prevdecl(-1, tag);
|
||||
tag = pushdown(tag);
|
||||
dcs->d_nxt->d_nedecl = 1;
|
||||
} else if (decl && !incompl(tag->s_type)) {
|
||||
/* (%s) tag redeclared */
|
||||
error(46, scltoa(tag->s_scl));
|
||||
prevdecl(tag);
|
||||
prevdecl(-1, tag);
|
||||
tag = pushdown(tag);
|
||||
dcs->d_nxt->d_nedecl = 1;
|
||||
} else if (semi || decl) {
|
||||
@ -1693,7 +1695,7 @@ compltag(tp, fmem)
|
||||
sp->memb = fmem;
|
||||
if (sp->size == 0) {
|
||||
/* zero sized %s */
|
||||
gnuism(47, ttab[t].tt_name);
|
||||
(void)gnuism(47, ttab[t].tt_name);
|
||||
} else {
|
||||
n = 0;
|
||||
for (mem = fmem; mem != NULL; mem = mem->s_nxt) {
|
||||
@ -1739,7 +1741,7 @@ ename(sym, val, impl)
|
||||
* declaration
|
||||
*/
|
||||
if (blklev == 0)
|
||||
prevdecl(sym);
|
||||
prevdecl(-1, sym);
|
||||
}
|
||||
} else {
|
||||
if (hflag)
|
||||
@ -1768,7 +1770,7 @@ decl1ext(dsym, initflg)
|
||||
sym_t *dsym;
|
||||
int initflg;
|
||||
{
|
||||
int warn, rval;
|
||||
int warn, rval, redec;
|
||||
sym_t *rdsym;
|
||||
|
||||
chkfdef(dsym, 1);
|
||||
@ -1803,7 +1805,7 @@ decl1ext(dsym, initflg)
|
||||
* written as a function definition to the output file.
|
||||
*/
|
||||
rval = dsym->s_type->t_subt->t_tspec != VOID;
|
||||
outfdef(dsym, dsym->s_type, &dsym->s_dpos, rval, 0, NULL);
|
||||
outfdef(dsym, &dsym->s_dpos, rval, 0, NULL);
|
||||
} else {
|
||||
outsym(dsym, dsym->s_scl, dsym->s_def);
|
||||
}
|
||||
@ -1815,15 +1817,18 @@ decl1ext(dsym, initflg)
|
||||
* we have remembered the params in rdsmy->s_args and compare
|
||||
* them with the params of the prototype.
|
||||
*/
|
||||
if (rdsym->s_osdef && dsym->s_type->t_proto)
|
||||
chkosdef(rdsym, dsym);
|
||||
if (rdsym->s_osdef && dsym->s_type->t_proto) {
|
||||
redec = chkosdef(rdsym, dsym);
|
||||
} else {
|
||||
redec = 0;
|
||||
}
|
||||
|
||||
if (!isredec(dsym, (warn = 0, &warn))) {
|
||||
if (!redec && !isredec(dsym, (warn = 0, &warn))) {
|
||||
|
||||
if (warn) {
|
||||
/* redeclaration of %s */
|
||||
warning(27, dsym->s_name);
|
||||
prevdecl(rdsym);
|
||||
(*(sflag ? error : warning))(27, dsym->s_name);
|
||||
prevdecl(-1, rdsym);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1906,31 +1911,31 @@ isredec(dsym, warn)
|
||||
if ((rsym = dcs->d_rdcsym)->s_scl == ENUMCON) {
|
||||
/* redeclaration of %s */
|
||||
error(27, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
return (1);
|
||||
}
|
||||
if (rsym->s_scl == TYPEDEF) {
|
||||
/* typedef redeclared: %s */
|
||||
error(89, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
return (1);
|
||||
}
|
||||
if (dsym->s_scl == TYPEDEF) {
|
||||
/* redeclaration of %s */
|
||||
error(27, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
return (1);
|
||||
}
|
||||
if (rsym->s_def == DEF && dsym->s_def == DEF) {
|
||||
/* redefinition of %s */
|
||||
error(28, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
return(1);
|
||||
}
|
||||
if (!eqtype(rsym->s_type, dsym->s_type, 0, 0, warn)) {
|
||||
/* redeclaration of %s */
|
||||
error(27, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
return(1);
|
||||
}
|
||||
if (rsym->s_scl == EXTERN && dsym->s_scl == EXTERN)
|
||||
@ -1946,13 +1951,13 @@ isredec(dsym, warn)
|
||||
*/
|
||||
/* redeclaration of %s */
|
||||
error(27, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
return(1);
|
||||
}
|
||||
if (rsym->s_scl == EXTERN) {
|
||||
/* previously declared extern, becomes static: %s */
|
||||
warning(29, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
return(0);
|
||||
}
|
||||
/*
|
||||
@ -1962,7 +1967,7 @@ isredec(dsym, warn)
|
||||
/* redeclaration of %s; ANSI C requires "static" */
|
||||
if (sflag) {
|
||||
warning(30, dsym->s_name);
|
||||
prevdecl(rsym);
|
||||
prevdecl(-1, rsym);
|
||||
}
|
||||
dsym->s_scl = STATIC;
|
||||
return (0);
|
||||
@ -2043,9 +2048,7 @@ eqtype(tp1, tp2, ignqual, promot, warn)
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares the parameters types of two prototypes.
|
||||
*
|
||||
* It seams to be usual to ignore type qualifiers of the parameters.
|
||||
* Compares the parameter types of two prototypes.
|
||||
*/
|
||||
static int
|
||||
eqargs(tp1, tp2, warn)
|
||||
@ -2092,21 +2095,15 @@ mnoarg(tp, warn)
|
||||
tspec_t t;
|
||||
|
||||
if (tp->t_vararg) {
|
||||
if (sflag) {
|
||||
return (0);
|
||||
} else if (warn != NULL) {
|
||||
if (warn != NULL)
|
||||
*warn = 1;
|
||||
}
|
||||
}
|
||||
for (arg = tp->t_args; arg != NULL; arg = arg->s_nxt) {
|
||||
if ((t = arg->s_type->t_tspec) == FLOAT ||
|
||||
t == CHAR || t == SCHAR || t == UCHAR ||
|
||||
t == SHORT || t == USHORT) {
|
||||
if (sflag) {
|
||||
return (0);
|
||||
} else if (warn != NULL) {
|
||||
if (warn != NULL)
|
||||
*warn = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
@ -2116,19 +2113,19 @@ mnoarg(tp, warn)
|
||||
* Compares a prototype declaration with the remembered arguments of
|
||||
* a previous old style function definition.
|
||||
*/
|
||||
static void
|
||||
static int
|
||||
chkosdef(rdsym, dsym)
|
||||
sym_t *rdsym, *dsym;
|
||||
{
|
||||
sym_t *args, *pargs, *arg, *parg;
|
||||
int narg, nparg, n;
|
||||
int warn, ptpos;
|
||||
int warn, msg;
|
||||
pos_t cpos;
|
||||
|
||||
args = rdsym->s_args;
|
||||
pargs = dsym->s_type->t_args;
|
||||
|
||||
ptpos = 0;
|
||||
msg = 0;
|
||||
|
||||
narg = nparg = 0;
|
||||
for (arg = args; arg != NULL; arg = arg->s_nxt)
|
||||
@ -2138,7 +2135,7 @@ chkosdef(rdsym, dsym)
|
||||
if (narg != nparg) {
|
||||
/* prototype does not match old-style definition */
|
||||
error(63);
|
||||
ptpos = 1;
|
||||
msg = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -2151,14 +2148,10 @@ chkosdef(rdsym, dsym)
|
||||
* If it does not match due to promotion and sflag is
|
||||
* not set we print only a warning.
|
||||
*/
|
||||
if (!eqtype(arg->s_type, parg->s_type, 1, 1, &warn)) {
|
||||
if (!eqtype(arg->s_type, parg->s_type, 1, 1, &warn) || warn) {
|
||||
/* prototype does not match old-style def., arg #%d */
|
||||
error(299, n);
|
||||
ptpos = 1;
|
||||
} else if (warn) {
|
||||
/* prototype does not match old-style def., arg #%d */
|
||||
warning(299, n);
|
||||
ptpos = 1;
|
||||
msg = 1;
|
||||
}
|
||||
arg = arg->s_nxt;
|
||||
parg = parg->s_nxt;
|
||||
@ -2166,21 +2159,10 @@ chkosdef(rdsym, dsym)
|
||||
}
|
||||
|
||||
end:
|
||||
if (ptpos && rflag) {
|
||||
/*
|
||||
* print position only if it will not be printed by a
|
||||
* complaint about redeclaration
|
||||
*/
|
||||
warn = 0;
|
||||
if (eqtype(rdsym->s_type, dsym->s_type, 0, 0, &warn) &&
|
||||
warn == 0) {
|
||||
STRUCT_ASSIGN(cpos, curr_pos);
|
||||
STRUCT_ASSIGN(curr_pos, rdsym->s_dpos);
|
||||
/* old style definition */
|
||||
message(300);
|
||||
STRUCT_ASSIGN(curr_pos, cpos);
|
||||
}
|
||||
}
|
||||
if (msg)
|
||||
prevdecl(-1, rdsym);
|
||||
|
||||
return (msg);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2298,8 +2280,7 @@ void
|
||||
cluparg()
|
||||
{
|
||||
sym_t *args, *arg, *pargs, *parg;
|
||||
int narg, nparg, n;
|
||||
int ptpos;
|
||||
int narg, nparg, n, msg;
|
||||
pos_t cpos;
|
||||
tspec_t t;
|
||||
|
||||
@ -2351,7 +2332,9 @@ cluparg()
|
||||
}
|
||||
if (prflstrg != -1 || scflstrg != -1) {
|
||||
narg = prflstrg != -1 ? prflstrg : scflstrg;
|
||||
for (arg = dcs->d_fargs, n = 1; n < narg; arg = arg->s_nxt, n++);
|
||||
arg = dcs->d_fargs;
|
||||
for (n = 1; n < narg; n++)
|
||||
arg = arg->s_nxt;
|
||||
if (arg->s_type->t_tspec != PTR ||
|
||||
((t = arg->s_type->t_subt->t_tspec) != CHAR &&
|
||||
t != UCHAR && t != SCHAR)) {
|
||||
@ -2384,7 +2367,7 @@ cluparg()
|
||||
* continue.
|
||||
*/
|
||||
narg = nparg = 0;
|
||||
ptpos = 0;
|
||||
msg = 0;
|
||||
for (parg = pargs; parg != NULL; parg = parg->s_nxt)
|
||||
nparg++;
|
||||
for (arg = args; arg != NULL; arg = arg->s_nxt)
|
||||
@ -2392,23 +2375,24 @@ cluparg()
|
||||
if (narg != nparg) {
|
||||
/* parameter mismatch: %d declared, %d defined */
|
||||
error(51, nparg, narg);
|
||||
ptpos = 1;
|
||||
msg = 1;
|
||||
} else {
|
||||
parg = pargs;
|
||||
arg = args;
|
||||
while (narg--) {
|
||||
ptpos |= chkptdecl(arg, parg);
|
||||
msg |= chkptdecl(arg, parg);
|
||||
parg = parg->s_nxt;
|
||||
arg = arg->s_nxt;
|
||||
}
|
||||
}
|
||||
if (ptpos && rflag) {
|
||||
STRUCT_ASSIGN(cpos, curr_pos);
|
||||
STRUCT_ASSIGN(curr_pos, dcs->d_rdcsym->s_dpos);
|
||||
if (msg)
|
||||
/* prototype declaration */
|
||||
message(285);
|
||||
STRUCT_ASSIGN(curr_pos, cpos);
|
||||
}
|
||||
prevdecl(285, dcs->d_rdcsym);
|
||||
|
||||
/* from now the prototype is valid */
|
||||
funcsym->s_osdef = 0;
|
||||
funcsym->s_args = NULL;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -2423,21 +2407,30 @@ chkptdecl(arg, parg)
|
||||
sym_t *arg, *parg;
|
||||
{
|
||||
type_t *tp, *ptp;
|
||||
int warn;
|
||||
int warn, msg;
|
||||
|
||||
tp = arg->s_type;
|
||||
ptp = parg->s_type;
|
||||
|
||||
if (!eqtype(tp, ptp, 1, 1, (warn = 0, &warn))) {
|
||||
/* type does not match prototype: %s */
|
||||
error(58, arg->s_name);
|
||||
return (1);
|
||||
msg = 0;
|
||||
warn = 0;
|
||||
|
||||
if (!eqtype(tp, ptp, 1, 1, &warn)) {
|
||||
if (eqtype(tp, ptp, 1, 0, &warn)) {
|
||||
/* type does not match prototype: %s */
|
||||
msg = gnuism(58, arg->s_name);
|
||||
} else {
|
||||
/* type does not match prototype: %s */
|
||||
error(58, arg->s_name);
|
||||
msg = 1;
|
||||
}
|
||||
} else if (warn) {
|
||||
/* type does not match prototype: %s */
|
||||
warning(58, arg->s_name);
|
||||
return (1);
|
||||
(*(sflag ? error : warning))(58, arg->s_name);
|
||||
msg = 1;
|
||||
}
|
||||
return (0);
|
||||
|
||||
return (msg);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2601,7 +2594,7 @@ ledecl(dsym)
|
||||
/* gcc accepts this without a warning, pcc prints an error. */
|
||||
/* redeclaration of %s */
|
||||
warning(27, dsym->s_name);
|
||||
prevdecl(esym);
|
||||
prevdecl(-1, esym);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2612,11 +2605,11 @@ ledecl(dsym)
|
||||
if (esym->s_scl == EXTERN) {
|
||||
/* inconsistent redeclaration of extern: %s */
|
||||
warning(90, dsym->s_name);
|
||||
prevdecl(esym);
|
||||
prevdecl(-1, esym);
|
||||
} else {
|
||||
/* inconsistent redeclaration of static: %s */
|
||||
warning(92, dsym->s_name);
|
||||
prevdecl(esym);
|
||||
prevdecl(-1, esym);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3076,7 +3069,8 @@ glchksz(sym)
|
||||
* Prints information about location of previous definition/declaration.
|
||||
*/
|
||||
void
|
||||
prevdecl(psym)
|
||||
prevdecl(msg, psym)
|
||||
int msg;
|
||||
sym_t *psym;
|
||||
{
|
||||
pos_t cpos;
|
||||
@ -3086,7 +3080,9 @@ prevdecl(psym)
|
||||
|
||||
STRUCT_ASSIGN(cpos, curr_pos);
|
||||
STRUCT_ASSIGN(curr_pos, psym->s_dpos);
|
||||
if (psym->s_def == DEF || psym->s_def == TDEF) {
|
||||
if (msg != -1) {
|
||||
message(msg, psym->s_name);
|
||||
} else if (psym->s_def == DEF || psym->s_def == TDEF) {
|
||||
/* previous definition of %s */
|
||||
message(261, psym->s_name);
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emit1.c,v 1.3 1995/10/02 17:14:14 jpo Exp $ */
|
||||
/* $NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: emit1.c,v 1.3 1995/10/02 17:14:14 jpo Exp $";
|
||||
static char rcsid[] = "$NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
@ -277,9 +277,8 @@ outsym(sym, sc, def)
|
||||
* they are called with proper argument types
|
||||
*/
|
||||
void
|
||||
outfdef(fsym, tp, posp, rval, osdef, args)
|
||||
outfdef(fsym, posp, rval, osdef, args)
|
||||
sym_t *fsym, *args;
|
||||
type_t *tp;
|
||||
pos_t *posp;
|
||||
int rval, osdef;
|
||||
{
|
||||
@ -362,9 +361,9 @@ outfdef(fsym, tp, posp, rval, osdef, args)
|
||||
outint(narg);
|
||||
for (arg = args; arg != NULL; arg = arg->s_nxt)
|
||||
outtype(arg->s_type);
|
||||
outtype(tp->t_subt);
|
||||
outtype(fsym->s_type->t_subt);
|
||||
} else {
|
||||
outtype(tp);
|
||||
outtype(fsym->s_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: err.c,v 1.4 1995/10/02 17:19:01 jpo Exp $ */
|
||||
/* $NetBSD: err.c,v 1.5 1995/10/02 17:21:30 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: err.c,v 1.4 1995/10/02 17:19:01 jpo Exp $";
|
||||
static char rcsid[] = "$NetBSD: err.c,v 1.5 1995/10/02 17:21:30 jpo Exp $";
|
||||
#endif
|
||||
|
||||
/* number of errors found */
|
||||
@ -321,7 +321,7 @@ const char *msgs[] = {
|
||||
"\\\" inside character constants undefined in traditional C", /* 262 */
|
||||
"\\? undefined in traditional C", /* 263 */
|
||||
"\\v undefined in traditional C", /* 264 */
|
||||
"", /* 265 */
|
||||
"%s C does not support 'long long'", /* 265 */
|
||||
"'long double' is illegal in traditional C", /* 266 */
|
||||
"shift equal to size of object", /* 267 */
|
||||
"variable declared inline: %s", /* 268 */
|
||||
@ -511,7 +511,7 @@ message(n, va_alist)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
#ifdef __STDC__
|
||||
gnuism(int n, ...)
|
||||
#else
|
||||
@ -521,6 +521,7 @@ gnuism(n, va_alist)
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int msg;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, n);
|
||||
@ -529,8 +530,14 @@ gnuism(n, va_alist)
|
||||
#endif
|
||||
if (sflag && !gflag) {
|
||||
verror(n, ap);
|
||||
} else if (!(!sflag && gflag)) {
|
||||
msg = 1;
|
||||
} else if (!sflag && gflag) {
|
||||
msg = 0;
|
||||
} else {
|
||||
vwarning(n, ap);
|
||||
msg = 1;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
return (msg);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: externs1.h,v 1.3 1995/10/02 17:14:22 jpo Exp $ */
|
||||
/* $NetBSD: externs1.h,v 1.4 1995/10/02 17:21:33 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -115,7 +115,7 @@ extern const char *msgs[];
|
||||
extern void error __P((int, ...));
|
||||
extern void warning __P((int, ...));
|
||||
extern void message __P((int, ...));
|
||||
extern void gnuism __P((int, ...));
|
||||
extern int gnuism __P((int, ...));
|
||||
extern void lerror __P((const char *, ...));
|
||||
|
||||
/*
|
||||
@ -172,7 +172,7 @@ extern void setuflg __P((sym_t *, int, int));
|
||||
extern void chkusage __P((sym_t *));
|
||||
extern void chkusg1 __P((sym_t *));
|
||||
extern void chkglsyms __P((void));
|
||||
extern void prevdecl __P((sym_t *));
|
||||
extern void prevdecl __P((int, sym_t *));
|
||||
|
||||
/*
|
||||
* tree.c
|
||||
@ -272,6 +272,6 @@ extern void mkinit __P((tnode_t *));
|
||||
extern void outtype __P((type_t *));
|
||||
extern const char *ttos __P((type_t *));
|
||||
extern void outsym __P((sym_t *, scl_t, def_t));
|
||||
extern void outfdef __P((sym_t *, type_t *, pos_t *, int, int, sym_t *));
|
||||
extern void outfdef __P((sym_t *, pos_t *, int, int, sym_t *));
|
||||
extern void outcall __P((tnode_t *, int, int));
|
||||
extern void outusg __P((sym_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: func.c,v 1.4 1995/10/02 17:14:26 jpo Exp $ */
|
||||
/* $NetBSD: func.c,v 1.5 1995/10/02 17:21:35 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: func.c,v 1.4 1995/10/02 17:14:26 jpo Exp $";
|
||||
static char rcsid[] = "$NetBSD: func.c,v 1.5 1995/10/02 17:21:35 jpo Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -264,14 +264,6 @@ funcdef(fsym)
|
||||
n++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remember the type before it is completet with previous
|
||||
* declarations. We need it at the end of the function when
|
||||
* the record for the function definition is written to the
|
||||
* output file.
|
||||
*/
|
||||
dcs->d_ftype = fsym->s_type;
|
||||
|
||||
/*
|
||||
* We must also remember the position. s_dpos is overwritten
|
||||
* if this is an old style definition and we had already a
|
||||
@ -284,14 +276,14 @@ funcdef(fsym)
|
||||
if (!isredec(fsym, (warn = 0, &warn))) {
|
||||
|
||||
/*
|
||||
* Print no warning if the newly defined function
|
||||
* Print nothing if the newly defined function
|
||||
* is defined in old style. A better warning will
|
||||
* be printed in cluparg().
|
||||
*/
|
||||
if (warn && !fsym->s_osdef) {
|
||||
/* redeclaration of %s */
|
||||
warning(27, fsym->s_name);
|
||||
prevdecl(rdsym);
|
||||
(*(sflag ? error : warning))(27, fsym->s_name);
|
||||
prevdecl(-1, rdsym);
|
||||
}
|
||||
|
||||
/* copy usage information */
|
||||
@ -378,16 +370,10 @@ funcend()
|
||||
if (dcs->d_scl == EXTERN && funcsym->s_inline) {
|
||||
outsym(funcsym, funcsym->s_scl, DECL);
|
||||
} else {
|
||||
outfdef(funcsym, dcs->d_ftype, &dcs->d_fdpos, cstk->c_retval,
|
||||
outfdef(funcsym, &dcs->d_fdpos, cstk->c_retval,
|
||||
funcsym->s_osdef, dcs->d_fargs);
|
||||
}
|
||||
|
||||
if (funcsym->s_type->t_proto) {
|
||||
/* from now the prototype is valid */
|
||||
funcsym->s_osdef = 0;
|
||||
funcsym->s_args = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove all symbols declared during argument declaration from
|
||||
* the symbol table
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init.c,v 1.3 1995/10/02 17:14:31 jpo Exp $ */
|
||||
/* $NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: init.c,v 1.3 1995/10/02 17:14:31 jpo Exp $";
|
||||
static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -432,7 +432,7 @@ mkinit(tn)
|
||||
if (conaddr(tn, &sym, &offs) == -1) {
|
||||
if (sc == AUTO || sc == REG) {
|
||||
/* non-constant initializer */
|
||||
gnuism(177);
|
||||
(void)gnuism(177);
|
||||
} else {
|
||||
/* non-constant initializer */
|
||||
error(177);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lint1.h,v 1.4 1995/10/02 17:14:35 jpo Exp $ */
|
||||
/* $NetBSD: lint1.h,v 1.5 1995/10/02 17:21:39 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -311,7 +311,6 @@ typedef struct dinfo {
|
||||
u_int d_notyp : 1; /* set if no type specifier was present */
|
||||
type_t *d_tagtyp; /* tag during member declaration */
|
||||
sym_t *d_fargs; /* list of arguments during function def. */
|
||||
type_t *d_ftype; /* type as specified in function def. */
|
||||
pos_t d_fdpos; /* position of function definition */
|
||||
sym_t *d_dlsyms; /* first symbol declared at this level */
|
||||
sym_t **d_ldlsym; /* points to s_dlnxt in last symbol decl.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tree.c,v 1.5 1995/10/02 17:14:44 jpo Exp $ */
|
||||
/* $NetBSD: tree.c,v 1.6 1995/10/02 17:21:42 jpo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: tree.c,v 1.5 1995/10/02 17:14:44 jpo Exp $";
|
||||
static char rcsid[] = "$NetBSD: tree.c,v 1.6 1995/10/02 17:21:42 jpo Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -730,7 +730,7 @@ cconv(tn)
|
||||
if (!tn->tn_lvalue) {
|
||||
/* %soperand of '%s' must be lvalue */
|
||||
/* XXX print correct operator */
|
||||
gnuism(114, "", modtab[AMPER].m_name);
|
||||
(void)gnuism(114, "", modtab[AMPER].m_name);
|
||||
}
|
||||
tn = mktnode(AMPER, tincref(tn->tn_type->t_subt, PTR),
|
||||
tn, NULL);
|
||||
@ -2622,7 +2622,7 @@ plength(tp)
|
||||
break;
|
||||
case VOID:
|
||||
/* cannot do pointer arithmetic on operand of ... */
|
||||
gnuism(136);
|
||||
(void)gnuism(136);
|
||||
break;
|
||||
case STRUCT:
|
||||
case UNION:
|
||||
|
Loading…
Reference in New Issue
Block a user