Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint cleanup (prior to more adding more features):



details:   https://anonhg.NetBSD.org/src/rev/4df418ef1387
branches:  trunk
changeset: 510411:4df418ef1387
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon May 28 12:40:37 2001 +0000

description:
cleanup (prior to more adding more features):
- convert to ANSI KNF
- remove trailing whitespace
- translate some comments from german into english

code compiles and runs clean, and tested by running "make lint" against
xlint source using previous and this lint produces same results.

diffstat:

 usr.bin/xlint/lint1/cgram.y    |   44 ++---
 usr.bin/xlint/lint1/decl.c     |  309 +++++++++++++++----------------------
 usr.bin/xlint/lint1/emit.c     |   53 ++---
 usr.bin/xlint/lint1/emit1.c    |   44 ++---
 usr.bin/xlint/lint1/err.c      |   77 +--------
 usr.bin/xlint/lint1/externs.h  |   30 +-
 usr.bin/xlint/lint1/externs1.h |  302 ++++++++++++++++++------------------
 usr.bin/xlint/lint1/func.c     |  128 +++++++-------
 usr.bin/xlint/lint1/init.c     |   46 ++--
 usr.bin/xlint/lint1/main1.c    |   19 +-
 usr.bin/xlint/lint1/mem.c      |   21 +-
 usr.bin/xlint/lint1/mem1.c     |   72 ++++----
 usr.bin/xlint/lint1/scan.l     |  161 ++++++++-----------
 usr.bin/xlint/lint1/tree.c     |  335 ++++++++++++++--------------------------
 usr.bin/xlint/lint2/chk.c      |  146 ++++++-----------
 usr.bin/xlint/lint2/emit2.c    |   37 +--
 usr.bin/xlint/lint2/externs2.h |   32 +-
 usr.bin/xlint/lint2/hash.c     |   24 +-
 usr.bin/xlint/lint2/lint2.h    |    6 +-
 usr.bin/xlint/lint2/main2.c    |   22 +-
 usr.bin/xlint/lint2/mem2.c     |    9 +-
 usr.bin/xlint/lint2/msg.c      |   30 +---
 usr.bin/xlint/lint2/read.c     |  106 ++++--------
 usr.bin/xlint/xlint/xlint.c    |  123 ++++++--------
 24 files changed, 881 insertions(+), 1295 deletions(-)

diffs (truncated from 5498 to 300 lines):

diff -r 3b109d81efeb -r 4df418ef1387 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Mon May 28 11:14:41 2001 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Mon May 28 12:40:37 2001 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.19 2001/05/24 12:05:28 lukem Exp $ */
+/* $NetBSD: cgram.y,v 1.20 2001/05/28 12:40:37 lukem Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: cgram.y,v 1.19 2001/05/24 12:05:28 lukem Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.20 2001/05/28 12:40:37 lukem Exp $");
 #endif
 
 #include <stdlib.h>
@@ -64,13 +64,13 @@
  */
 static int onowarn = -1;
 
-static int     toicon __P((tnode_t *));
-static void    idecl __P((sym_t *, int, sbuf_t *));
-static void    ignuptorp __P((void));
+static int     toicon(tnode_t *);
+static void    idecl(sym_t *, int, sbuf_t *);
+static void    ignuptorp(void);
 
 #ifdef DEBUG
-static __inline void CLRWFLGS __P((void));
-static __inline void CLRWFLGS()
+static __inline void CLRWFLGS(void);
+static __inline void CLRWFLGS(void)
 {
        printf("%s, %d: clear flags %s %d\n", curr_pos.p_file,
            curr_pos.p_line, __FILE__, __LINE__);
@@ -78,8 +78,8 @@
        onowarn = -1;
 }
 
-static __inline void SAVE __P((void));
-static __inline void SAVE()
+static __inline void SAVE(void);
+static __inline void SAVE(void)
 {
        if (onowarn != -1)
                abort();
@@ -88,8 +88,8 @@
        onowarn = nowarn;
 }
 
-static __inline void RESTORE __P((void));
-static __inline void RESTORE()
+static __inline void RESTORE(void);
+static __inline void RESTORE(void)
 {
        if (onowarn != -1) {
                nowarn = onowarn;
@@ -326,7 +326,7 @@
          }
        | declspecs deftyp type_init_decls T_SEMI
        | error T_SEMI {
-               globclup();             
+               globclup();
          }
        | error T_RBRACE {
                globclup();
@@ -1632,9 +1632,9 @@
 
 /* ARGSUSED */
 int
-yyerror(msg)
-       char    *msg;
+yyerror(char *msg)
 {
+
        error(249);
        if (++sytxerr >= 5)
                norecover();
@@ -1645,16 +1645,14 @@
 static inline int q_gt(quad_t, quad_t);
 
 static inline int
-uq_gt(a, b)
-       u_quad_t a, b;
+uq_gt(u_quad_t a, u_quad_t b)
 {
 
        return (a > b);
 }
 
 static inline int
-q_gt(a, b)
-       quad_t a, b;
+q_gt(quad_t a, quad_t b)
 {
 
        return (a > b);
@@ -1672,8 +1670,7 @@
  * expressions, it frees the memory used for the expression.
  */
 static int
-toicon(tn)
-       tnode_t *tn;
+toicon(tnode_t *tn)
 {
        int     i;
        tspec_t t;
@@ -1712,10 +1709,7 @@
 }
 
 static void
-idecl(decl, initflg, rename)
-       sym_t   *decl;
-       int     initflg;
-       sbuf_t  *rename;
+idecl(sym_t *decl, int initflg, sbuf_t *rename)
 {
        char *s;
 
@@ -1766,7 +1760,7 @@
  * unmatched right paren
  */
 void
-ignuptorp()
+ignuptorp(void)
 {
        int     level;
 
diff -r 3b109d81efeb -r 4df418ef1387 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Mon May 28 11:14:41 2001 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Mon May 28 12:40:37 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.21 2001/05/24 11:56:36 lukem Exp $ */
+/* $NetBSD: decl.c,v 1.22 2001/05/28 12:40:37 lukem Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: decl.c,v 1.21 2001/05/24 11:56:36 lukem Exp $");
+__RCSID("$NetBSD: decl.c,v 1.22 2001/05/28 12:40:37 lukem Exp $");
 #endif
 
 #include <sys/param.h>
@@ -61,31 +61,31 @@
  */
 dinfo_t        *dcs;
 
-static type_t  *tdeferr __P((type_t *, tspec_t));
-static void    settdsym __P((type_t *, sym_t *));
-static tspec_t mrgtspec __P((tspec_t, tspec_t));
-static void    align __P((int, int));
-static sym_t   *newtag __P((sym_t *, scl_t, int, int));
-static int     eqargs __P((type_t *, type_t *, int *));
-static int     mnoarg __P((type_t *, int *));
-static int     chkosdef __P((sym_t *, sym_t *));
-static int     chkptdecl __P((sym_t *, sym_t *));
-static sym_t   *nsfunc __P((sym_t *, sym_t *));
-static void    osfunc __P((sym_t *, sym_t *));
-static void    ledecl __P((sym_t *));
-static int     chkinit __P((sym_t *));
-static void    chkausg __P((int, sym_t *));
-static void    chkvusg __P((int, sym_t *));
-static void    chklusg __P((sym_t *));
-static void    chktusg __P((sym_t *));
-static void    chkglvar __P((sym_t *));
-static void    glchksz __P((sym_t *));
+static type_t  *tdeferr(type_t *, tspec_t);
+static void    settdsym(type_t *, sym_t *);
+static tspec_t mrgtspec(tspec_t, tspec_t);
+static void    align(int, int);
+static sym_t   *newtag(sym_t *, scl_t, int, int);
+static int     eqargs(type_t *, type_t *, int *);
+static int     mnoarg(type_t *, int *);
+static int     chkosdef(sym_t *, sym_t *);
+static int     chkptdecl(sym_t *, sym_t *);
+static sym_t   *nsfunc(sym_t *, sym_t *);
+static void    osfunc(sym_t *, sym_t *);
+static void    ledecl(sym_t *);
+static int     chkinit(sym_t *);
+static void    chkausg(int, sym_t *);
+static void    chkvusg(int, sym_t *);
+static void    chklusg(sym_t *);
+static void    chktusg(sym_t *);
+static void    chkglvar(sym_t *);
+static void    glchksz(sym_t *);
 
 /*
  * initializes all global vars used in declarations
  */
 void
-initdecl()
+initdecl(void)
 {
        int     i;
        static  struct {
@@ -175,7 +175,7 @@
                for (i = 0; i < NTSPEC; i++)
                        ttab[i].tt_psz = ttab[i].tt_sz;
        }
-       
+
        /* shared type structures */
        typetab = xcalloc(NTSPEC, sizeof (type_t));
        for (i = 0; i < NTSPEC; i++)
@@ -210,15 +210,14 @@
  * 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;
 
@@ -232,8 +231,7 @@
  * allocated memory should be freed after the expr).
  */
 type_t *
-tduptyp(tp)
-       const   type_t *tp;
+tduptyp(const type_t *tp)
 {
        type_t  *ntp;
 
@@ -247,8 +245,7 @@
  * struct, union or enum type.
  */
 int
-incompl(tp)
-       type_t  *tp;
+incompl(type_t *tp)
 {
        tspec_t t;
 
@@ -269,9 +266,7 @@
  * types.
  */
 void
-setcompl(tp, ic)
-       type_t  *tp;
-       int     ic;
+setcompl(type_t *tp, int ic)
 {
        tspec_t t;
 
@@ -292,9 +287,9 @@
  * storage classes.
  */
 void
-addscl(sc)
-       scl_t   sc;
+addscl(scl_t sc)
 {
+
        if (sc == INLINE) {
                if (dcs->d_inline)
                        /* duplicate '%s' */
@@ -329,8 +324,7 @@
  * struct/union/enum tag.
  */
 void
-addtype(tp)
-       type_t  *tp;
+addtype(type_t *tp)
 {
        tspec_t t;
 
@@ -413,7 +407,7 @@
        } else {
                /*
                 * remember specifiers "void", "char", "int", "float" or
-                * "double" int dcs->d_atyp 
+                * "double" int dcs->d_atyp
                 */
                if (dcs->d_atyp != NOTSPEC)
                        /* more than one, print error in deftyp() */
@@ -427,9 +421,7 @@
  * 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)
 {



Home | Main Index | Thread Index | Old Index