From 3268105e323fdb7be7a50bcc5452ee5b22f467e7 Mon Sep 17 00:00:00 2001 From: Jeroen Ruigrok/asmodai Date: Wed, 7 Jul 2004 12:13:27 +0000 Subject: [PATCH] Synchronise with NetBSD: ANSIfy. --- usr.bin/xlint/lint1/decl.c | 223 ++++++++++----------------------- usr.bin/xlint/lint1/emit.c | 29 ++--- usr.bin/xlint/lint1/emit1.c | 31 ++--- usr.bin/xlint/lint1/err.c | 13 +- usr.bin/xlint/lint1/func.c | 94 +++++--------- usr.bin/xlint/lint1/init.c | 26 ++-- usr.bin/xlint/lint1/main1.c | 10 +- usr.bin/xlint/lint1/mem.c | 17 +-- usr.bin/xlint/lint1/mem1.c | 51 +++----- usr.bin/xlint/lint1/tree.c | 242 +++++++++--------------------------- usr.bin/xlint/lint2/chk.c | 93 ++++---------- usr.bin/xlint/lint2/emit2.c | 15 +-- usr.bin/xlint/lint2/hash.c | 14 +-- usr.bin/xlint/lint2/main2.c | 8 +- usr.bin/xlint/lint2/mem2.c | 7 +- usr.bin/xlint/lint2/msg.c | 8 +- usr.bin/xlint/lint2/read.c | 59 +++------ usr.bin/xlint/xlint/xlint.c | 59 +++------ 18 files changed, 306 insertions(+), 693 deletions(-) diff --git a/usr.bin/xlint/lint1/decl.c b/usr.bin/xlint/lint1/decl.c index edf978ed1f..a4883b65b8 100644 --- a/usr.bin/xlint/lint1/decl.c +++ b/usr.bin/xlint/lint1/decl.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.bin/xlint/lint1/decl.c,v 1.2.8.2 2001/07/19 09:19:47 kris Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/decl.c,v 1.4 2004/06/19 18:55:48 joerg Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/decl.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -82,7 +82,7 @@ static void glchksz(sym_t *); * initializes all global vars used in declarations */ void -initdecl() +initdecl(void) { int i; static struct { @@ -207,15 +207,13 @@ initdecl() * if it is to be modified (adding qualifiers or anything else). */ type_t * -gettyp(t) - tspec_t t; +gettyp(tspec_t t) { return (&typetab[t]); } type_t * -duptyp(tp) - const type_t *tp; +duptyp(const type_t *tp) { type_t *ntp; @@ -229,8 +227,7 @@ duptyp(tp) * allocated memory should be freed after the expr). */ type_t * -tduptyp(tp) - const type_t *tp; +tduptyp(const type_t *tp) { type_t *ntp; @@ -244,8 +241,7 @@ tduptyp(tp) * struct, union or enum type. */ int -incompl(tp) - type_t *tp; +incompl(type_t *tp) { tspec_t t; @@ -266,9 +262,7 @@ incompl(tp) * types. */ void -setcompl(tp, ic) - type_t *tp; - int ic; +setcompl(type_t *tp, int ic) { tspec_t t; @@ -289,8 +283,7 @@ setcompl(tp, ic) * storage classes. */ void -addscl(sc) - scl_t sc; +addscl(scl_t sc) { if (sc == INLINE) { if (dcs->d_inline) @@ -326,8 +319,7 @@ addscl(sc) * struct/union/enum tag. */ void -addtype(tp) - type_t *tp; +addtype(type_t *tp) { tspec_t t; @@ -424,9 +416,7 @@ addtype(tp) * and other specifiers (except struct, union, enum, typedef name) */ static type_t * -tdeferr(td, t) - type_t *td; - tspec_t t; +tdeferr(type_t *td, tspec_t t) { tspec_t t2; @@ -498,9 +488,7 @@ tdeferr(td, t) * if the tag is unnamed. */ static void -settdsym(tp, sym) - type_t *tp; - sym_t *sym; +settdsym(type_t *tp, sym_t *sym) { tspec_t t; @@ -522,8 +510,7 @@ settdsym(tp, sym) * for all declarators. */ void -addqual(q) - tqual_t q; +addqual(tqual_t q) { if (q == CONST) { if (dcs->d_const) { @@ -547,8 +534,7 @@ addqual(q) * argument declaration lists ...) */ void -pushdecl(sc) - scl_t sc; +pushdecl(scl_t sc) { dinfo_t *di; @@ -567,7 +553,7 @@ pushdecl(sc) * Go back to previous declaration level */ void -popdecl() +popdecl(void) { dinfo_t *di; @@ -652,7 +638,7 @@ popdecl() * global declarations/definitions. */ void -setasm() +setasm(void) { dinfo_t *di; @@ -665,7 +651,7 @@ setasm() * will be used by the next declaration */ void -clrtyp() +clrtyp(void) { dcs->d_atyp = dcs->d_smod = dcs->d_lmod = NOTSPEC; dcs->d_scl = NOSCL; @@ -684,7 +670,7 @@ clrtyp() * context. */ void -deftyp() +deftyp(void) { tspec_t t, s, l; type_t *tp; @@ -800,8 +786,7 @@ deftyp() * Merge type specifiers (char, ..., long long, signed, unsigned). */ static tspec_t -mrgtspec(t, s) - tspec_t t, s; +mrgtspec(tspec_t t, tspec_t s) { if (s == SIGNED || s == UNSIGN) { if (t == CHAR) { @@ -828,9 +813,7 @@ mrgtspec(t, s) * if name is not NULL. */ int -length(tp, name) - type_t *tp; - const char *name; +length(type_t *tp, const char *name) { int elem, elsz; @@ -871,8 +854,7 @@ length(tp, name) * Get the alignment of the given Type in bits. */ int -getbound(tp) - type_t *tp; +getbound(type_t *tp) { int a; tspec_t t; @@ -903,8 +885,7 @@ getbound(tp) * struct/union/enum elements and parameters. */ sym_t * -lnklst(l1, l2) - sym_t *l1, *l2; +lnklst(sym_t *l1, sym_t *l2) { sym_t *l; @@ -926,8 +907,7 @@ lnklst(l1, l2) * - void types other than type of function or pointer */ void -chktyp(sym) - sym_t *sym; +chktyp(sym_t *sym) { tspec_t to, t; type_t **tpp, *tp; @@ -1019,8 +999,7 @@ chktyp(sym) * Process the declarator of a struct/union element. */ sym_t * -decl1str(dsym) - sym_t *dsym; +decl1str(sym_t *dsym) { type_t *tp; tspec_t t; @@ -1137,8 +1116,7 @@ decl1str(dsym) * al contains the required alignment, len the length of a bit-field. */ static void -align(al, len) - int al, len; +align(int al, int len) { int no; @@ -1159,9 +1137,7 @@ align(al, len) * Remember the width of the field in its type structure. */ sym_t * -bitfield(dsym, len) - sym_t *dsym; - int len; +bitfield(sym_t *dsym, int len) { if (dsym == NULL) { dsym = getblk(sizeof (sym_t)); @@ -1185,8 +1161,7 @@ bitfield(dsym, len) * will be at the top of the list. */ pqinf_t * -mergepq(p1, p2) - pqinf_t *p1, *p2; +mergepq(pqinf_t *p1, pqinf_t *p2) { pqinf_t *p; @@ -1224,9 +1199,7 @@ mergepq(p1, p2) * declarator. The new type extension is inserted between both. */ sym_t * -addptr(decl, pi) - sym_t *decl; - pqinf_t *pi; +addptr(sym_t *decl, pqinf_t *pi) { type_t **tpp, *tp; pqinf_t *npi; @@ -1253,9 +1226,7 @@ addptr(decl, pi) * n is the specified dimension */ sym_t * -addarray(decl, dim, n) - sym_t *decl; - int dim, n; +addarray(sym_t *decl, int dim, int n) { type_t **tpp, *tp; @@ -1284,8 +1255,7 @@ addarray(decl, dim, n) } sym_t * -addfunc(decl, args) - sym_t *decl, *args; +addfunc(sym_t *decl, sym_t *args) { type_t **tpp, *tp; @@ -1333,8 +1303,7 @@ addfunc(decl, args) */ /* ARGSUSED */ static sym_t * -nsfunc(decl, args) - sym_t *decl, *args; +nsfunc(sym_t *decl, sym_t *args) { sym_t *arg, *sym; scl_t sc; @@ -1372,8 +1341,7 @@ nsfunc(decl, args) * Called for old style function declarations. */ static void -osfunc(decl, args) - sym_t *decl, *args; +osfunc(sym_t *decl, sym_t *args) { /* * Remember list of params only if this is really seams to be @@ -1402,9 +1370,7 @@ osfunc(decl, args) * error message. */ void -chkfdef(sym, msg) - sym_t *sym; - int msg; +chkfdef(sym_t *sym, int msg) { if (sym->s_osdef) { if (msg) { @@ -1424,8 +1390,7 @@ chkfdef(sym, msg) * s_def and s_reg are valid after dname(). */ sym_t * -dname(sym) - sym_t *sym; +dname(sym_t *sym) { scl_t sc; @@ -1523,8 +1488,7 @@ dname(sym) * definition. */ sym_t * -iname(sym) - sym_t *sym; +iname(sym_t *sym) { if (sym->s_scl != NOSCL) { if (blklev == sym->s_blklev) { @@ -1552,10 +1516,7 @@ iname(sym) * semi is 1 if the following token is T_SEMI */ type_t * -mktag(tag, kind, decl, semi) - sym_t *tag; - tspec_t kind; - int decl, semi; +mktag(sym_t *tag, tspec_t kind, int decl, int semi) { scl_t scl; type_t *tp; @@ -1623,10 +1584,7 @@ mktag(tag, kind, decl, semi) * semi is 1 if T_SEMI follows */ static sym_t * -newtag(tag, scl, decl, semi) - sym_t *tag; - scl_t scl; - int decl, semi; +newtag(sym_t *tag, scl_t scl, int decl, int semi) { if (tag->s_blklev < blklev) { if (semi) { @@ -1678,8 +1636,7 @@ newtag(tag, scl, decl, semi) } const char * -scltoa(sc) - scl_t sc; +scltoa(scl_t sc) { const char *s; @@ -1702,9 +1659,7 @@ scltoa(sc) * tp points to the type of the, tag, fmem to the list of members/enums. */ type_t * -compltag(tp, fmem) - type_t *tp; - sym_t *fmem; +compltag(type_t *tp, sym_t *fmem) { tspec_t t; str_t *sp; @@ -1749,9 +1704,7 @@ compltag(tp, fmem) * impl is 1 if the the value of the enumerator was not explicit specified. */ sym_t * -ename(sym, val, impl) - sym_t *sym; - int val, impl; +ename(sym_t *sym, int val, int impl) { if (sym->s_scl) { if (sym->s_blklev == blklev) { @@ -1793,9 +1746,7 @@ ename(sym, val, impl) * Process a single external declarator. */ void -decl1ext(dsym, initflg) - sym_t *dsym; - int initflg; +decl1ext(sym_t *dsym, int initflg) { int warn, rval, redec; sym_t *rdsym; @@ -1914,8 +1865,7 @@ decl1ext(dsym, initflg) * the same symbol. */ void -cpuinfo(sym, rdsym) - sym_t *sym, *rdsym; +cpuinfo(sym_t *sym, sym_t *rdsym) { sym->s_spos = rdsym->s_spos; sym->s_upos = rdsym->s_upos; @@ -1929,9 +1879,7 @@ cpuinfo(sym, rdsym) * a warning. */ int -isredec(dsym, warn) - sym_t *dsym; - int *warn; +isredec(sym_t *dsym, int *warn) { sym_t *rsym; @@ -2010,9 +1958,7 @@ isredec(dsym, warn) * compatible with a prototype */ int -eqtype(tp1, tp2, ignqual, promot, warn) - type_t *tp1, *tp2; - int ignqual, promot, *warn; +eqtype(type_t *tp1, type_t *tp2, int ignqual, int promot, int *warn) { tspec_t t; @@ -2078,9 +2024,7 @@ eqtype(tp1, tp2, ignqual, promot, warn) * Compares the parameter types of two prototypes. */ static int -eqargs(tp1, tp2, warn) - type_t *tp1, *tp2; - int *warn; +eqargs(type_t *tp1, type_t *tp2, int *warn) { sym_t *a1, *a2; @@ -2114,9 +2058,7 @@ eqargs(tp1, tp2, warn) * is applied on it */ static int -mnoarg(tp, warn) - type_t *tp; - int *warn; +mnoarg(type_t *tp, int *warn) { sym_t *arg; tspec_t t; @@ -2141,8 +2083,7 @@ mnoarg(tp, warn) * a previous old style function definition. */ static int -chkosdef(rdsym, dsym) - sym_t *rdsym, *dsym; +chkosdef(sym_t *rdsym, sym_t *dsym) { sym_t *args, *pargs, *arg, *parg; int narg, nparg, n; @@ -2203,8 +2144,7 @@ chkosdef(rdsym, dsym) * be duplicated. */ void -compltyp(dsym, ssym) - sym_t *dsym, *ssym; +compltyp(sym_t *dsym, sym_t *ssym) { type_t **dstp, *src; type_t *dst; @@ -2238,9 +2178,7 @@ compltyp(dsym, ssym) * Completes the declaration of a single argument. */ sym_t * -decl1arg(sym, initflg) - sym_t *sym; - int initflg; +decl1arg(sym_t *sym, int initflg) { tspec_t t; @@ -2304,7 +2242,7 @@ decl1arg(sym, initflg) * prototype. */ void -cluparg() +cluparg(void) { sym_t *args, *arg, *pargs, *parg; int narg, nparg, n, msg; @@ -2429,8 +2367,7 @@ cluparg() * Returns 1 if the position of the previous declaration should be reported. */ static int -chkptdecl(arg, parg) - sym_t *arg, *parg; +chkptdecl(sym_t *arg, sym_t *parg) { type_t *tp, *ptp; int warn, msg; @@ -2463,9 +2400,7 @@ chkptdecl(arg, parg) * Completes a single local declaration/definition. */ void -decl1loc(dsym, initflg) - sym_t *dsym; - int initflg; +decl1loc(sym_t *dsym, int initflg) { /* Correct a mistake done in dname(). */ if (dsym->s_type->t_tspec == FUNC) { @@ -2605,8 +2540,7 @@ decl1loc(dsym, initflg) * Processes (re)declarations of external Symbols inside blocks. */ static void -ledecl(dsym) - sym_t *dsym; +ledecl(sym_t *dsym) { int eqt, warn; sym_t *esym; @@ -2661,8 +2595,7 @@ ledecl(dsym) * detected. */ static int -chkinit(sym) - sym_t *sym; +chkinit(sym_t *sym) { int err; @@ -2693,7 +2626,7 @@ chkinit(sym) * Create a symbole for an abstract declaration. */ sym_t * -aname() +aname(void) { sym_t *sym; @@ -2721,7 +2654,7 @@ aname() * Removes anything which has nothing to do on global level. */ void -globclup() +globclup(void) { while (dcs->d_nxt != NULL) popdecl(); @@ -2741,8 +2674,7 @@ globclup() * Process an abstract type declaration */ sym_t * -decl1abs(sym) - sym_t *sym; +decl1abs(sym_t *sym) { chkfdef(sym, 1); chktyp(sym); @@ -2753,8 +2685,7 @@ decl1abs(sym) * Checks size after declarations of variables and their initialisation. */ void -chksz(dsym) - sym_t *dsym; +chksz(sym_t *dsym) { /* * check size only for symbols which are defined and no function and @@ -2782,8 +2713,7 @@ chksz(dsym) * Mark an object as set if it is not already */ void -setsflg(sym) - sym_t *sym; +setsflg(sym_t *sym) { if (!sym->s_set) { sym->s_set = 1; @@ -2795,9 +2725,7 @@ setsflg(sym) * Mark an object as used if it is not already */ void -setuflg(sym, fcall, szof) - sym_t *sym; - int fcall, szof; +setuflg(sym_t *sym, int fcall, int szof) { if (!sym->s_used) { sym->s_used = 1; @@ -2819,8 +2747,7 @@ setuflg(sym, fcall, szof) * with s_dlnxt) if these are not used or only set. */ void -chkusage(di) - dinfo_t *di; +chkusage(dinfo_t *di) { sym_t *sym; int mknowarn; @@ -2840,9 +2767,7 @@ chkusage(di) * only set. */ void -chkusg1(novar, sym) - int novar; - sym_t *sym; +chkusg1(int novar, sym_t *sym) { pos_t cpos; @@ -2867,9 +2792,7 @@ chkusg1(novar, sym) } static void -chkausg(novar, arg) - int novar; - sym_t *arg; +chkausg(int novar, sym_t *arg) { if (!arg->s_set) lerror("chkausg() 1"); @@ -2885,9 +2808,7 @@ chkausg(novar, arg) } static void -chkvusg(novar, sym) - int novar; - sym_t *sym; +chkvusg(int novar, sym_t *sym) { scl_t sc; sym_t *xsym; @@ -2954,8 +2875,7 @@ chkvusg(novar, sym) } static void -chklusg(lab) - sym_t *lab; +chklusg(sym_t *lab) { if (blklev != 1 || lab->s_blklev != 1) lerror("chklusg() 1"); @@ -2972,8 +2892,7 @@ chklusg(lab) } static void -chktusg(sym) - sym_t *sym; +chktusg(sym_t *sym) { if (!incompl(sym->s_type)) return; @@ -3010,7 +2929,7 @@ chktusg(sym) * - static symbols which are never used */ void -chkglsyms() +chkglsyms(void) { sym_t *sym; pos_t cpos; @@ -3037,8 +2956,7 @@ chkglsyms() } static void -chkglvar(sym) - sym_t *sym; +chkglvar(sym_t *sym) { if (sym->s_scl == TYPEDEF || sym->s_scl == ENUMCON) return; @@ -3084,8 +3002,7 @@ chkglvar(sym) } static void -glchksz(sym) - sym_t *sym; +glchksz(sym_t *sym) { if (sym->s_def == TDEF) { if (sym->s_type->t_tspec == FUNC) @@ -3111,9 +3028,7 @@ glchksz(sym) * Prints information about location of previous definition/declaration. */ void -prevdecl(msg, psym) - int msg; - sym_t *psym; +prevdecl(int msg, sym_t *psym) { pos_t cpos; diff --git a/usr.bin/xlint/lint1/emit.c b/usr.bin/xlint/lint1/emit.c index 7765624298..a06ba34fa1 100644 --- a/usr.bin/xlint/lint1/emit.c +++ b/usr.bin/xlint/lint1/emit.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.bin/xlint/lint1/emit.c,v 1.1.1.1.8.1 2001/03/04 09:27:26 kris Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/emit.c,v 1.4 2004/07/07 08:20:18 asmodai Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/emit.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ * * $NetBSD: emit.c,v 1.2 1995/07/03 21:24:00 cgd Exp $ */ @@ -57,8 +57,7 @@ static void outxbuf(void); * initialize output */ void -outopen(name) - const char *name; +outopen(const char *name) { loname = name; @@ -75,7 +74,7 @@ outopen(name) * flush output buffer and close file */ void -outclose() +outclose(void) { outclr(); if (fclose(lout) == EOF) @@ -86,7 +85,7 @@ outclose() * resize output buffer */ static void -outxbuf() +outxbuf(void) { ptrdiff_t coffs; @@ -101,7 +100,7 @@ outxbuf() * if it is not empty, it is flushed */ void -outclr() +outclr(void) { size_t sz; @@ -120,8 +119,7 @@ outclr() * write a character to the output buffer */ void -outchar(c) - int c; +outchar(int c) { if (ob.o_nxt == ob.o_end) outxbuf(); @@ -132,8 +130,7 @@ outchar(c) * write a character to the output buffer, qouted if necessary */ void -outqchar(c) - int c; +outqchar(int c) { if (isprint(c) && c != '\\' && c != '"' && c != '\'') { outchar(c); @@ -185,8 +182,7 @@ outqchar(c) * should be quoted */ void -outstrg(s) - const char *s; +outstrg(const char *s) { while (*s != '\0') { if (ob.o_nxt == ob.o_end) @@ -199,8 +195,7 @@ outstrg(s) * write an integer value to toe output buffer */ void -outint(i) - int i; +outint(int i) { if ((ob.o_end - ob.o_nxt) < 3 * sizeof (int)) outxbuf(); @@ -212,8 +207,7 @@ outint(i) * the name is preceded by its length */ void -outname(name) - const char *name; +outname(const char *name) { if (name == NULL) errx(1, "internal error: outname() 1"); @@ -225,8 +219,7 @@ outname(name) * write the name of the .c source */ void -outsrc(name) - const char *name; +outsrc(const char *name) { outclr(); outchar('S'); diff --git a/usr.bin/xlint/lint1/emit1.c b/usr.bin/xlint/lint1/emit1.c index 53770af595..c2d490bc2f 100644 --- a/usr.bin/xlint/lint1/emit1.c +++ b/usr.bin/xlint/lint1/emit1.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/emit1.c,v 1.4 2003/11/03 19:31:34 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/emit1.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -81,8 +81,7 @@ static void outfstrg(strg_t *); * and 'v' (for volatile) */ void -outtype(tp) - type_t *tp; +outtype(type_t *tp) { int t, s, na; sym_t *arg; @@ -152,8 +151,7 @@ outtype(tp) * it uses its own output buffer for conversion */ const char * -ttos(tp) - type_t *tp; +ttos(type_t *tp) { static ob_t tob; ob_t tmp; @@ -183,8 +181,7 @@ ttos(tp) * refers to this tag, this typename is written */ static void -outtt(tag, tdef) - sym_t *tag, *tdef; +outtt(sym_t *tag, sym_t *tdef) { if (tag->s_name != unnamed) { outint(1); @@ -205,10 +202,7 @@ outtt(tag, tdef) * not here */ void -outsym(sym, sc, def) - sym_t *sym; - scl_t sc; - def_t def; +outsym(sym_t *sym, scl_t sc, def_t def) { /* * Static function declarations must also be written to the output @@ -276,10 +270,7 @@ outsym(sym, sc, def) * they are called with proper argument types */ void -outfdef(fsym, posp, rval, osdef, args) - sym_t *fsym, *args; - pos_t *posp; - int rval, osdef; +outfdef(sym_t *fsym, pos_t *posp, int rval, int osdef, sym_t *args) { int narg; sym_t *arg; @@ -375,9 +366,7 @@ outfdef(fsym, posp, rval, osdef, args) * (casted to void) */ void -outcall(tn, rvused, rvdisc) - tnode_t *tn; - int rvused, rvdisc; +outcall(tnode_t *tn, int rvused, int rvdisc) { tnode_t *args, *arg; int narg, n, i; @@ -462,8 +451,7 @@ outcall(tn, rvused, rvdisc) * writes them, enclosed in "" and qouted if necessary, to the output buffer */ static void -outfstrg(strg) - strg_t *strg; +outfstrg(strg_t *strg) { int c, oc, first; u_char *cp; @@ -562,8 +550,7 @@ outfstrg(strg) * writes a record if sym was used */ void -outusg(sym) - sym_t *sym; +outusg(sym_t *sym) { /* reset buffer */ outclr(); diff --git a/usr.bin/xlint/lint1/err.c b/usr.bin/xlint/lint1/err.c index db297a661c..5d8e65d5af 100644 --- a/usr.bin/xlint/lint1/err.c +++ b/usr.bin/xlint/lint1/err.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: err.c,v 1.8 1995/10/02 17:37:00 jpo Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/err.c,v 1.5 2004/07/07 08:20:18 asmodai Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/err.c,v 1.6 2004/07/07 12:13:26 asmodai Exp $ */ /* number of errors found */ @@ -368,8 +368,7 @@ const char *msgs[] = { * component of the path, otherwise it returns the argument. */ static const char * -basename(path) - const char *path; +basename(const char *path) { const char *cp, *cp1, *cp2; @@ -387,9 +386,7 @@ basename(path) } static void -verror(n, ap) - int n; - va_list ap; +verror(int n, va_list ap) { const char *fn; @@ -401,9 +398,7 @@ verror(n, ap) } static void -vwarning(n, ap) - int n; - va_list ap; +vwarning(int n, va_list ap) { const char *fn; diff --git a/usr.bin/xlint/lint1/func.c b/usr.bin/xlint/lint1/func.c index c0cb1b77a8..05888ad9f7 100644 --- a/usr.bin/xlint/lint1/func.c +++ b/usr.bin/xlint/lint1/func.c @@ -30,7 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: func.c,v 1.7 1995/10/02 17:31:40 jpo Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/func.c,v 1.3 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -136,8 +136,7 @@ int quadflg; * Puts a new element at the top of the stack used for control statements. */ void -pushctrl(env) - int env; +pushctrl(int env) { cstk_t *ci; @@ -151,8 +150,7 @@ pushctrl(env) * Removes the top element of the stack used for control statements. */ void -popctrl(env) - int env; +popctrl(int env) { cstk_t *ci; clst_t *cl; @@ -177,7 +175,7 @@ popctrl(env) * Prints a warning if a statement cannot be reached. */ void -chkreach() +chkreach(void) { if (!reached && !rchflg) { /* statement not reached */ @@ -197,8 +195,7 @@ chkreach() * redeclaration etc.. */ void -funcdef(fsym) - sym_t *fsym; +funcdef(sym_t *fsym) { int n, warn; sym_t *arg, *sym, *rdsym; @@ -330,7 +327,7 @@ funcdef(fsym) * Called at the end of a function definition. */ void -funcend() +funcend(void) { sym_t *arg; int n; @@ -396,10 +393,7 @@ funcend() * tn expression if typ == T_CASE */ void -label(typ, sym, tn) - int typ; - sym_t *sym; - tnode_t *tn; +label(int typ, sym_t *sym, tnode_t *tn) { cstk_t *ci; clst_t *cl; @@ -517,8 +511,7 @@ label(typ, sym, tn) * T_IF T_LPARN expr T_RPARN */ void -if1(tn) - tnode_t *tn; +if1(tnode_t *tn) { if (tn != NULL) tn = cconv(tn); @@ -533,7 +526,7 @@ if1(tn) * if_without_else T_ELSE */ void -if2() +if2(void) { cstk->c_rchif = reached ? 1 : 0; reached = 1; @@ -544,8 +537,7 @@ if2() * if_without_else T_ELSE stmnt */ void -if3(els) - int els; +if3(int els) { if (els) { reached |= cstk->c_rchif; @@ -559,8 +551,7 @@ if3(els) * T_SWITCH T_LPARN expr T_RPARN */ void -switch1(tn) - tnode_t *tn; +switch1(tnode_t *tn) { tspec_t t; type_t *tp; @@ -611,7 +602,7 @@ switch1(tn) * switch_expr stmnt */ void -switch2() +switch2(void) { int nenum, nclab; sym_t *esym; @@ -666,8 +657,7 @@ switch2() * T_WHILE T_LPARN expr T_RPARN */ void -while1(tn) - tnode_t *tn; +while1(tnode_t *tn) { if (!reached) { /* loop not entered at top */ @@ -703,7 +693,7 @@ while1(tn) * while_expr error */ void -while2() +while2(void) { /* * The end of the loop can be reached if it is no endless loop @@ -719,7 +709,7 @@ while2() * T_DO */ void -do1() +do1(void) { if (!reached) { /* loop not entered at top */ @@ -736,8 +726,7 @@ do1() * do error */ void -do2(tn) - tnode_t *tn; +do2(tnode_t *tn) { /* * If there was a continue statement the expression controlling the @@ -780,8 +769,7 @@ do2(tn) * T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN */ void -for1(tn1, tn2, tn3) - tnode_t *tn1, *tn2, *tn3; +for1(tnode_t *tn1, tnode_t *tn2, tnode_t *tn3) { /* * If there is no initialisation expression it is possible that @@ -841,7 +829,7 @@ for1(tn1, tn2, tn3) * for_exprs error */ void -for2() +for2(void) { pos_t cpos, cspos; tnode_t *tn3; @@ -886,8 +874,7 @@ for2() * T_GOTO error T_SEMI */ void -dogoto(lab) - sym_t *lab; +dogoto(sym_t *lab) { setuflg(lab, 0, 0); @@ -900,7 +887,7 @@ dogoto(lab) * T_BREAK T_SEMI */ void -dobreak() +dobreak(void) { cstk_t *ci; @@ -926,7 +913,7 @@ dobreak() * T_CONTINUE T_SEMI */ void -docont() +docont(void) { cstk_t *ci; @@ -949,8 +936,7 @@ docont() * T_RETURN expr T_SEMI */ void -doreturn(tn) - tnode_t *tn; +doreturn(tnode_t *tn) { tnode_t *ln, *rn; cstk_t *ci; @@ -1018,8 +1004,7 @@ doreturn(tn) * Especially remove informations about unused lint comments. */ void -glclup(silent) - int silent; +glclup(int silent) { pos_t cpos; @@ -1070,8 +1055,7 @@ glclup(silent) * for usage. A missing argument is taken to be 0. */ void -argsused(n) - int n; +argsused(int n) { if (n == -1) n = 0; @@ -1096,8 +1080,7 @@ argsused(n) * to the function definition. A missing argument is taken to be 0. */ void -varargs(n) - int n; +varargs(int n) { if (n == -1) n = 0; @@ -1122,8 +1105,7 @@ varargs(n) * used the check the types of remaining arguments. */ void -printflike(n) - int n; +printflike(int n) { if (n == -1) n = 0; @@ -1148,8 +1130,7 @@ printflike(n) * used the check the types of remaining arguments. */ void -scanflike(n) - int n; +scanflike(int n) { if (n == -1) n = 0; @@ -1173,8 +1154,7 @@ scanflike(n) */ /* ARGSUSED */ void -constcond(n) - int n; +constcond(int n) { ccflg = 1; } @@ -1185,8 +1165,7 @@ constcond(n) */ /* ARGSUSED */ void -fallthru(n) - int n; +fallthru(int n) { ftflg = 1; } @@ -1197,8 +1176,7 @@ fallthru(n) */ /* ARGSUSED */ void -notreach(n) - int n; +notreach(int n) { reached = 0; rchflg = 1; @@ -1206,8 +1184,7 @@ notreach(n) /* ARGSUSED */ void -lintlib(n) - int n; +lintlib(int n) { if (dcs->d_ctx != EXTERN) { /* must be outside function: ** %s ** */ @@ -1223,8 +1200,7 @@ lintlib(n) */ /* ARGSUSED */ void -linted(n) - int n; +linted(int n) { nowarn = 1; } @@ -1235,8 +1211,7 @@ linted(n) * to PROTOLIB is nonzero. Otherwise prototypes are handled normaly. */ void -protolib(n) - int n; +protolib(int n) { if (dcs->d_ctx != EXTERN) { /* must be outside function: ** %s ** */ @@ -1252,8 +1227,7 @@ protolib(n) */ /* ARGSUSED */ void -longlong(n) - int n; +longlong(int n) { quadflg = 1; } diff --git a/usr.bin/xlint/lint1/init.c b/usr.bin/xlint/lint1/init.c index 15e4f936c4..4bb673709a 100644 --- a/usr.bin/xlint/lint1/init.c +++ b/usr.bin/xlint/lint1/init.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/init.c,v 1.4 2003/11/03 19:31:34 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/init.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -65,7 +65,7 @@ static int strginit(tnode_t *); * which is to be initialized on it. */ void -prepinit() +prepinit(void) { istk_t *istk; @@ -92,7 +92,7 @@ prepinit() } static void -popi2() +popi2(void) { istk_t *istk; sym_t *m; @@ -123,8 +123,7 @@ popi2() } static void -popinit(brace) - int brace; +popinit(int brace) { if (brace) { /* @@ -149,7 +148,7 @@ popinit(brace) } static void -pushinit() +pushinit(void) { istk_t *istk; int cnt; @@ -234,7 +233,7 @@ pushinit() } static void -testinit() +testinit(void) { istk_t *istk; @@ -265,8 +264,7 @@ testinit() } static void -nextinit(brace) - int brace; +nextinit(int brace) { if (!brace) { if (initstk->i_type == NULL && @@ -302,7 +300,7 @@ nextinit(brace) } void -initlbr() +initlbr(void) { if (initerr) return; @@ -324,7 +322,7 @@ initlbr() } void -initrbr() +initrbr(void) { if (initerr) return; @@ -333,8 +331,7 @@ initrbr() } void -mkinit(tn) - tnode_t *tn; +mkinit(tnode_t *tn) { ptrdiff_t offs; sym_t *sym; @@ -445,8 +442,7 @@ mkinit(tn) static int -strginit(tn) - tnode_t *tn; +strginit(tnode_t *tn) { tspec_t t; istk_t *istk; diff --git a/usr.bin/xlint/lint1/main1.c b/usr.bin/xlint/lint1/main1.c index bf9595aec0..cf7020e08c 100644 --- a/usr.bin/xlint/lint1/main1.c +++ b/usr.bin/xlint/lint1/main1.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: main1.c,v 1.3 1995/10/02 17:29:56 jpo Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/main1.c,v 1.4 2003/11/03 19:31:34 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/main1.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -106,9 +106,7 @@ int zflag = 1; static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c; @@ -167,14 +165,14 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: lint1 [-abcdeghprstuvyzF] src dest\n"); exit(1); } void -norecover() +norecover(void) { /* cannot recover from previous errors */ error(224); diff --git a/usr.bin/xlint/lint1/mem.c b/usr.bin/xlint/lint1/mem.c index 03f659d7bb..31efb09e60 100644 --- a/usr.bin/xlint/lint1/mem.c +++ b/usr.bin/xlint/lint1/mem.c @@ -30,7 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: mem.c,v 1.2 1995/07/03 21:24:24 cgd Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/mem.c,v 1.3 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -40,8 +40,7 @@ #include "lint.h" void * -xmalloc(s) - size_t s; +xmalloc(size_t s) { void *p; @@ -51,8 +50,7 @@ xmalloc(s) } void * -xcalloc(n, s) - size_t n, s; +xcalloc(size_t n, size_t s) { void *p; @@ -62,9 +60,7 @@ xcalloc(n, s) } void * -xrealloc(p, s) - void *p; - size_t s; +xrealloc(void *p, size_t s) { if ((p = realloc(p, s)) == NULL) nomem(); @@ -72,8 +68,7 @@ xrealloc(p, s) } char * -xstrdup(s) - const char *s; +xstrdup(const char *s) { char *s2; @@ -83,7 +78,7 @@ xstrdup(s) } void -nomem() +nomem(void) { errx(1, "virtual memory exhausted"); } diff --git a/usr.bin/xlint/lint1/mem1.c b/usr.bin/xlint/lint1/mem1.c index 5910c7f627..0471f1be8b 100644 --- a/usr.bin/xlint/lint1/mem1.c +++ b/usr.bin/xlint/lint1/mem1.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: mem1.c,v 1.2 1995/07/03 21:24:25 cgd Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/mem1.c,v 1.4 2003/11/03 19:31:34 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/mem1.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -62,9 +62,7 @@ static fn_t *srchfn(const char *, size_t); * Look for a Filename of length l. */ static fn_t * -srchfn(s, len) - const char *s; - size_t len; +srchfn(const char *s, size_t len) { fn_t *fn; @@ -79,16 +77,13 @@ srchfn(s, len) * Return a shared string for filename s. */ const char * -fnalloc(s) - const char *s; +fnalloc(const char *s) { return (s != NULL ? fnnalloc(s, strlen(s)) : NULL); } const char * -fnnalloc(s, len) - const char *s; - size_t len; +fnnalloc(const char *s, size_t len) { fn_t *fn; @@ -120,8 +115,7 @@ fnnalloc(s, len) * Get id of a filename. */ int -getfnid(s) - const char *s; +getfnid(const char *s) { fn_t *fn; @@ -167,7 +161,7 @@ static void xfreeblk(mbl_t **); static mbl_t *xnewblk(void); static mbl_t * -xnewblk() +xnewblk(void) { mbl_t *mb; int prot, flags; @@ -198,9 +192,7 @@ xnewblk() * zero'd in xfreeblk(). */ static void * -xgetblk(mbp, s) - mbl_t **mbp; - size_t s; +xgetblk(mbl_t **mbp, size_t s) { mbl_t *mb; void *p; @@ -229,8 +221,7 @@ xgetblk(mbp, s) * used memory to zero. */ static void -xfreeblk(fmbp) - mbl_t **fmbp; +xfreeblk(mbl_t **fmbp) { mbl_t *mb; @@ -243,7 +234,7 @@ xfreeblk(fmbp) } void -initmem() +initmem(void) { int pgsz; @@ -258,9 +249,7 @@ initmem() * Allocate memory associated with level l. */ void * -getlblk(l, s) - int l; - size_t s; +getlblk(int l, size_t s) { while (l >= nmblks) { mblks = xrealloc(mblks, (nmblks + ML_INC) * sizeof (mbl_t *)); @@ -271,8 +260,7 @@ getlblk(l, s) } void * -getblk(s) - size_t s; +getblk(size_t s) { return (getlblk(mblklev, s)); } @@ -281,14 +269,13 @@ getblk(s) * Free all memory associated with level l. */ void -freelblk(l) - int l; +freelblk(int l) { xfreeblk(&mblks[l]); } void -freeblk() +freeblk(void) { freelblk(mblklev); } @@ -300,8 +287,7 @@ freeblk() static mbl_t *tmblk; void * -tgetblk(s) - size_t s; +tgetblk(size_t s) { return (xgetblk(&tmblk, s)); } @@ -310,7 +296,7 @@ tgetblk(s) * Get memory for a new tree node. */ tnode_t * -getnode() +getnode(void) { return (tgetblk(sizeof (tnode_t))); } @@ -319,7 +305,7 @@ getnode() * Free all memory which is allocated by the the current expression. */ void -tfreeblk() +tfreeblk(void) { xfreeblk(&tmblk); } @@ -330,7 +316,7 @@ tfreeblk() * used to restore the memory. */ mbl_t * -tsave() +tsave(void) { mbl_t *tmem; @@ -345,8 +331,7 @@ tsave() * tfreeblk() frees the restored memory. */ void -trestor(tmem) - mbl_t *tmem; +trestor(mbl_t *tmem) { tfreeblk(); if (tmblk != NULL) { diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index 7c5e42f061..2a21dac875 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: tree.c,v 1.12 1995/10/02 17:37:57 jpo Exp $ - * $DragonFly: src/usr.bin/xlint/lint1/tree.c,v 1.5 2004/06/19 18:55:48 joerg Exp $ + * $DragonFly: src/usr.bin/xlint/lint1/tree.c,v 1.6 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -85,7 +85,7 @@ static void precconf(tnode_t *); * Initialize mods of operators. */ void -initmtab() +initmtab(void) { static struct { op_t op; @@ -216,9 +216,7 @@ initmtab() * This is most often used to change type "T" in type "pointer to T". */ type_t * -incref(tp, t) - type_t *tp; - tspec_t t; +incref(type_t *tp, tspec_t t) { type_t *tp2; @@ -232,9 +230,7 @@ incref(tp, t) * same for use in expressions */ type_t * -tincref(tp, t) - type_t *tp; - tspec_t t; +tincref(type_t *tp, tspec_t t) { type_t *tp2; @@ -248,9 +244,7 @@ tincref(tp, t) * Create a node for a constant. */ tnode_t * -getcnode(tp, v) - type_t *tp; - val_t *v; +getcnode(type_t *tp, val_t *v) { tnode_t *n; @@ -269,9 +263,7 @@ getcnode(tp, v) * Create a node for a integer constant. */ static tnode_t * -getinode(t, q) - tspec_t t; - quad_t q; +getinode(tspec_t t, quad_t q) { tnode_t *n; @@ -289,9 +281,7 @@ getinode(t, q) * ntok is the token which follows the name. */ tnode_t * -getnnode(sym, ntok) - sym_t *sym; - int ntok; +getnnode(sym_t *sym, int ntok) { tnode_t *n; @@ -337,8 +327,7 @@ getnnode(sym, ntok) * Create a node for a string. */ tnode_t * -getsnode(strg) - strg_t *strg; +getsnode(strg_t *strg) { size_t len; tnode_t *n; @@ -376,10 +365,7 @@ getsnode(strg) * member of the struct or union specified by the tn argument. */ sym_t * -strmemb(tn, op, msym) - tnode_t *tn; - op_t op; - sym_t *msym; +strmemb(tnode_t *tn, op_t op, sym_t *msym) { str_t *str; type_t *tp; @@ -536,9 +522,7 @@ strmemb(tn, op, msym) * rn if not NULL, right operand */ tnode_t * -build(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +build(op_t op, tnode_t *ln, tnode_t *rn) { mod_t *mp; tnode_t *ntn; @@ -716,8 +700,7 @@ build(op, ln, rn) * Lvalues are converted to rvalues. */ tnode_t * -cconv(tn) - tnode_t *tn; +cconv(tnode_t *tn) { type_t *tp; @@ -761,10 +744,7 @@ cconv(tn) * If the types are ok, typeok() returns 1, otherwise 0. */ int -typeok(op, arg, ln, rn) - op_t op; - int arg; - tnode_t *ln, *rn; +typeok(op_t op, int arg, tnode_t *ln, tnode_t *rn) { mod_t *mp; tspec_t lt, rt, lst, rst, olt, ort; @@ -1149,9 +1129,7 @@ typeok(op, arg, ln, rn) } static void -ptrcmpok(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +ptrcmpok(op_t op, tnode_t *ln, tnode_t *rn) { type_t *ltp, *rtp; tspec_t lt, rt; @@ -1189,10 +1167,7 @@ ptrcmpok(op, ln, rn) * If the types are (almost) compatible, 1 is returned, otherwise 0. */ static int -asgntypok(op, arg, ln, rn) - op_t op; - int arg; - tnode_t *ln, *rn; +asgntypok(op_t op, int arg, tnode_t *ln, tnode_t *rn) { tspec_t lt, rt, lst, rst; type_t *ltp, *rtp, *lstp, *rstp; @@ -1330,9 +1305,7 @@ asgntypok(op, arg, ln, rn) * enum type, is applied to an enum type. */ static void -chkbeop(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +chkbeop(op_t op, tnode_t *ln, tnode_t *rn) { mod_t *mp; @@ -1365,10 +1338,7 @@ chkbeop(op, ln, rn) * Prints a warning if an operator is applied to two different enum types. */ static void -chkeop2(op, arg, ln, rn) - op_t op; - int arg; - tnode_t *ln, *rn; +chkeop2(op_t op, int arg, tnode_t *ln, tnode_t *rn) { mod_t *mp; @@ -1407,10 +1377,7 @@ chkeop2(op, arg, ln, rn) * types. */ static void -chkeop1(op, arg, ln, rn) - op_t op; - int arg; - tnode_t *ln, *rn; +chkeop1(op_t op, int arg, tnode_t *ln, tnode_t *rn) { if (!eflag) return; @@ -1449,10 +1416,7 @@ chkeop1(op, arg, ln, rn) * Build and initialize a new node. */ static tnode_t * -mktnode(op, type, ln, rn) - op_t op; - type_t *type; - tnode_t *ln, *rn; +mktnode(op_t op, type_t *type, tnode_t *ln, tnode_t *rn) { tnode_t *ntn; tspec_t t; @@ -1485,10 +1449,7 @@ mktnode(op, type, ln, rn) * float to double. */ tnode_t * -promote(op, farg, tn) - op_t op; - int farg; - tnode_t *tn; +promote(op_t op, int farg, tnode_t *tn) { tspec_t t; type_t *ntp; @@ -1563,9 +1524,7 @@ promote(op, farg, tn) * type. This is done in different ways for traditional C and ANIS C. */ static void -balance(op, lnp, rnp) - op_t op; - tnode_t **lnp, **rnp; +balance(op_t op, tnode_t **lnp, tnode_t **rnp) { tspec_t lt, rt, t; int i, u; @@ -1640,11 +1599,7 @@ balance(op, lnp, rnp) * If op is FARG, arg is the number of the argument (used for warnings). */ tnode_t * -convert(op, arg, tp, tn) - op_t op; - int arg; - type_t *tp; - tnode_t *tn; +convert(op_t op, int arg, type_t *tp, tnode_t *tn) { tnode_t *ntn; tspec_t nt, ot, ost; @@ -1693,11 +1648,7 @@ convert(op, arg, tp, tn) * in asgntypok(). */ static void -ptconv(arg, nt, ot, tp, tn) - int arg; - tspec_t nt, ot; - type_t *tp; - tnode_t *tn; +ptconv(int arg, tspec_t nt, tspec_t ot, type_t *tp, tnode_t *tn) { tnode_t *ptn; @@ -1749,12 +1700,7 @@ ptconv(arg, nt, ot, tp, tn) */ /* ARGSUSED */ static void -iiconv(op, arg, nt, ot, tp, tn) - op_t op; - int arg; - tspec_t nt, ot; - type_t *tp; - tnode_t *tn; +iiconv(op_t op, int arg, tspec_t nt, tspec_t ot, type_t *tp, tnode_t *tn) { if (tn->tn_op == CON) return; @@ -1793,11 +1739,7 @@ iiconv(op, arg, nt, ot, tp, tn) * Print warnings for dubious conversions of pointer to integer. */ static void -piconv(op, nt, tp, tn) - op_t op; - tspec_t nt; - type_t *tp; - tnode_t *tn; +piconv(op_t op, tspec_t nt, type_t *tp, tnode_t *tn) { if (tn->tn_op == CON) return; @@ -1822,10 +1764,7 @@ piconv(op, nt, tp, tn) * Print warnings for questionable pointer conversions. */ static void -ppconv(op, tn, tp) - op_t op; - tnode_t *tn; - type_t *tp; +ppconv(op_t op, tnode_t *tn, type_t *tp) { tspec_t nt, ot; const char *nts, *ots; @@ -1882,11 +1821,7 @@ ppconv(op, tn, tp) * v old constant */ void -cvtcon(op, arg, tp, nv, v) - op_t op; - int arg; - type_t *tp; - val_t *nv, *v; +cvtcon(op_t op, int arg, type_t *tp, val_t *nv, val_t *v) { tspec_t ot, nt; ldbl_t max, min; @@ -2115,9 +2050,7 @@ cvtcon(op, arg, tp, nv, v) * Prints a appropriate warning. */ static void -incompat(op, lt, rt) - op_t op; - tspec_t lt, rt; +incompat(op_t op, tspec_t lt, tspec_t rt) { mod_t *mp; @@ -2149,9 +2082,7 @@ incompat(op, lt, rt) * Print an appropriate warning. */ static void -illptrc(mp, ltp, rtp) - mod_t *mp; - type_t *ltp, *rtp; +illptrc(mod_t *mp, type_t *ltp, type_t *rtp) { tspec_t lt, rt; @@ -2185,8 +2116,7 @@ illptrc(mp, ltp, rtp) * of tp1->t_subt and tp2->t_subt. */ static void -mrgqual(tpp, tp1, tp2) - type_t **tpp, *tp1, *tp2; +mrgqual(type_t **tpp, type_t *tp1, type_t *tp2) { if ((*tpp)->t_tspec != PTR || tp1->t_tspec != PTR || tp2->t_tspec != PTR) { @@ -2213,8 +2143,7 @@ mrgqual(tpp, tp1, tp2) * (maybe recursively). */ static int -conmemb(tp) - type_t *tp; +conmemb(type_t *tp) { sym_t *m; tspec_t t; @@ -2234,8 +2163,7 @@ conmemb(tp) } const char * -tyname(tp) - type_t *tp; +tyname(type_t *tp) { tspec_t t; const char *s; @@ -2274,9 +2202,7 @@ tyname(tp) * Create a new node for one of the operators POINT and ARROW. */ static tnode_t * -bldstr(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +bldstr(op_t op, tnode_t *ln, tnode_t *rn) { tnode_t *ntn, *ctn; int nolval; @@ -2328,9 +2254,7 @@ bldstr(op, ln, rn) * Create a node for INCAFT, INCBEF, DECAFT and DECBEF. */ static tnode_t * -bldincdec(op, ln) - op_t op; - tnode_t *ln; +bldincdec(op_t op, tnode_t *ln) { tnode_t *cn, *ntn; @@ -2351,9 +2275,7 @@ bldincdec(op, ln) * Create a tree node for the & operator */ static tnode_t * -bldamper(tn, noign) - tnode_t *tn; - int noign; +bldamper(tnode_t *tn, int noign) { tnode_t *ntn; tspec_t t; @@ -2381,9 +2303,7 @@ bldamper(tn, noign) * Create a node for operators PLUS and MINUS. */ static tnode_t * -bldplmi(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +bldplmi(op_t op, tnode_t *ln, tnode_t *rn) { tnode_t *ntn, *ctn; type_t *tp; @@ -2436,9 +2356,7 @@ bldplmi(op, ln, rn) * Create a node for operators SHL and SHR. */ static tnode_t * -bldshft(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +bldshft(op_t op, tnode_t *ln, tnode_t *rn) { tspec_t t; tnode_t *ntn; @@ -2453,8 +2371,7 @@ bldshft(op, ln, rn) * Create a node for COLON. */ static tnode_t * -bldcol(ln, rn) - tnode_t *ln, *rn; +bldcol(tnode_t *ln, tnode_t *rn) { tspec_t lt, rt, pdt; type_t *rtp; @@ -2532,9 +2449,7 @@ bldcol(ln, rn) * Create a node for an assignment operator (both = and op= ). */ static tnode_t * -bldasgn(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +bldasgn(op_t op, tnode_t *ln, tnode_t *rn) { tspec_t lt, rt; tnode_t *ntn, *ctn; @@ -2595,8 +2510,7 @@ bldasgn(op, ln, rn) * Get length of type tp->t_subt. */ static tnode_t * -plength(tp) - type_t *tp; +plength(type_t *tp) { int elem, elsz; tspec_t st; @@ -2663,15 +2577,13 @@ plength(tp) #ifdef XXX_BROKEN_GCC static int -quad_t_eq(x, y) - quad_t x, y; +quad_t_eq(quad_t x, quad_t y) { return (x == y); } static int -u_quad_t_eq(x, y) - u_quad_t x, y; +u_quad_t_eq(u_quad_t x, u_quad_t y) { return (x == y); } @@ -2683,8 +2595,7 @@ u_quad_t_eq(x, y) * are constants. */ static tnode_t * -fold(tn) - tnode_t *tn; +fold(tnode_t *tn) { val_t *v; tspec_t t; @@ -2822,8 +2733,7 @@ fold(tn) #ifdef XXX_BROKEN_GCC int -ldbl_t_neq(x, y) - ldbl_t x, y; +ldbl_t_neq(ldbl_t x, ldbl_t y) { return (x != y); } @@ -2833,8 +2743,7 @@ ldbl_t_neq(x, y) * Same for operators whose operands are compared with 0 (test context). */ static tnode_t * -foldtst(tn) - tnode_t *tn; +foldtst(tnode_t *tn) { int l, r; val_t *v; @@ -2890,8 +2799,7 @@ foldtst(tn) * Same for operands with floating point type. */ static tnode_t * -foldflt(tn) - tnode_t *tn; +foldflt(tnode_t *tn) { val_t *v; tspec_t t; @@ -2990,8 +2898,7 @@ foldflt(tn) * Create a constant node for sizeof. */ tnode_t * -bldszof(tp) - type_t *tp; +bldszof(type_t *tp) { int elem, elsz; tspec_t st; @@ -3058,9 +2965,7 @@ bldszof(tp) * Type casts. */ tnode_t * -cast(tn, tp) - tnode_t *tn; - type_t *tp; +cast(tnode_t *tn, type_t *tp) { tspec_t nt, ot; @@ -3119,8 +3024,7 @@ cast(tn, tp) * in funcarg() we have no information about expected argument types. */ tnode_t * -funcarg(args, arg) - tnode_t *args, *arg; +funcarg(tnode_t *args, tnode_t *arg) { tnode_t *ntn; @@ -3142,8 +3046,7 @@ funcarg(args, arg) * function arguments and insert conversions, if necessary. */ tnode_t * -funccall(func, args) - tnode_t *func, *args; +funccall(tnode_t *func, tnode_t *args) { tnode_t *ntn; op_t fcop; @@ -3182,9 +3085,7 @@ funccall(func, args) * if necessary. */ static tnode_t * -chkfarg(ftp, args) - type_t *ftp; /* type of called function */ - tnode_t *args; /* arguments */ +chkfarg(type_t *ftp, tnode_t *args) { tnode_t *arg; sym_t *asym; @@ -3256,10 +3157,7 @@ chkfarg(ftp, args) * the type of the parameter. */ static tnode_t * -parg(n, tp, tn) - int n; /* pos of arg */ - type_t *tp; /* expected type (from prototype) */ - tnode_t *tn; /* argument */ +parg(int n, type_t *tp, tnode_t *tn) { tnode_t *ln; int warn; @@ -3282,8 +3180,7 @@ parg(n, tp, tn) * type, an error message is printed. */ val_t * -constant(tn) - tnode_t *tn; +constant(tnode_t *tn) { val_t *v; @@ -3335,9 +3232,7 @@ constant(tn) * for the expression. */ void -expr(tn, vctx, tctx) - tnode_t *tn; - int vctx, tctx; +expr(tnode_t *tn, int vctx, int tctx) { if (tn == NULL && nerr == 0) lerror("expr() 1"); @@ -3377,8 +3272,7 @@ expr(tn, vctx, tctx) } static void -nulleff(tn) - tnode_t *tn; +nulleff(tnode_t *tn) { if (!hflag) return; @@ -3424,9 +3318,7 @@ nulleff(tn) * only used for debugging */ static void -displexpr(tn, offs) - tnode_t *tn; - int offs; +displexpr(tnode_t *tn, int offs) { u_quad_t uq; @@ -3482,9 +3374,8 @@ displexpr(tn, offs) */ /* ARGSUSED */ void -chkmisc(tn, vctx, tctx, eqwarn, fcall, rvdisc, szof) - tnode_t *tn; - int vctx, tctx, eqwarn, fcall, rvdisc, szof; +chkmisc(tnode_t *tn, int vctx, int tctx, int eqwarn, int fcall, int rvdisc, + int szof) { tnode_t *ln, *rn; mod_t *mp; @@ -3621,9 +3512,7 @@ chkmisc(tn, vctx, tctx, eqwarn, fcall, rvdisc, szof) * after the array. */ static void -chkaidx(tn, amper) - tnode_t *tn; - int amper; +chkaidx(tnode_t *tn, int amper) { int dim; tnode_t *ln, *rn; @@ -3679,9 +3568,7 @@ chkaidx(tn, amper) * Check for ordered comparisions of unsigned values with 0. */ static void -chkcomp(op, ln, rn) - op_t op; - tnode_t *ln, *rn; +chkcomp(op_t op, tnode_t *ln, tnode_t *rn) { tspec_t lt, rt; mod_t *mp; @@ -3750,10 +3637,7 @@ chkcomp(op, ln, rn) * representation (including width). */ int -conaddr(tn, symp, offsp) - tnode_t *tn; - sym_t **symp; - ptrdiff_t *offsp; +conaddr(tnode_t *tn, sym_t **symp, ptrdiff_t *offsp) { sym_t *sym; ptrdiff_t offs1, offs2; @@ -3815,8 +3699,7 @@ conaddr(tn, symp, offsp) * Concatenate two string constants. */ strg_t * -catstrg(strg1, strg2) - strg_t *strg1, *strg2; +catstrg(strg_t *strg1, strg_t *strg2) { size_t len1, len2, len; @@ -3852,8 +3735,7 @@ catstrg(strg1, strg2) * expressions are already folded. */ static void -precconf(tn) - tnode_t *tn; +precconf(tnode_t *tn) { tnode_t *ln, *rn; op_t lop, rop; diff --git a/usr.bin/xlint/lint2/chk.c b/usr.bin/xlint/lint2/chk.c index f1a5cf6c6d..ae3030176f 100644 --- a/usr.bin/xlint/lint2/chk.c +++ b/usr.bin/xlint/lint2/chk.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: chk.c,v 1.2 1995/07/03 21:24:42 cgd Exp $ - * $DragonFly: src/usr.bin/xlint/lint2/chk.c,v 1.5 2003/11/06 19:30:04 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint2/chk.c,v 1.6 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -70,7 +70,7 @@ static int mnoarg(type_t *, int *); void -inittyp() +inittyp(void) { int i; static struct { @@ -161,7 +161,7 @@ inittyp() * If there is a symbol named "main", mark it as used. */ void -mainused() +mainused(void) { hte_t *hte; @@ -173,8 +173,7 @@ mainused() * Performs all tests for a single name */ void -chkname(hte) - hte_t *hte; +chkname(hte_t *hte) { sym_t *sym, *def, *pdecl, *decl; @@ -219,8 +218,7 @@ chkname(hte) * Print a warning if the name has been used, but not defined. */ static void -chkund(hte) - hte_t *hte; +chkund(hte_t *hte) { fcall_t *fcall; usym_t *usym; @@ -241,8 +239,7 @@ chkund(hte) * Print a warning if the name has been defined, but never used. */ static void -chkdnu(hte) - hte_t *hte; +chkdnu(hte_t *hte) { sym_t *sym; @@ -263,8 +260,7 @@ chkdnu(hte) * or defined. */ static void -chkdnud(hte) - hte_t *hte; +chkdnud(hte_t *hte) { sym_t *sym; @@ -284,8 +280,7 @@ chkdnud(hte) * this name. */ static void -chkmd(hte) - hte_t *hte; +chkmd(hte_t *hte) { sym_t *sym, *def1; char *pos1; @@ -322,9 +317,7 @@ chkmd(hte) * call as it's done for function arguments. */ static void -chkvtui(hte, def, decl) - hte_t *hte; - sym_t *def, *decl; +chkvtui(hte_t *hte, sym_t *def, sym_t *decl) { fcall_t *call; char *pos1; @@ -385,9 +378,7 @@ chkvtui(hte, def, decl) * types of return values are tested. */ static void -chkvtdi(hte, def, decl) - hte_t *hte; - sym_t *def, *decl; +chkvtdi(hte_t *hte, sym_t *def, sym_t *decl) { sym_t *sym; type_t *tp1, *tp2; @@ -426,9 +417,7 @@ chkvtdi(hte, def, decl) * of the same function. */ static void -chkfaui(hte, def, decl) - hte_t *hte; - sym_t *def, *decl; +chkfaui(hte_t *hte, sym_t *def, sym_t *decl) { type_t *tp1, *tp2, **ap1, **ap2; pos_t *pos1p; @@ -536,13 +525,8 @@ chkfaui(hte, def, decl) * */ static void -chkau(hte, n, def, decl, pos1p, call1, call, arg1, arg2) - hte_t *hte; - int n; - sym_t *def, *decl; - pos_t *pos1p; - fcall_t *call1, *call; - type_t *arg1, *arg2; +chkau(hte_t *hte, int n, sym_t *def, sym_t *decl, pos_t *pos1p, + fcall_t *call1, fcall_t *call, type_t *arg1, type_t *arg2) { /* LINTED (automatic hides external declaration: warn) */ int promote, asgn, warn; @@ -689,12 +673,7 @@ chkau(hte, n, def, decl, pos1p, call1, call, arg1, arg2) * string fmt. */ static void -printflike(hte, call, n, fmt, ap) - hte_t *hte; - fcall_t *call; - int n; - const char *fmt; - type_t **ap; +printflike(hte_t *hte, fcall_t *call, int n, const char *fmt, type_t **ap) { const char *fp; int fc; @@ -919,12 +898,7 @@ printflike(hte, call, n, fmt, ap) * string fmt. */ static void -scanflike(hte, call, n, fmt, ap) - hte_t *hte; - fcall_t *call; - int n; - const char *fmt; - type_t **ap; +scanflike(hte_t *hte, fcall_t *call, int n, const char *fmt, type_t **ap) { const char *fp; int fc; @@ -1115,37 +1089,28 @@ scanflike(hte, call, n, fmt, ap) } static void -badfmt(hte, call) - hte_t *hte; - fcall_t *call; +badfmt(hte_t *hte, fcall_t *call) { /* %s: malformed format string\t%s */ msg(13, hte->h_name, mkpos(&call->f_pos)); } static void -inconarg(hte, call, n) - hte_t *hte; - fcall_t *call; - int n; +inconarg(hte_t *hte, fcall_t *call, int n) { /* %s, arg %d inconsistent with format\t%s(%d) */ msg(14, hte->h_name, n, mkpos(&call->f_pos)); } static void -tofewarg(hte, call) - hte_t *hte; - fcall_t *call; +tofewarg(hte_t *hte, fcall_t *call) { /* %s: too few args for format \t%s */ msg(15, hte->h_name, mkpos(&call->f_pos)); } static void -tomanyarg(hte, call) - hte_t *hte; - fcall_t *call; +tomanyarg(hte_t *hte, fcall_t *call) { /* %s: too many args for format \t%s */ msg(16, hte->h_name, mkpos(&call->f_pos)); @@ -1157,9 +1122,7 @@ tomanyarg(hte, call) * or return values which are always or sometimes ignored. */ static void -chkrvu(hte, def) - hte_t *hte; - sym_t *def; +chkrvu(hte_t *hte, sym_t *def) { fcall_t *call; int used, ignored; @@ -1207,9 +1170,7 @@ chkrvu(hte, def) * Print warnings for inconsistent argument declarations. */ static void -chkadecl(hte, def, decl) - hte_t *hte; - sym_t *def, *decl; +chkadecl(hte_t *hte, sym_t *def, sym_t *decl) { /* LINTED (automatic hides external declaration: warn) */ int osdef, eq, warn, n; @@ -1289,9 +1250,7 @@ chkadecl(hte, def, decl) * an incompatible prototype declaration */ static int -eqtype(tp1, tp2, ignqual, promot, asgn, warn) - type_t *tp1, *tp2; - int ignqual, promot, asgn, *warn; +eqtype(type_t *tp1, type_t *tp2, int ignqual, int promot, int asgn, int *warn) { tspec_t t, to; int indir; @@ -1403,9 +1362,7 @@ eqtype(tp1, tp2, ignqual, promot, asgn, warn) * Compares arguments of two prototypes */ static int -eqargs(tp1, tp2, warn) - type_t *tp1, *tp2; - int *warn; +eqargs(type_t *tp1, type_t *tp2, int *warn) { type_t **a1, **a2; @@ -1439,9 +1396,7 @@ eqargs(tp1, tp2, warn) * is applied on it */ static int -mnoarg(tp, warn) - type_t *tp; - int *warn; +mnoarg(type_t *tp, int *warn) { type_t **arg; tspec_t t; diff --git a/usr.bin/xlint/lint2/emit2.c b/usr.bin/xlint/lint2/emit2.c index 349a1d4db6..151f8fd70b 100644 --- a/usr.bin/xlint/lint2/emit2.c +++ b/usr.bin/xlint/lint2/emit2.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: emit2.c,v 1.2 1995/07/03 21:24:44 cgd Exp $ - * $DragonFly: src/usr.bin/xlint/lint2/emit2.c,v 1.4 2003/11/03 19:31:34 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint2/emit2.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -46,8 +46,7 @@ static void dumpname(hte_t *); * Write type into the output buffer. */ static void -outtype(tp) - type_t *tp; +outtype(type_t *tp) { int t, s, na; tspec_t ts; @@ -127,9 +126,7 @@ outtype(tp) * Write a definition. */ static void -outdef(hte, sym) - hte_t *hte; - sym_t *sym; +outdef(hte_t *hte, sym_t *sym) { /* reset output buffer */ outclr(); @@ -179,8 +176,7 @@ outdef(hte, sym) * Write the first definition of a name into the lint library. */ static void -dumpname(hte) - hte_t *hte; +dumpname(hte_t *hte) { sym_t *sym, *def; @@ -212,8 +208,7 @@ dumpname(hte) * Write a new lint library. */ void -outlib(name) - const char *name; +outlib(const char *name) { /* Open of output file and initialisation of the output buffer */ outopen(name); diff --git a/usr.bin/xlint/lint2/hash.c b/usr.bin/xlint/lint2/hash.c index 8281a20ad6..d0e2b1124d 100644 --- a/usr.bin/xlint/lint2/hash.c +++ b/usr.bin/xlint/lint2/hash.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: hash.c,v 1.2 1995/07/03 21:24:47 cgd Exp $ - * $DragonFly: src/usr.bin/xlint/lint2/hash.c,v 1.4 2003/11/03 19:31:34 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint2/hash.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -49,7 +49,7 @@ static int hash(const char *); * Initialize hash table. */ void -inithash() +inithash(void) { htab = xcalloc(HSHSIZ2, sizeof (hte_t *)); } @@ -58,8 +58,7 @@ inithash() * Compute hash value from a string. */ static int -hash(s) - const char *s; +hash(const char *s) { u_int v; const u_char *us; @@ -77,9 +76,7 @@ hash(s) * given name exists and mknew is set, create a new one. */ hte_t * -hsearch(s, mknew) - const char *s; - int mknew; +hsearch(const char *s, int mknew) { int h; hte_t *hte; @@ -109,8 +106,7 @@ hsearch(s, mknew) * Call function f for each name in the hash table. */ void -forall(f) - void (*f)(hte_t *); +forall(void (*f)(hte_t *)) { int i; hte_t *hte; diff --git a/usr.bin/xlint/lint2/main2.c b/usr.bin/xlint/lint2/main2.c index 4b526df191..4ce3d8945d 100644 --- a/usr.bin/xlint/lint2/main2.c +++ b/usr.bin/xlint/lint2/main2.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: main2.c,v 1.2 1995/07/03 21:24:53 cgd Exp $ - * $DragonFly: src/usr.bin/xlint/lint2/main2.c,v 1.4 2003/11/03 19:31:34 eirikn Exp $ + * $DragonFly: src/usr.bin/xlint/lint2/main2.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -86,9 +86,7 @@ static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c, i; size_t len; @@ -180,7 +178,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: lint2 -hpstxuHF -Clib -l lib ... src1 ...\n"); diff --git a/usr.bin/xlint/lint2/mem2.c b/usr.bin/xlint/lint2/mem2.c index c125317bba..09592248df 100644 --- a/usr.bin/xlint/lint2/mem2.c +++ b/usr.bin/xlint/lint2/mem2.c @@ -30,7 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: mem2.c,v 1.3 1995/10/02 17:27:11 jpo Exp $ + * $DragonFly: src/usr.bin/xlint/lint2/mem2.c,v 1.3 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -52,7 +52,7 @@ static size_t nxtfree; static void *mbuf; void -initmem() +initmem(void) { int pgsz; @@ -68,8 +68,7 @@ initmem() * need never to be freed. */ void * -xalloc(sz) - size_t sz; +xalloc(size_t sz) { void *ptr; int prot, flags; diff --git a/usr.bin/xlint/lint2/msg.c b/usr.bin/xlint/lint2/msg.c index d2857d3f95..eb6df5e271 100644 --- a/usr.bin/xlint/lint2/msg.c +++ b/usr.bin/xlint/lint2/msg.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: msg.c,v 1.2 1995/07/03 21:24:56 cgd Exp $ - * $DragonFly: src/usr.bin/xlint/lint2/msg.c,v 1.5 2004/07/07 08:20:19 asmodai Exp $ + * $DragonFly: src/usr.bin/xlint/lint2/msg.c,v 1.6 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -82,8 +82,7 @@ msg(int n, ...) * Return a pointer to the last component of a path. */ static const char * -basename(path) - const char *path; +basename(const char *path) { const char *cp, *cp1, *cp2; @@ -104,8 +103,7 @@ basename(path) * Create a string which describes a position in a source file. */ const char * -mkpos(posp) - pos_t *posp; +mkpos(pos_t *posp) { size_t len; const char *fn; diff --git a/usr.bin/xlint/lint2/read.c b/usr.bin/xlint/lint2/read.c index 6e7d4534d5..591b6f9db9 100644 --- a/usr.bin/xlint/lint2/read.c +++ b/usr.bin/xlint/lint2/read.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: read.c,v 1.2 1995/07/03 21:24:59 cgd Exp $ - * $DragonFly: src/usr.bin/xlint/lint2/read.c,v 1.6 2004/07/07 08:20:19 asmodai Exp $ + * $DragonFly: src/usr.bin/xlint/lint2/read.c,v 1.7 2004/07/07 12:13:26 asmodai Exp $ */ #include @@ -97,8 +97,7 @@ static const char *inpname(const char *, const char **); static int getfnidx(const char *); void -readfile(name) - const char *name; +readfile(const char *name) { FILE *inp; size_t len; @@ -200,7 +199,7 @@ readfile(name) static void -inperr() +inperr(void) { errx(1, "input file error: %s", fnames[srcfile]); } @@ -210,8 +209,7 @@ inperr() * currently read. */ static void -setsrc(cp) - const char *cp; +setsrc(const char *cp) { csrcfile = getfnidx(cp); } @@ -223,9 +221,7 @@ setsrc(cp) * as used in the input file to the index used in lint2. */ static void -setfnid(fid, cp) - int fid; - const char *cp; +setfnid(int fid, const char *cp) { if (fid == -1) inperr(); @@ -248,9 +244,7 @@ setfnid(fid, cp) * Process a function call record (c-record). */ static void -funccall(posp, cp) - pos_t *posp; - const char *cp; +funccall(pos_t *posp, const char *cp) { arginf_t *ai, **lai; char c, *eptr; @@ -326,9 +320,7 @@ funccall(posp, cp) * Process a declaration or definition (d-record). */ static void -decldef(posp, cp) - pos_t *posp; - const char *cp; +decldef(pos_t *posp, const char *cp) { sym_t *symp, sym; char c, *ep; @@ -458,9 +450,7 @@ decldef(posp, cp) * Read an u-record (emited by lint1 if a symbol was used). */ static void -usedsym(posp, cp) - pos_t *posp; - const char *cp; +usedsym(pos_t *posp, const char *cp) { usym_t *usym; hte_t *hte; @@ -483,8 +473,7 @@ usedsym(posp, cp) * Read a type and return the index of this type. */ static u_short -inptype(cp, epp) - const char *cp, **epp; +inptype(const char *cp, const char **epp) { char c, s, *eptr; const char *ep; @@ -624,8 +613,7 @@ inptype(cp, epp) * Get the length of a type string. */ static int -gettlen(cp, epp) - const char *cp, **epp; +gettlen(const char *cp, const char **epp) { const char *cp1; char c, s, *eptr; @@ -795,10 +783,7 @@ gettlen(cp, epp) * Search a type by it's type string. */ static u_short -findtype(cp, len, h) - const char *cp; - size_t len; - int h; +findtype(const char *cp, size_t len, int h) { thtab_t *thte; @@ -817,11 +802,7 @@ findtype(cp, len, h) * if we read the same type string from the input file. */ static u_short -storetyp(tp, cp, len, h) - type_t *tp; - const char *cp; - size_t len; - int h; +storetyp(type_t *tp, const char *cp, size_t len, int h) { /* 0 ist reserved */ static u_int tidx = 1; @@ -857,9 +838,7 @@ storetyp(tp, cp, len, h) * Hash function for types */ static int -thash(s, len) - const char *s; - size_t len; +thash(const char *s, size_t len) { u_int v; @@ -875,8 +854,7 @@ thash(s, len) * Read a string enclosed by "". This string may contain quoted chars. */ static char * -inpqstrg(src, epp) - const char *src, **epp; +inpqstrg(const char *src, const char **epp) { char *strg, *dst; size_t slen; @@ -959,8 +937,7 @@ inpqstrg(src, epp) * Read the name of a symbol in static memory. */ static const char * -inpname(cp, epp) - const char *cp, **epp; +inpname(const char *cp, const char **epp) { static char *buf; static size_t blen = 0; @@ -990,8 +967,7 @@ inpname(cp, epp) * a new entry and return the index of the newly created entry. */ static int -getfnidx(fn) - const char *fn; +getfnidx(const char *fn) { int i; @@ -1017,8 +993,7 @@ getfnidx(fn) * Separate symbols with static and external linkage. */ void -mkstatic(hte) - hte_t *hte; +mkstatic(hte_t *hte) { sym_t *sym1, **symp, *sym; fcall_t **callp, *call; diff --git a/usr.bin/xlint/xlint/xlint.c b/usr.bin/xlint/xlint/xlint.c index 668d8f02ad..217e0204f7 100644 --- a/usr.bin/xlint/xlint/xlint.c +++ b/usr.bin/xlint/xlint/xlint.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.bin/xlint/xlint/xlint.c,v 1.8 2000/01/14 09:25:31 sheldonh Exp $ - * $DragonFly: src/usr.bin/xlint/xlint/xlint.c,v 1.7 2004/07/07 07:37:04 asmodai Exp $ + * $DragonFly: src/usr.bin/xlint/xlint/xlint.c,v 1.8 2004/07/07 12:13:27 asmodai Exp $ */ #include @@ -131,8 +131,7 @@ static void cat(char *const *, const char *); * Take care that we get no surprises in case of asyncron signals. */ static void -appstrg(lstp, s) - char ***lstp, *s; +appstrg(char ***lstp, char *s) { char **lst, **olst; int i; @@ -147,17 +146,13 @@ appstrg(lstp, s) } static void -appcstrg(lstp, s) - char ***lstp; - const char *s; +appcstrg(char ***lstp, const char *s) { appstrg(lstp, xstrdup(s)); } static void -applst(destp, src) - char ***destp; - char *const *src; +applst(char ***destp, char *const *src) { int i, k; char **dest, **odest; @@ -175,8 +170,7 @@ applst(destp, src) } static void -freelst(lstp) - char ***lstp; +freelst(char ***lstp) { char *s; int i; @@ -190,8 +184,7 @@ freelst(lstp) } static char * -concat2(s1, s2) - const char *s1, *s2; +concat2(const char *s1, const char *s2) { char *s; @@ -203,8 +196,7 @@ concat2(s1, s2) } static char * -concat3(s1, s2, s3) - const char *s1, *s2, *s3; +concat3(const char *s1, const char *s2, const char *s3) { char *s; @@ -220,8 +212,7 @@ concat3(s1, s2, s3) * Clean up after a signal. */ static void -terminate(signo) - int signo; +terminate(int signo) { int i; @@ -247,9 +238,7 @@ terminate(signo) * Returns strg if the string does not contain delim. */ static const char * -basename(strg, delim) - const char *strg; - int delim; +basename(const char *strg, int delim) { const char *cp, *cp1, *cp2; @@ -264,16 +253,14 @@ basename(strg, delim) } static void -appdef(lstp, def) - char ***lstp; - const char *def; +appdef(char ***lstp, const char *def) { appstrg(lstp, concat2("-D__", def)); appstrg(lstp, concat3("-D__", def, "__")); } static void -usage() +usage(void) { (void)printf("lint [-abceghprvxzHFS] [-s|-t] [-i|-nu] [-Dname[=def]] [-Uname]\n"); (void)printf(" [-Idirectory] [-Ldirectory] [-llibrary] [-ooutputfile] file ...\n"); @@ -284,9 +271,7 @@ usage() } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c; char flgbuf[3], *tmp, *s; @@ -529,9 +514,7 @@ main(argc, argv) * and pass it through lint1 if it is a C source. */ static void -fname(name, last) - const char *name; - int last; +fname(const char *name, int last) { const char *bn, *suff; char **args, *ofn, *path; @@ -615,9 +598,7 @@ fname(name, last) } static void -runchild(path, args, crfn) - const char *path, *crfn; - char *const *args; +runchild(const char *path, char *const *args, const char *crfn) { int status, rv, signo, i; @@ -663,8 +644,7 @@ runchild(path, args, crfn) } static void -findlibs(liblst) - char *const *liblst; +findlibs(char *const *liblst) { int i, k; const char *lib, *path; @@ -696,8 +676,7 @@ findlibs(liblst) } static int -rdok(path) - const char *path; +rdok(const char *path) { struct stat sbuf; @@ -711,7 +690,7 @@ rdok(path) } static void -lint2() +lint2(void) { char *path, **args; @@ -732,9 +711,7 @@ lint2() } static void -cat(srcs, dest) - char *const *srcs; - const char *dest; +cat(char *const *srcs, const char *dest) { int ifd, ofd, i; char *src, *buf; -- 2.41.0