diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-11-19 03:35:28 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-11-19 03:35:28 +0000 |
commit | 7e8cc4e9f085384c58adfef607bed4a9aae7ef31 (patch) | |
tree | d812af6ffe07b730540fadeb9762aa169e7d74e6 /usr.bin/xlint/lint1 | |
parent | 4e00bfe9e4fce563a74dcd487149539b6bc02ba9 (diff) |
knf. OK kjell, brad
Diffstat (limited to 'usr.bin/xlint/lint1')
-rw-r--r-- | usr.bin/xlint/lint1/decl.c | 225 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/emit.c | 31 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/emit1.c | 35 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/err.c | 15 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/func.c | 96 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/init.c | 28 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/main1.c | 12 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/mem.c | 19 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/mem1.c | 53 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/tree.c | 251 |
10 files changed, 246 insertions, 519 deletions
diff --git a/usr.bin/xlint/lint1/decl.c b/usr.bin/xlint/lint1/decl.c index ad43b68b55d..3965f62a3f1 100644 --- a/usr.bin/xlint/lint1/decl.c +++ b/usr.bin/xlint/lint1/decl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: decl.c,v 1.11 2005/08/14 11:02:33 miod Exp $ */ +/* $OpenBSD: decl.c,v 1.12 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: decl.c,v 1.11 1995/10/02 17:34:16 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: decl.c,v 1.11 2005/08/14 11:02:33 miod Exp $"; +static char rcsid[] = "$OpenBSD: decl.c,v 1.12 2005/11/19 03:35:27 cloder Exp $"; #endif #include <sys/param.h> @@ -84,7 +84,7 @@ static void glchksz(sym_t *); * initializes all global vars used in declarations */ void -initdecl() +initdecl(void) { int i; static struct { @@ -209,15 +209,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; @@ -231,8 +229,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; @@ -246,8 +243,7 @@ tduptyp(tp) * struct, union or enum type. */ int -incompl(tp) - type_t *tp; +incompl(type_t *tp) { tspec_t t; @@ -268,9 +264,7 @@ incompl(tp) * types. */ void -setcompl(tp, ic) - type_t *tp; - int ic; +setcompl(type_t *tp, int ic) { tspec_t t; @@ -291,8 +285,7 @@ setcompl(tp, ic) * storage classes. */ void -addscl(sc) - scl_t sc; +addscl(scl_t sc) { if (sc == INLINE) { if (dcs->d_inline) @@ -328,8 +321,7 @@ addscl(sc) * struct/union/enum tag. */ void -addtype(tp) - type_t *tp; +addtype(type_t *tp) { tspec_t t; @@ -426,9 +418,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; @@ -1138,8 +1117,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; @@ -1160,9 +1138,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)); @@ -1186,8 +1162,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; @@ -1225,9 +1200,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; @@ -1254,9 +1227,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; @@ -1285,8 +1256,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; @@ -1334,8 +1304,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; @@ -1373,8 +1342,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 @@ -1403,9 +1371,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) { @@ -1425,8 +1391,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 = NOSCL; @@ -1524,8 +1489,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) { @@ -1553,10 +1517,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 = NOSCL; type_t *tp; @@ -1624,10 +1585,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) { @@ -1679,8 +1637,7 @@ newtag(tag, scl, decl, semi) } const char * -scltoa(sc) - scl_t sc; +scltoa(scl_t sc) { const char *s; @@ -1703,9 +1660,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; @@ -1750,9 +1705,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) { @@ -1794,9 +1747,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; @@ -1915,8 +1866,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; @@ -1930,9 +1880,7 @@ cpuinfo(sym, rdsym) * a warning. */ int -isredec(dsym, warn) - sym_t *dsym; - int *warn; +isredec(sym_t *dsym, int *warn) { sym_t *rsym; @@ -2011,9 +1959,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; @@ -2079,9 +2025,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; @@ -2115,9 +2059,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; @@ -2142,8 +2084,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; @@ -2204,8 +2145,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; @@ -2239,9 +2179,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; @@ -2305,7 +2243,7 @@ decl1arg(sym, initflg) * prototype. */ void -cluparg() +cluparg(void) { sym_t *args, *arg, *pargs, *parg; int narg, nparg, n, msg; @@ -2430,8 +2368,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; @@ -2464,9 +2401,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) { @@ -2606,8 +2541,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; @@ -2662,8 +2596,7 @@ ledecl(dsym) * detected. */ static int -chkinit(sym) - sym_t *sym; +chkinit(sym_t *sym) { int err; @@ -2694,7 +2627,7 @@ chkinit(sym) * Create a symbole for an abstract declaration. */ sym_t * -aname() +aname(void) { sym_t *sym; @@ -2722,7 +2655,7 @@ aname() * Removes anything which has nothing to do on global level. */ void -globclup() +globclup(void) { while (dcs->d_nxt != NULL) popdecl(); @@ -2742,8 +2675,7 @@ globclup() * Process an abstract type declaration */ sym_t * -decl1abs(sym) - sym_t *sym; +decl1abs(sym_t *sym) { chkfdef(sym, 1); chktyp(sym); @@ -2754,8 +2686,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 @@ -2783,8 +2714,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; @@ -2796,9 +2726,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; @@ -2820,8 +2748,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; @@ -2841,9 +2768,7 @@ chkusage(di) * only set. */ void -chkusg1(novar, sym) - int novar; - sym_t *sym; +chkusg1(int novar, sym_t *sym) { pos_t cpos; @@ -2868,9 +2793,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"); @@ -2886,9 +2809,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; @@ -2955,8 +2876,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"); @@ -2973,8 +2893,7 @@ chklusg(lab) } static void -chktusg(sym) - sym_t *sym; +chktusg(sym_t *sym) { if (!incompl(sym->s_type)) return; @@ -3011,7 +2930,7 @@ chktusg(sym) * - static symbols which are never used */ void -chkglsyms() +chkglsyms(void) { sym_t *sym; pos_t cpos; @@ -3038,8 +2957,7 @@ chkglsyms() } static void -chkglvar(sym) - sym_t *sym; +chkglvar(sym_t *sym) { if (sym->s_scl == TYPEDEF || sym->s_scl == ENUMCON) return; @@ -3085,8 +3003,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) @@ -3112,9 +3029,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 400a329c4df..3c0de578544 100644 --- a/usr.bin/xlint/lint1/emit.c +++ b/usr.bin/xlint/lint1/emit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emit.c,v 1.6 2004/11/29 06:20:03 jsg Exp $ */ +/* $OpenBSD: emit.c,v 1.7 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: emit.c,v 1.2 1995/07/03 21:24:00 cgd Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: emit.c,v 1.6 2004/11/29 06:20:03 jsg Exp $"; +static char rcsid[] = "$OpenBSD: emit.c,v 1.7 2005/11/19 03:35:27 cloder Exp $"; #endif #include <stdio.h> @@ -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) < 12) outxbuf(); @@ -213,8 +208,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"); @@ -226,8 +220,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 9f8f865bb8d..12e3907dc29 100644 --- a/usr.bin/xlint/lint1/emit1.c +++ b/usr.bin/xlint/lint1/emit1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emit1.c,v 1.4 2005/01/24 00:25:15 millert Exp $ */ +/* $OpenBSD: emit1.c,v 1.5 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: emit1.c,v 1.4 2005/01/24 00:25:15 millert Exp $"; +static char rcsid[] = "$OpenBSD: emit1.c,v 1.5 2005/11/19 03:35:27 cloder Exp $"; #endif #include <ctype.h> @@ -83,8 +83,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; @@ -154,8 +153,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; @@ -185,8 +183,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); @@ -207,10 +204,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 @@ -278,10 +272,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; @@ -377,9 +368,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; @@ -465,11 +454,10 @@ outcall(tn, rvused, rvdisc) /* * extracts potential format specifiers for printf() and scanf() and - * writes them, enclosed in "" and qouted if necessary, to the output buffer + * writes them, enclosed in "" and quoted if necessary, to the output buffer */ static void -outfstrg(strg) - strg_t *strg; +outfstrg(strg_t *strg) { int c, oc, first; u_char *cp; @@ -568,8 +556,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 c071db931f6..666a3f83bdb 100644 --- a/usr.bin/xlint/lint1/err.c +++ b/usr.bin/xlint/lint1/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.5 2002/02/19 19:39:39 millert Exp $ */ +/* $OpenBSD: err.c,v 1.6 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: err.c,v 1.8 1995/10/02 17:37:00 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: err.c,v 1.5 2002/02/19 19:39:39 millert Exp $"; +static char rcsid[] = "$OpenBSD: err.c,v 1.6 2005/11/19 03:35:27 cloder Exp $"; #endif /* number of errors found */ @@ -370,8 +370,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; @@ -389,9 +388,7 @@ basename(path) } static void -verror(n, ap) - int n; - va_list ap; +verror(int n, va_list ap) { const char *fn; @@ -403,9 +400,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 65eabd402f9..86ecb782a5b 100644 --- a/usr.bin/xlint/lint1/func.c +++ b/usr.bin/xlint/lint1/func.c @@ -1,4 +1,4 @@ -/* $OpenBSD: func.c,v 1.5 2004/05/10 15:26:22 deraadt Exp $ */ +/* $OpenBSD: func.c,v 1.6 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: func.c,v 1.7 1995/10/02 17:31:40 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: func.c,v 1.5 2004/05/10 15:26:22 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: func.c,v 1.6 2005/11/19 03:35:27 cloder Exp $"; #endif #include <stdlib.h> @@ -139,8 +139,7 @@ int quadflg = 1; * 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; @@ -154,8 +153,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; @@ -180,7 +178,7 @@ popctrl(env) * Prints a warning if a statement cannot be reached. */ void -chkreach() +chkreach(void) { if (!reached && !rchflg) { /* statement not reached */ @@ -200,8 +198,7 @@ chkreach() * redeclaration etc.. */ void -funcdef(fsym) - sym_t *fsym; +funcdef(sym_t *fsym) { int n, warn; sym_t *arg, *sym, *rdsym; @@ -333,7 +330,7 @@ funcdef(fsym) * Called at the end of a function definition. */ void -funcend() +funcend(void) { sym_t *arg; int n; @@ -399,10 +396,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; @@ -520,8 +514,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); @@ -536,7 +529,7 @@ if1(tn) * if_without_else T_ELSE */ void -if2() +if2(void) { cstk->c_rchif = reached ? 1 : 0; reached = 1; @@ -547,8 +540,7 @@ if2() * if_without_else T_ELSE stmnt */ void -if3(els) - int els; +if3(int els) { if (els) { reached |= cstk->c_rchif; @@ -562,8 +554,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; @@ -614,7 +605,7 @@ switch1(tn) * switch_expr stmnt */ void -switch2() +switch2(void) { int nenum, nclab; sym_t *esym; @@ -669,8 +660,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 */ @@ -706,7 +696,7 @@ while1(tn) * while_expr error */ void -while2() +while2(void) { /* * The end of the loop can be reached if it is no endless loop @@ -722,7 +712,7 @@ while2() * T_DO */ void -do1() +do1(void) { if (!reached) { /* loop not entered at top */ @@ -739,8 +729,7 @@ do1() * do error */ void -do2(tn) - tnode_t *tn; +do2(tnode_t *tn) { /* * If there was a continue statement the expression controlling the @@ -783,8 +772,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 @@ -844,7 +832,7 @@ for1(tn1, tn2, tn3) * for_exprs error */ void -for2() +for2(void) { pos_t cpos, cspos; tnode_t *tn3; @@ -889,8 +877,7 @@ for2() * T_GOTO error T_SEMI */ void -dogoto(lab) - sym_t *lab; +dogoto(sym_t *lab) { setuflg(lab, 0, 0); @@ -903,7 +890,7 @@ dogoto(lab) * T_BREAK T_SEMI */ void -dobreak() +dobreak(void) { cstk_t *ci; @@ -929,7 +916,7 @@ dobreak() * T_CONTINUE T_SEMI */ void -docont() +docont(void) { cstk_t *ci; @@ -952,8 +939,7 @@ docont() * T_RETURN expr T_SEMI */ void -doreturn(tn) - tnode_t *tn; +doreturn(tnode_t *tn) { tnode_t *ln, *rn; cstk_t *ci; @@ -1021,8 +1007,7 @@ doreturn(tn) * Especially remove informations about unused lint comments. */ void -glclup(silent) - int silent; +glclup(int silent) { pos_t cpos; @@ -1073,8 +1058,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; @@ -1099,8 +1083,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; @@ -1125,8 +1108,7 @@ varargs(n) * used the check the types of remaining arguments. */ void -printflike(n) - int n; +printflike(int n) { if (n == -1) n = 0; @@ -1151,8 +1133,7 @@ printflike(n) * used the check the types of remaining arguments. */ void -scanflike(n) - int n; +scanflike(int n) { if (n == -1) n = 0; @@ -1176,8 +1157,7 @@ scanflike(n) */ /* ARGSUSED */ void -constcond(n) - int n; +constcond(int n) { ccflg = 1; } @@ -1188,8 +1168,7 @@ constcond(n) */ /* ARGSUSED */ void -fallthru(n) - int n; +fallthru(int n) { ftflg = 1; } @@ -1200,8 +1179,7 @@ fallthru(n) */ /* ARGSUSED */ void -notreach(n) - int n; +notreach(int n) { reached = 0; rchflg = 1; @@ -1209,8 +1187,7 @@ notreach(n) /* ARGSUSED */ void -lintlib(n) - int n; +lintlib(int n) { if (dcs->d_ctx != EXTERN) { /* must be outside function: ** %s ** */ @@ -1226,8 +1203,7 @@ lintlib(n) */ /* ARGSUSED */ void -linted(n) - int n; +linted(int n) { nowarn = 1; } @@ -1238,8 +1214,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 ** */ @@ -1255,8 +1230,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 f0a0d86a889..1ec11a5e48b 100644 --- a/usr.bin/xlint/lint1/init.c +++ b/usr.bin/xlint/lint1/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.4 2002/02/16 21:27:59 millert Exp $ */ +/* $OpenBSD: init.c,v 1.5 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: init.c,v 1.4 2002/02/16 21:27:59 millert Exp $"; +static char rcsid[] = "$OpenBSD: init.c,v 1.5 2005/11/19 03:35:27 cloder Exp $"; #endif #include <stdlib.h> @@ -67,7 +67,7 @@ static int strginit(tnode_t *); * which is to be initialized on it. */ void -prepinit() +prepinit(void) { istk_t *istk; @@ -94,7 +94,7 @@ prepinit() } static void -popi2() +popi2(void) { istk_t *istk; sym_t *m; @@ -125,8 +125,7 @@ popi2() } static void -popinit(brace) - int brace; +popinit(int brace) { if (brace) { /* @@ -151,7 +150,7 @@ popinit(brace) } static void -pushinit() +pushinit(void) { istk_t *istk; int cnt; @@ -236,7 +235,7 @@ pushinit() } static void -testinit() +testinit(void) { istk_t *istk; @@ -267,8 +266,7 @@ testinit() } static void -nextinit(brace) - int brace; +nextinit(int brace) { if (!brace) { if (initstk->i_type == NULL && @@ -304,7 +302,7 @@ nextinit(brace) } void -initlbr() +initlbr(void) { if (initerr) return; @@ -326,7 +324,7 @@ initlbr() } void -initrbr() +initrbr(void) { if (initerr) return; @@ -335,8 +333,7 @@ initrbr() } void -mkinit(tn) - tnode_t *tn; +mkinit(tnode_t *tn) { ptrdiff_t offs; sym_t *sym; @@ -447,8 +444,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 1e00c57e7b7..458e2d22947 100644 --- a/usr.bin/xlint/lint1/main1.c +++ b/usr.bin/xlint/lint1/main1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main1.c,v 1.3 2002/02/16 21:27:59 millert Exp $ */ +/* $OpenBSD: main1.c,v 1.4 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: main1.c,v 1.3 1995/10/02 17:29:56 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: main1.c,v 1.3 2002/02/16 21:27:59 millert Exp $"; +static char rcsid[] = "$OpenBSD: main1.c,v 1.4 2005/11/19 03:35:27 cloder Exp $"; #endif #include <stdio.h> @@ -108,9 +108,7 @@ int zflag = 1; static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c; @@ -169,14 +167,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 aff067f8f49..e91772d85d7 100644 --- a/usr.bin/xlint/lint1/mem.c +++ b/usr.bin/xlint/lint1/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.2 1996/06/26 05:44:16 deraadt Exp $ */ +/* $OpenBSD: mem.c,v 1.3 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: mem.c,v 1.2 1995/07/03 21:24:24 cgd Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: mem.c,v 1.2 1996/06/26 05:44:16 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mem.c,v 1.3 2005/11/19 03:35:27 cloder Exp $"; #endif #include <stdlib.h> @@ -43,8 +43,7 @@ static char rcsid[] = "$OpenBSD: mem.c,v 1.2 1996/06/26 05:44:16 deraadt Exp $"; #include "lint.h" void * -xmalloc(s) - size_t s; +xmalloc(size_t s) { void *p; @@ -54,8 +53,7 @@ xmalloc(s) } void * -xcalloc(n, s) - size_t n, s; +xcalloc(size_t n, size_t s) { void *p; @@ -65,9 +63,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(); @@ -75,8 +71,7 @@ xrealloc(p, s) } char * -xstrdup(s) - const char *s; +xstrdup(const char *s) { char *s2; @@ -86,7 +81,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 ead2d875036..71942f707b7 100644 --- a/usr.bin/xlint/lint1/mem1.c +++ b/usr.bin/xlint/lint1/mem1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem1.c,v 1.5 2003/08/06 21:08:08 millert Exp $ */ +/* $OpenBSD: mem1.c,v 1.6 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: mem1.c,v 1.2 1995/07/03 21:24:25 cgd Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: mem1.c,v 1.5 2003/08/06 21:08:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: mem1.c,v 1.6 2005/11/19 03:35:27 cloder Exp $"; #endif #include <sys/types.h> @@ -64,9 +64,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; @@ -81,16 +79,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; @@ -122,8 +117,7 @@ fnnalloc(s, len) * Get id of a filename. */ int -getfnid(s) - const char *s; +getfnid(const char *s) { fn_t *fn; @@ -169,7 +163,7 @@ static void xfreeblk(mbl_t **); static mbl_t *xnewblk(void); static mbl_t * -xnewblk() +xnewblk(void) { mbl_t *mb; int prot, flags; @@ -200,9 +194,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; @@ -231,8 +223,7 @@ xgetblk(mbp, s) * used memory to zero. */ static void -xfreeblk(fmbp) - mbl_t **fmbp; +xfreeblk(mbl_t **fmbp) { mbl_t *mb; @@ -245,7 +236,7 @@ xfreeblk(fmbp) } void -initmem() +initmem(void) { int pgsz; @@ -260,9 +251,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 *)); @@ -273,8 +262,7 @@ getlblk(l, s) } void * -getblk(s) - size_t s; +getblk(size_t s) { return (getlblk(mblklev, s)); } @@ -283,14 +271,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); } @@ -302,8 +289,7 @@ freeblk() static mbl_t *tmblk; void * -tgetblk(s) - size_t s; +tgetblk(size_t s) { return (xgetblk(&tmblk, s)); } @@ -312,7 +298,7 @@ tgetblk(s) * Get memory for a new tree node. */ tnode_t * -getnode() +getnode(void) { return (tgetblk(sizeof (tnode_t))); } @@ -321,7 +307,7 @@ getnode() * Free all memory which is allocated by the the current expression. */ void -tfreeblk() +tfreeblk(void) { xfreeblk(&tmblk); } @@ -332,7 +318,7 @@ tfreeblk() * used to restore the memory. */ mbl_t * -tsave() +tsave(void) { mbl_t *tmem; @@ -347,8 +333,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 8bb030584c9..0ff5c7d992e 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.7 2005/01/24 00:12:28 millert Exp $ */ +/* $OpenBSD: tree.c,v 1.8 2005/11/19 03:35:27 cloder Exp $ */ /* $NetBSD: tree.c,v 1.12 1995/10/02 17:37:57 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: tree.c,v 1.7 2005/01/24 00:12:28 millert Exp $"; +static char rcsid[] = "$OpenBSD: tree.c,v 1.8 2005/11/19 03:35:27 cloder Exp $"; #endif #include <stdlib.h> @@ -87,7 +87,7 @@ static void precconf(tnode_t *); * Initialize mods of operators. */ void -initmtab() +initmtab(void) { static struct { op_t op; @@ -218,9 +218,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; @@ -234,9 +232,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; @@ -250,9 +246,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; @@ -271,9 +265,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; @@ -291,9 +283,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; @@ -339,8 +329,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; @@ -378,10 +367,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; @@ -538,9 +524,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; @@ -718,8 +702,7 @@ build(op, ln, rn) * Lvalues are converted to rvalues. */ tnode_t * -cconv(tn) - tnode_t *tn; +cconv(tnode_t *tn) { type_t *tp; @@ -763,10 +746,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 = NOTSPEC, lst = NOTSPEC, rst = NOTSPEC, @@ -1150,9 +1130,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; @@ -1190,10 +1168,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 = NOTSPEC, rst = NOTSPEC; type_t *ltp, *rtp, *lstp, *rstp; @@ -1331,9 +1306,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; @@ -1366,10 +1339,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; @@ -1408,10 +1378,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; @@ -1450,10 +1417,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; @@ -1486,10 +1450,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; @@ -1564,9 +1525,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; @@ -1641,11 +1600,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 = NOTSPEC; @@ -1694,11 +1649,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; @@ -1750,12 +1701,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; @@ -1794,11 +1740,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; @@ -1823,10 +1765,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; @@ -1883,11 +1822,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 = 0, min = 0; @@ -2116,9 +2051,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; @@ -2150,9 +2083,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; @@ -2186,8 +2117,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) { @@ -2214,8 +2144,7 @@ mrgqual(tpp, tp1, tp2) * (maybe recursively). */ static int -conmemb(tp) - type_t *tp; +conmemb(type_t *tp) { sym_t *m; tspec_t t; @@ -2235,8 +2164,7 @@ conmemb(tp) } const char * -tyname(tp) - type_t *tp; +tyname(type_t *tp) { tspec_t t; const char *s; @@ -2275,9 +2203,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; @@ -2329,9 +2255,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; @@ -2352,9 +2276,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; @@ -2382,9 +2304,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; @@ -2437,9 +2357,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; @@ -2454,8 +2372,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; @@ -2533,9 +2450,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; @@ -2596,8 +2511,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; @@ -2664,15 +2578,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); } @@ -2684,8 +2596,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; @@ -2823,8 +2734,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); } @@ -2834,8 +2744,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; @@ -2891,8 +2800,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; @@ -2991,8 +2899,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; @@ -3059,9 +2966,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; @@ -3120,8 +3025,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; @@ -3143,8 +3047,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; @@ -3181,11 +3084,12 @@ funccall(func, args) /* * Check types of all function arguments and insert conversions, * if necessary. + * + * ftp: type of called function + * args: arguments to function */ 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; @@ -3255,12 +3159,13 @@ chkfarg(ftp, args) * prototype parameter. If it is a valid combination, but both types * are not the same, insert a conversion to convert the argument into * the type of the parameter. + * + * n: position of arg + * tp: expected type (from prototype) + * tn: argument */ 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; @@ -3283,8 +3188,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; @@ -3336,9 +3240,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"); @@ -3378,8 +3280,7 @@ expr(tn, vctx, tctx) } static void -nulleff(tn) - tnode_t *tn; +nulleff(tnode_t *tn) { if (!hflag) return; @@ -3425,9 +3326,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; @@ -3483,9 +3382,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; @@ -3620,9 +3518,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; @@ -3678,9 +3574,7 @@ chkaidx(tn, amper) * Check for ordered comparisons 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; @@ -3749,10 +3643,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; @@ -3814,8 +3705,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 +3742,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 = NOOP; |