Remove xlint. It's outdated and there are much better checkers around.
authorSascha Wildner <saw@online.de>
Tue, 5 Feb 2013 20:23:52 +0000 (21:23 +0100)
committerSascha Wildner <saw@online.de>
Tue, 5 Feb 2013 20:23:52 +0000 (21:23 +0100)
clang static analyzer, cppcheck, coccinelle et al.

So there's no need to maintain it in base.

44 files changed:
Makefile_upgrade.inc
lib/libc/gen/dlsym.3
share/man/man7/hier.7
share/man/man9/style.9
usr.bin/Makefile
usr.bin/checknr/checknr.1
usr.bin/xlint/Makefile [deleted file]
usr.bin/xlint/Makefile.inc [deleted file]
usr.bin/xlint/lint1/Makefile [deleted file]
usr.bin/xlint/lint1/cgram.y [deleted file]
usr.bin/xlint/lint1/decl.c [deleted file]
usr.bin/xlint/lint1/emit.c [deleted file]
usr.bin/xlint/lint1/emit1.c [deleted file]
usr.bin/xlint/lint1/err.c [deleted file]
usr.bin/xlint/lint1/externs.h [deleted file]
usr.bin/xlint/lint1/externs1.h [deleted file]
usr.bin/xlint/lint1/func.c [deleted file]
usr.bin/xlint/lint1/init.c [deleted file]
usr.bin/xlint/lint1/lint.h [deleted file]
usr.bin/xlint/lint1/lint1.h [deleted file]
usr.bin/xlint/lint1/main1.c [deleted file]
usr.bin/xlint/lint1/mem.c [deleted file]
usr.bin/xlint/lint1/mem1.c [deleted file]
usr.bin/xlint/lint1/op.h [deleted file]
usr.bin/xlint/lint1/param.h [deleted file]
usr.bin/xlint/lint1/scan.l [deleted file]
usr.bin/xlint/lint1/tree.c [deleted file]
usr.bin/xlint/lint2/Makefile [deleted file]
usr.bin/xlint/lint2/chk.c [deleted file]
usr.bin/xlint/lint2/emit2.c [deleted file]
usr.bin/xlint/lint2/externs2.h [deleted file]
usr.bin/xlint/lint2/hash.c [deleted file]
usr.bin/xlint/lint2/lint2.h [deleted file]
usr.bin/xlint/lint2/main2.c [deleted file]
usr.bin/xlint/lint2/mem2.c [deleted file]
usr.bin/xlint/lint2/msg.c [deleted file]
usr.bin/xlint/lint2/read.c [deleted file]
usr.bin/xlint/llib/Makefile [deleted file]
usr.bin/xlint/llib/llib-lposix [deleted file]
usr.bin/xlint/llib/llib-lstdc [deleted file]
usr.bin/xlint/xlint/Makefile [deleted file]
usr.bin/xlint/xlint/lint.1 [deleted file]
usr.bin/xlint/xlint/pathnames.h [deleted file]
usr.bin/xlint/xlint/xlint.c [deleted file]

index adb28d8..3a6d9aa 100644 (file)
@@ -2119,6 +2119,12 @@ TO_REMOVE+=/usr/share/man/man3/liby.3.gz
 TO_REMOVE+=/usr/bin/yyfix
 TO_REMOVE+=/usr/share/man/cat1/yyfix.1.gz
 TO_REMOVE+=/usr/share/man/man1/yyfix.1.gz
+TO_REMOVE+=/usr/bin/lint
+TO_REMOVE+=/usr/libdata/lint
+TO_REMOVE+=/usr/libexec/lint1
+TO_REMOVE+=/usr/libexec/lint2
+TO_REMOVE+=/usr/share/man/cat1/lint.1.gz
+TO_REMOVE+=/usr/share/man/man1/lint.1.gz
 
 .if ${MACHINE_ARCH} == "x86_64"
 TO_REMOVE+=/usr/sbin/stlstats
index c1f201c..29b88f1 100644 (file)
@@ -156,9 +156,7 @@ triggering compiler diagnostics.
 function
 returns a data pointer; in the C standard, conversions between
 data and function pointer types are undefined.
-Some compilers and
-.Xr lint 1
-utilities warn about such casts.)
+Some compilers and code checkers warn about such casts.)
 The precise return type of
 .Fn dlfunc
 is unspecified; applications must cast it to an appropriate function pointer
index 2e24923..ffc5e81 100644 (file)
@@ -32,7 +32,7 @@
 .\"    @(#)hier.7      8.1 (Berkeley) 6/5/93
 .\" $FreeBSD: src/share/man/man7/hier.7,v 1.29.2.17 2003/01/13 21:43:50 ceri Exp $
 .\"
-.Dd September 11, 2012
+.Dd February 5, 2013
 .Dt HIER 7
 .Os
 .Sh NAME
@@ -295,14 +295,6 @@ OpenSSL dynamic engines
 .Pp
 .It Pa libdata/
 misc. utility data files
-.Pp
-.Bl -tag -width ".Pa lint/" -compact
-.It Pa lint/
-various prebuilt lint libraries;
-see
-.Xr lint 1
-.El
-.Pp
 .It Pa libexec/
 system daemons & system utilities (executed by other programs)
 .Pp
index 6958573..ba30cd1 100644 (file)
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
+.\" Style guide for DragonFly.  Based on the CSRG's KNF (Kernel Normal Form).
 .\"
-.Dd August 30, 2004
+.\"    @(#)style       1.14 (Berkeley) 4/28/95
+.\" $FreeBSD: src/share/man/man9/style.9,v 1.32.2.19 2002/04/14 19:28:03 asmodai Exp $
+.\"
+.Dd February 5, 2013
 .Dt STYLE 9
 .Os
 .Sh NAME
@@ -39,14 +43,6 @@ Be careful to check the examples before assuming that
 .Nm
 is silent on an issue.
 .Bd -literal
-/*
- * Style guide for DragonFly.  Based on the CSRG's KNF (Kernel Normal Form).
- *
- *     @(#)style       1.14 (Berkeley) 4/28/95
- * $FreeBSD: src/share/man/man9/style.9,v 1.32.2.19 2002/04/14 19:28:03 asmodai Exp $
- * $DragonFly: src/share/man/man9/style.9,v 1.21 2008/05/02 02:05:06 swildner Exp $
- */
-
 /*
  * VERY important single-line comments look like this.
  */
@@ -745,15 +741,21 @@ KNF
 .Nm
 compliant in the repository must not diverge from compliance.
 .Pp
-Whenever possible, code should be run through a code checker
-(e.g.,
-.Xr lint 1
+.Dx Ap s
+default warning options are a reasonable subset and -Werror is enabled for
+kernel and world, so passing
+.Cm buildworld
+or
+.Cm buildkernel
+alone is a good check.
+The warnings of most recent compilers are of high quality.
+Further analysis can be done using one of the various code checkers such as
+.Xr cppcheck 1
 or
-.Nm gcc Fl Wall )
-and produce minimal warnings.
+.Xr clang 1 Ap s
+static analyzer.
 .Sh SEE ALSO
 .Xr indent 1 ,
-.Xr lint 1 ,
 .Xr err 3 ,
 .Xr sysexits 3 ,
 .Xr warn 3
index eb05106..6ccee3b 100644 (file)
@@ -236,7 +236,6 @@ SUBDIR=     alias \
        write \
        xargs \
        xinstall \
-       xlint \
        xstr \
        xz \
        xzdec \
index dfdb39d..c859ee5 100644 (file)
@@ -31,7 +31,6 @@
 .\"
 .\"     @(#)checknr.1  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD: src/usr.bin/checknr/checknr.1,v 1.5.2.5 2002/07/15 04:29:39 keramida Exp $
-.\" $DragonFly: src/usr.bin/checknr/checknr.1,v 1.4 2006/02/17 19:38:57 swildner Exp $
 .\"
 .Dd June 6, 1993
 .Dt CHECKNR 1
@@ -102,8 +101,7 @@ The
 .Nm
 utility is intended for use on documents that are prepared with
 .Nm
-in mind, much the same as
-.Xr lint 1 .
+in mind.
 It expects a certain document writing style for
 .Ql \ef
 and
diff --git a/usr.bin/xlint/Makefile b/usr.bin/xlint/Makefile
deleted file mode 100644 (file)
index 10a7798..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#      $NetBSD: Makefile,v 1.2 1995/07/03 21:23:45 cgd Exp $
-# $FreeBSD: src/usr.bin/xlint/Makefile,v 1.7 2000/01/16 08:25:39 sheldonh Exp $
-# $DragonFly: src/usr.bin/xlint/Makefile,v 1.2 2003/06/17 04:29:34 dillon Exp $
-
-SUBDIR=        lint1 lint2 xlint #llib
-
-.include <bsd.subdir.mk>
diff --git a/usr.bin/xlint/Makefile.inc b/usr.bin/xlint/Makefile.inc
deleted file mode 100644 (file)
index ad6e982..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-WARNS?=        1
-
-.include "../Makefile.inc"
diff --git a/usr.bin/xlint/lint1/Makefile b/usr.bin/xlint/lint1/Makefile
deleted file mode 100644 (file)
index 7a94f4c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#      $NetBSD: Makefile,v 1.3 1995/07/04 01:53:05 cgd Exp $
-# $FreeBSD: src/usr.bin/xlint/lint1/Makefile,v 1.7.2.1 2000/12/07 16:33:35 obrien Exp $
-
-PROG=  lint1
-SRCS=  cgram.y scan.l mem1.c mem.c err.c main1.c decl.c tree.c func.c \
-       init.c emit.c emit1.c y.tab.h
-NOMAN=
-LDADD+=        -ll
-DPADD+=        ${LIBL}
-CFLAGS+= -I. -I${.CURDIR}
-LINTFLAGS=-aehpz
-
-BINDIR=        /usr/libexec
-
-# XXX: -O causes the gcc to die on the i386, when compiling tree.o
-CFLAGS+= -DXXX_BROKEN_GCC
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/xlint/lint1/cgram.y b/usr.bin/xlint/lint1/cgram.y
deleted file mode 100644 (file)
index 2744035..0000000
+++ /dev/null
@@ -1,1681 +0,0 @@
-%{
-/*     $NetBSD: cgram.y,v 1.8 1995/10/02 17:31:35 jpo Exp $    */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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: cgram.y,v 1.8 1995/10/02 17:31:35 jpo Exp $
- * $DragonFly: src/usr.bin/xlint/lint1/cgram.y,v 1.6 2004/07/07 12:26:51 asmodai Exp $
- */
-
-#include <stdlib.h>
-#include <limits.h>
-
-#include "lint1.h"
-
-/*
- * Contains the level of current declaration. 0 is extern.
- * Used for symbol table entries.
- */
-int    blklev;
-
-/*
- * level for memory allocation. Normaly the same as blklev.
- * An exeption is the declaration of arguments in prototypes. Memory
- * for these can't be freed after the declaration, but symbols must
- * be removed from the symbol table after the declaration.
- */
-int    mblklev;
-
-static int     toicon(tnode_t *);
-static void    idecl(sym_t *, int);
-static void    ignuptorp(void);
-
-%}
-
-%union {
-       int     y_int;
-       val_t   *y_val;
-       sbuf_t  *y_sb;
-       sym_t   *y_sym;
-       op_t    y_op;
-       scl_t   y_scl;
-       tspec_t y_tspec;
-       tqual_t y_tqual;
-       type_t  *y_type;
-       tnode_t *y_tnode;
-       strg_t  *y_strg;
-       pqinf_t *y_pqinf;
-};
-
-%token                 T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPARN T_RPARN
-%token <y_op>          T_STROP
-%token <y_op>          T_UNOP
-%token <y_op>          T_INCDEC
-%token                 T_SIZEOF
-%token <y_op>          T_MULT
-%token <y_op>          T_DIVOP
-%token <y_op>          T_ADDOP
-%token <y_op>          T_SHFTOP
-%token <y_op>          T_RELOP
-%token <y_op>          T_EQOP
-%token <y_op>          T_AND
-%token <y_op>          T_XOR
-%token <y_op>          T_OR
-%token <y_op>          T_LOGAND
-%token <y_op>          T_LOGOR
-%token                 T_QUEST
-%token                 T_COLON
-%token <y_op>          T_ASSIGN
-%token <y_op>          T_OPASS
-%token                 T_COMMA
-%token                 T_SEMI
-%token                 T_ELLIPSE
-
-/* storage classes (extern, static, auto, register and typedef) */
-%token <y_scl>         T_SCLASS
-
-/* types (char, int, short, long, unsigned, signed, float, double, void) */
-%token <y_tspec>       T_TYPE
-
-/* qualifiers (const, volatile) */
-%token <y_tqual>       T_QUAL
-
-/* struct or union */
-%token <y_tspec>       T_SOU
-
-/* enum */
-%token                 T_ENUM
-
-/* remaining keywords */
-%token                 T_CASE
-%token                 T_DEFAULT
-%token                 T_IF
-%token                 T_ELSE
-%token                 T_SWITCH
-%token                 T_DO
-%token                 T_WHILE
-%token                 T_FOR
-%token                 T_GOTO
-%token                 T_CONTINUE
-%token                 T_BREAK
-%token                 T_RETURN
-%token                 T_ASM
-
-%left  T_COMMA
-%right T_ASSIGN T_OPASS
-%right T_QUEST T_COLON
-%left  T_LOGOR
-%left  T_LOGAND
-%left  T_OR
-%left  T_XOR
-%left  T_AND
-%left  T_EQOP
-%left  T_RELOP
-%left  T_SHFTOP
-%left  T_ADDOP
-%left  T_MULT T_DIVOP
-%right T_UNOP T_INCDEC T_SIZEOF
-%left  T_LPARN T_LBRACK T_STROP
-
-%token <y_sb>          T_NAME
-%token <y_sb>          T_TYPENAME
-%token <y_val>         T_CON
-%token <y_strg>        T_STRING
-
-%type  <y_sym>         func_decl
-%type  <y_sym>         notype_decl
-%type  <y_sym>         type_decl
-%type  <y_type>        typespec
-%type  <y_type>        clrtyp_typespec
-%type  <y_type>        notype_typespec
-%type  <y_type>        struct_spec
-%type  <y_type>        enum_spec
-%type  <y_sym>         struct_tag
-%type  <y_sym>         enum_tag
-%type  <y_tspec>       struct
-%type  <y_sym>         struct_declaration
-%type  <y_sb>          identifier
-%type  <y_sym>         member_declaration_list_with_rbrace
-%type  <y_sym>         member_declaration_list
-%type  <y_sym>         member_declaration
-%type  <y_sym>         notype_member_decls
-%type  <y_sym>         type_member_decls
-%type  <y_sym>         notype_member_decl
-%type  <y_sym>         type_member_decl
-%type  <y_tnode>       constant
-%type  <y_sym>         enum_declaration
-%type  <y_sym>         enums_with_opt_comma
-%type  <y_sym>         enums
-%type  <y_sym>         enumerator
-%type  <y_sym>         ename
-%type  <y_sym>         notype_direct_decl
-%type  <y_sym>         type_direct_decl
-%type  <y_pqinf>       pointer
-%type  <y_pqinf>       asterisk
-%type  <y_sym>         param_decl
-%type  <y_sym>         param_list
-%type  <y_sym>         abs_decl_param_list
-%type  <y_sym>         direct_param_decl
-%type  <y_sym>         notype_param_decl
-%type  <y_sym>         direct_notype_param_decl
-%type  <y_pqinf>       type_qualifier_list
-%type  <y_pqinf>       type_qualifier
-%type  <y_sym>         identifier_list
-%type  <y_sym>         abs_decl
-%type  <y_sym>         direct_abs_decl
-%type  <y_sym>         vararg_parameter_type_list
-%type  <y_sym>         parameter_type_list
-%type  <y_sym>         parameter_declaration
-%type  <y_tnode>       expr
-%type  <y_tnode>       term
-%type  <y_tnode>       func_arg_list
-%type  <y_op>          point_or_arrow
-%type  <y_type>        type_name
-%type  <y_sym>         abstract_declaration
-%type  <y_tnode>       do_while_expr
-%type  <y_tnode>       opt_expr
-%type  <y_strg>        string
-%type  <y_strg>        string2
-
-
-%%
-
-program:
-         /* empty */ {
-               if (sflag) {
-                       /* empty translation unit */
-                       error(272);
-               } else if (!tflag) {
-                       /* empty translation unit */
-                       warning(272);
-               }
-         }
-       | translation_unit
-       ;
-
-translation_unit:
-         ext_decl
-       | translation_unit ext_decl
-       ;
-
-ext_decl:
-         func_def {
-               glclup(0);
-               clrwflgs();
-         }
-       | data_def {
-               glclup(0);
-               clrwflgs();
-         }
-       ;
-
-data_def:
-         T_SEMI {
-               if (sflag) {
-                       /* syntax error: empty declaration */
-                       error(0);
-               } else if (!tflag) {
-                       /* syntax error: empty declaration */
-                       warning(0);
-               }
-         }
-       | clrtyp deftyp notype_init_decls T_SEMI {
-               if (sflag) {
-                       /* old style declaration; add "int" */
-                       error(1);
-               } else if (!tflag) {
-                       /* old style declaration; add "int" */
-                       warning(1);
-               }
-         }
-       | declmods deftyp T_SEMI {
-               if (dcs->d_scl == TYPEDEF) {
-                       /* typedef declares no type name */
-                       warning(72);
-               } else {
-                       /* empty declaration */
-                       warning(2);
-               }
-         }
-       | declmods deftyp notype_init_decls T_SEMI
-       | declspecs deftyp T_SEMI {
-               if (dcs->d_scl == TYPEDEF) {
-                       /* typedef declares no type name */
-                       warning(72);
-               } else if (!dcs->d_nedecl) {
-                       /* empty declaration */
-                       warning(2);
-               }
-         }
-       | declspecs deftyp type_init_decls T_SEMI
-       | error T_SEMI {
-               globclup();
-         }
-       | error T_RBRACE {
-               globclup();
-         }
-       ;
-
-func_def:
-         func_decl {
-               if ($1->s_type->t_tspec != FUNC) {
-                       /* syntax error */
-                       error(249);
-                       YYERROR;
-               }
-               if ($1->s_type->t_typedef) {
-                       /* ()-less function definition */
-                       error(64);
-                       YYERROR;
-               }
-               funcdef($1);
-               blklev++;
-               pushdecl(ARG);
-         } opt_arg_declaration_list {
-               popdecl();
-               blklev--;
-               cluparg();
-               pushctrl(0);
-         } comp_stmnt {
-               funcend();
-               popctrl(0);
-         }
-       ;
-
-func_decl:
-         clrtyp deftyp notype_decl {
-               $$ = $3;
-         }
-       | declmods deftyp notype_decl {
-               $$ = $3;
-         }
-       | declspecs deftyp type_decl {
-               $$ = $3;
-         }
-       ;
-
-opt_arg_declaration_list:
-         /* empty */
-       | arg_declaration_list
-       ;
-
-arg_declaration_list:
-         arg_declaration
-       | arg_declaration_list arg_declaration
-       /* XXX or better "arg_declaration error" ? */
-       | error
-       ;
-
-/*
- * "arg_declaration" is separated from "declaration" because it
- * needs other error handling.
- */
-
-arg_declaration:
-         declmods deftyp T_SEMI {
-               /* empty declaration */
-               warning(2);
-         }
-       | declmods deftyp notype_init_decls T_SEMI
-       | declspecs deftyp T_SEMI {
-               if (!dcs->d_nedecl) {
-                       /* empty declaration */
-                       warning(2);
-               } else {
-                       tspec_t ts = dcs->d_type->t_tspec;
-                       /* %s declared in argument declaration list */
-                       warning(3, ts == STRUCT ? "struct" :
-                               (ts == UNION ? "union" : "enum"));
-               }
-         }
-       | declspecs deftyp type_init_decls T_SEMI {
-               if (dcs->d_nedecl) {
-                       tspec_t ts = dcs->d_type->t_tspec;
-                       /* %s declared in argument declaration list */
-                       warning(3, ts == STRUCT ? "struct" :
-                               (ts == UNION ? "union" : "enum"));
-               }
-         }
-       | declmods error
-       | declspecs error
-       ;
-
-declaration:
-         declmods deftyp T_SEMI {
-               if (dcs->d_scl == TYPEDEF) {
-                       /* typedef declares no type name */
-                       warning(72);
-               } else {
-                       /* empty declaration */
-                       warning(2);
-               }
-         }
-       | declmods deftyp notype_init_decls T_SEMI
-       | declspecs deftyp T_SEMI {
-               if (dcs->d_scl == TYPEDEF) {
-                       /* typedef declares no type name */
-                       warning(72);
-               } else if (!dcs->d_nedecl) {
-                       /* empty declaration */
-                       warning(2);
-               }
-         }
-       | declspecs deftyp type_init_decls T_SEMI
-       | error T_SEMI
-       ;
-
-clrtyp:
-         {
-               clrtyp();
-         }
-       ;
-
-deftyp:
-         /* empty */ {
-               deftyp();
-         }
-       ;
-
-declspecs:
-         clrtyp_typespec {
-               addtype($1);
-         }
-       | declmods typespec {
-               addtype($2);
-         }
-       | declspecs declmod
-       | declspecs notype_typespec {
-               addtype($2);
-         }
-       ;
-
-declmods:
-         clrtyp T_QUAL {
-               addqual($2);
-         }
-       | clrtyp T_SCLASS {
-               addscl($2);
-         }
-       | declmods declmod
-       ;
-
-declmod:
-         T_QUAL {
-               addqual($1);
-         }
-       | T_SCLASS {
-               addscl($1);
-         }
-       ;
-
-clrtyp_typespec:
-         clrtyp notype_typespec {
-               $$ = $2;
-         }
-       | T_TYPENAME clrtyp {
-               $$ = getsym($1)->s_type;
-         }
-       ;
-
-typespec:
-         notype_typespec {
-               $$ = $1;
-         }
-       | T_TYPENAME {
-               $$ = getsym($1)->s_type;
-         }
-       ;
-
-notype_typespec:
-         T_TYPE {
-               $$ = gettyp($1);
-         }
-       | struct_spec {
-               popdecl();
-               $$ = $1;
-         }
-       | enum_spec {
-               popdecl();
-               $$ = $1;
-         }
-       ;
-
-struct_spec:
-         struct struct_tag {
-               /*
-                * STDC requires that "struct a;" always introduces
-                * a new tag if "a" is not declared at current level
-                *
-                * yychar is valid because otherwise the parser would
-                * not been able to deceide if he must shift or reduce
-                */
-               $$ = mktag($2, $1, 0, yychar == T_SEMI);
-         }
-       | struct struct_tag {
-               dcs->d_tagtyp = mktag($2, $1, 1, 0);
-         } struct_declaration {
-               $$ = compltag(dcs->d_tagtyp, $4);
-         }
-       | struct {
-               dcs->d_tagtyp = mktag(NULL, $1, 1, 0);
-         } struct_declaration {
-               $$ = compltag(dcs->d_tagtyp, $3);
-         }
-       | struct error {
-               symtyp = FVFT;
-               $$ = gettyp(INT);
-         }
-       ;
-
-struct:
-         T_SOU {
-               symtyp = FTAG;
-               pushdecl($1 == STRUCT ? MOS : MOU);
-               dcs->d_offset = 0;
-               dcs->d_stralign = CHAR_BIT;
-               $$ = $1;
-         }
-       ;
-
-struct_tag:
-         identifier {
-               $$ = getsym($1);
-         }
-       ;
-
-struct_declaration:
-         struct_decl_lbrace member_declaration_list_with_rbrace {
-               $$ = $2;
-         }
-       ;
-
-struct_decl_lbrace:
-         T_LBRACE {
-               symtyp = FVFT;
-         }
-       ;
-
-member_declaration_list_with_rbrace:
-         member_declaration_list T_SEMI T_RBRACE {
-               $$ = $1;
-         }
-       | member_declaration_list T_RBRACE {
-               if (sflag) {
-                       /* syntax req. ";" after last struct/union member */
-                       error(66);
-               } else {
-                       /* syntax req. ";" after last struct/union member */
-                       warning(66);
-               }
-               $$ = $1;
-         }
-       | T_RBRACE {
-               $$ = NULL;
-         }
-       ;
-
-member_declaration_list:
-         member_declaration {
-               $$ = $1;
-         }
-       | member_declaration_list T_SEMI member_declaration {
-               $$ = lnklst($1, $3);
-         }
-       ;
-
-member_declaration:
-         noclass_declmods deftyp {
-               /* too late, i know, but getsym() compensates it */
-               symtyp = FMOS;
-         } notype_member_decls {
-               symtyp = FVFT;
-               $$ = $4;
-         }
-       | noclass_declspecs deftyp {
-               symtyp = FMOS;
-         } type_member_decls {
-               symtyp = FVFT;
-               $$ = $4;
-         }
-       | noclass_declmods deftyp {
-               /* struct or union member must be named */
-               warning(49);
-               $$ = NULL;
-         }
-       | noclass_declspecs deftyp {
-               /* struct or union member must be named */
-               warning(49);
-               $$ = NULL;
-         }
-       | error {
-               symtyp = FVFT;
-               $$ = NULL;
-         }
-       ;
-
-noclass_declspecs:
-         clrtyp_typespec {
-               addtype($1);
-         }
-       | noclass_declmods typespec {
-               addtype($2);
-         }
-       | noclass_declspecs T_QUAL {
-               addqual($2);
-         }
-       | noclass_declspecs notype_typespec {
-               addtype($2);
-         }
-       ;
-
-noclass_declmods:
-         clrtyp T_QUAL {
-               addqual($2);
-         }
-       | noclass_declmods T_QUAL {
-               addqual($2);
-         }
-       ;
-
-notype_member_decls:
-         notype_member_decl {
-               $$ = decl1str($1);
-         }
-       | notype_member_decls {
-               symtyp = FMOS;
-         } T_COMMA type_member_decl {
-               $$ = lnklst($1, decl1str($4));
-         }
-       ;
-
-type_member_decls:
-         type_member_decl {
-               $$ = decl1str($1);
-         }
-       | type_member_decls {
-               symtyp = FMOS;
-         } T_COMMA type_member_decl {
-               $$ = lnklst($1, decl1str($4));
-         }
-       ;
-
-notype_member_decl:
-         notype_decl {
-               $$ = $1;
-         }
-       | notype_decl T_COLON constant {
-               $$ = bitfield($1, toicon($3));
-         }
-       | {
-               symtyp = FVFT;
-         } T_COLON constant {
-               $$ = bitfield(NULL, toicon($3));
-         }
-       ;
-
-type_member_decl:
-         type_decl {
-               $$ = $1;
-         }
-       | type_decl T_COLON constant {
-               $$ = bitfield($1, toicon($3));
-         }
-       | {
-               symtyp = FVFT;
-         } T_COLON constant {
-               $$ = bitfield(NULL, toicon($3));
-         }
-       ;
-
-enum_spec:
-         enum enum_tag {
-               $$ = mktag($2, ENUM, 0, 0);
-         }
-       | enum enum_tag {
-               dcs->d_tagtyp = mktag($2, ENUM, 1, 0);
-         } enum_declaration {
-               $$ = compltag(dcs->d_tagtyp, $4);
-         }
-       | enum {
-               dcs->d_tagtyp = mktag(NULL, ENUM, 1, 0);
-         } enum_declaration {
-               $$ = compltag(dcs->d_tagtyp, $3);
-         }
-       | enum error {
-               symtyp = FVFT;
-               $$ = gettyp(INT);
-         }
-       ;
-
-enum:
-         T_ENUM {
-               symtyp = FTAG;
-               pushdecl(ENUMCON);
-         }
-       ;
-
-enum_tag:
-         identifier {
-               $$ = getsym($1);
-         }
-       ;
-
-enum_declaration:
-         enum_decl_lbrace enums_with_opt_comma T_RBRACE {
-               $$ = $2;
-         }
-       ;
-
-enum_decl_lbrace:
-         T_LBRACE {
-               symtyp = FVFT;
-               enumval = 0;
-         }
-       ;
-
-enums_with_opt_comma:
-         enums {
-               $$ = $1;
-         }
-       | enums T_COMMA {
-               if (sflag) {
-                       /* trailing "," prohibited in enum declaration */
-                       error(54);
-               } else {
-                       /* trailing "," prohibited in enum declaration */
-                       warning(54);
-               }
-               $$ = $1;
-         }
-       ;
-
-enums:
-         enumerator {
-               $$ = $1;
-         }
-       | enums T_COMMA enumerator {
-               $$ = lnklst($1, $3);
-         }
-       | error {
-               $$ = NULL;
-         }
-       ;
-
-enumerator:
-         ename {
-               $$ = ename($1, enumval, 1);
-         }
-       | ename T_ASSIGN constant {
-               $$ = ename($1, toicon($3), 0);
-         }
-       ;
-
-ename:
-         identifier {
-               $$ = getsym($1);
-         }
-       ;
-
-
-notype_init_decls:
-         notype_init_decl
-       | notype_init_decls T_COMMA type_init_decl
-       ;
-
-type_init_decls:
-         type_init_decl
-       | type_init_decls T_COMMA type_init_decl
-       ;
-
-notype_init_decl:
-         notype_decl opt_asm_spec {
-               idecl($1, 0);
-               chksz($1);
-         }
-       | notype_decl opt_asm_spec {
-               idecl($1, 1);
-         } T_ASSIGN initializer {
-               chksz($1);
-         }
-       ;
-
-type_init_decl:
-         type_decl opt_asm_spec {
-               idecl($1, 0);
-               chksz($1);
-         }
-       | type_decl opt_asm_spec {
-               idecl($1, 1);
-         } T_ASSIGN initializer {
-               chksz($1);
-         }
-       ;
-
-notype_decl:
-         notype_direct_decl {
-               $$ = $1;
-         }
-       | pointer notype_direct_decl {
-               $$ = addptr($2, $1);
-         }
-       ;
-
-notype_direct_decl:
-         T_NAME {
-               $$ = dname(getsym($1));
-         }
-       | T_LPARN type_decl T_RPARN {
-               $$ = $2;
-         }
-       | notype_direct_decl T_LBRACK T_RBRACK {
-               $$ = addarray($1, 0, 0);
-         }
-       | notype_direct_decl T_LBRACK constant T_RBRACK {
-               $$ = addarray($1, 1, toicon($3));
-         }
-       | notype_direct_decl param_list {
-               $$ = addfunc($1, $2);
-               popdecl();
-               blklev--;
-         }
-       ;
-
-type_decl:
-         type_direct_decl {
-               $$ = $1;
-         }
-       | pointer type_direct_decl {
-               $$ = addptr($2, $1);
-         }
-       ;
-
-type_direct_decl:
-         identifier {
-               $$ = dname(getsym($1));
-         }
-       | T_LPARN type_decl T_RPARN {
-               $$ = $2;
-         }
-       | type_direct_decl T_LBRACK T_RBRACK {
-               $$ = addarray($1, 0, 0);
-         }
-       | type_direct_decl T_LBRACK constant T_RBRACK {
-               $$ = addarray($1, 1, toicon($3));
-         }
-       | type_direct_decl param_list {
-               $$ = addfunc($1, $2);
-               popdecl();
-               blklev--;
-         }
-       ;
-
-/*
- * param_decl and notype_param_decl exist to avoid a conflict in
- * argument lists. A typename enclosed in parens should always be
- * treated as a typename, not an argument.
- * "typedef int a; f(int (a));" is  "typedef int a; f(int foo(a));"
- *                             not "typedef int a; f(int a);"
- */
-param_decl:
-         direct_param_decl {
-               $$ = $1;
-         }
-       | pointer direct_param_decl {
-               $$ = addptr($2, $1);
-         }
-       ;
-
-direct_param_decl:
-         identifier {
-               $$ = dname(getsym($1));
-         }
-       | T_LPARN notype_param_decl T_RPARN {
-               $$ = $2;
-         }
-       | direct_param_decl T_LBRACK T_RBRACK {
-               $$ = addarray($1, 0, 0);
-         }
-       | direct_param_decl T_LBRACK constant T_RBRACK {
-               $$ = addarray($1, 1, toicon($3));
-         }
-       | direct_param_decl param_list {
-               $$ = addfunc($1, $2);
-               popdecl();
-               blklev--;
-         }
-       ;
-
-notype_param_decl:
-         direct_notype_param_decl {
-               $$ = $1;
-         }
-       | pointer direct_notype_param_decl {
-               $$ = addptr($2, $1);
-         }
-       ;
-
-direct_notype_param_decl:
-         T_NAME {
-               $$ = dname(getsym($1));
-         }
-       | T_LPARN notype_param_decl T_RPARN {
-               $$ = $2;
-         }
-       | direct_notype_param_decl T_LBRACK T_RBRACK {
-               $$ = addarray($1, 0, 0);
-         }
-       | direct_notype_param_decl T_LBRACK constant T_RBRACK {
-               $$ = addarray($1, 1, toicon($3));
-         }
-       | direct_notype_param_decl param_list {
-               $$ = addfunc($1, $2);
-               popdecl();
-               blklev--;
-         }
-       ;
-
-pointer:
-         asterisk {
-               $$ = $1;
-         }
-       | asterisk type_qualifier_list {
-               $$ = mergepq($1, $2);
-         }
-       | asterisk pointer {
-               $$ = mergepq($1, $2);
-         }
-       | asterisk type_qualifier_list pointer {
-               $$ = mergepq(mergepq($1, $2), $3);
-         }
-       ;
-
-asterisk:
-         T_MULT {
-               $$ = xcalloc(1, sizeof (pqinf_t));
-               $$->p_pcnt = 1;
-         }
-       ;
-
-type_qualifier_list:
-         type_qualifier {
-               $$ = $1;
-         }
-       | type_qualifier_list type_qualifier {
-               $$ = mergepq($1, $2);
-         }
-       ;
-
-type_qualifier:
-         T_QUAL {
-               $$ = xcalloc(1, sizeof (pqinf_t));
-               if ($1 == CONST) {
-                       $$->p_const = 1;
-               } else {
-                       $$->p_volatile = 1;
-               }
-         }
-       ;
-
-param_list:
-         id_list_lparn identifier_list T_RPARN {
-               $$ = $2;
-         }
-       | abs_decl_param_list {
-               $$ = $1;
-         }
-       ;
-
-id_list_lparn:
-         T_LPARN {
-               blklev++;
-               pushdecl(PARG);
-         }
-       ;
-
-identifier_list:
-         T_NAME {
-               $$ = iname(getsym($1));
-         }
-       | identifier_list T_COMMA T_NAME {
-               $$ = lnklst($1, iname(getsym($3)));
-         }
-       | identifier_list error {
-               $$ = $1;
-         }
-       ;
-
-abs_decl_param_list:
-         abs_decl_lparn T_RPARN {
-               $$ = NULL;
-         }
-       | abs_decl_lparn vararg_parameter_type_list T_RPARN {
-               dcs->d_proto = 1;
-               $$ = $2;
-         }
-       | abs_decl_lparn error T_RPARN {
-               $$ = NULL;
-         }
-       ;
-
-abs_decl_lparn:
-         T_LPARN {
-               blklev++;
-               pushdecl(PARG);
-         }
-       ;
-
-vararg_parameter_type_list:
-         parameter_type_list {
-               $$ = $1;
-         }
-       | parameter_type_list T_COMMA T_ELLIPSE {
-               dcs->d_vararg = 1;
-               $$ = $1;
-         }
-       | T_ELLIPSE {
-               if (sflag) {
-                       /* ANSI C requires formal parameter before "..." */
-                       error(84);
-               } else if (!tflag) {
-                       /* ANSI C requires formal parameter before "..." */
-                       warning(84);
-               }
-               dcs->d_vararg = 1;
-               $$ = NULL;
-         }
-       ;
-
-parameter_type_list:
-         parameter_declaration opt_asm_spec {
-               $$ = $1;
-         }
-       | parameter_type_list T_COMMA parameter_declaration opt_asm_spec {
-               $$ = lnklst($1, $3);
-         }
-       ;
-
-parameter_declaration:
-         declmods deftyp {
-               $$ = decl1arg(aname(), 0);
-         }
-       | declspecs deftyp {
-               $$ = decl1arg(aname(), 0);
-         }
-       | declmods deftyp notype_param_decl {
-               $$ = decl1arg($3, 0);
-         }
-       /*
-        * param_decl is needed because of following conflict:
-        * "typedef int a; f(int (a));" could be parsed as
-        * "function with argument a of type int", or
-        * "function with an abstract argument of type function".
-        * This grammar realizes the second case.
-        */
-       | declspecs deftyp param_decl {
-               $$ = decl1arg($3, 0);
-         }
-       | declmods deftyp abs_decl {
-               $$ = decl1arg($3, 0);
-         }
-       | declspecs deftyp abs_decl {
-               $$ = decl1arg($3, 0);
-         }
-       ;
-
-opt_asm_spec:
-         /* empty */
-       | T_ASM T_LPARN T_STRING T_RPARN {
-               freeyyv(&$3, T_STRING);
-         }
-       ;
-
-initializer:
-         init_expr
-       ;
-
-init_expr:
-         expr                          %prec T_COMMA {
-               mkinit($1);
-         }
-       | init_lbrace init_expr_list init_rbrace
-       | init_lbrace init_expr_list T_COMMA init_rbrace
-       | error
-       ;
-
-init_expr_list:
-         init_expr                     %prec T_COMMA
-       | init_expr_list T_COMMA init_expr
-       ;
-
-init_lbrace:
-         T_LBRACE {
-               initlbr();
-         }
-       ;
-
-init_rbrace:
-         T_RBRACE {
-               initrbr();
-         }
-       ;
-
-type_name:
-         {
-               pushdecl(ABSTRACT);
-         } abstract_declaration {
-               popdecl();
-               $$ = $2->s_type;
-         }
-       ;
-
-abstract_declaration:
-         noclass_declmods deftyp {
-               $$ = decl1abs(aname());
-         }
-       | noclass_declspecs deftyp {
-               $$ = decl1abs(aname());
-         }
-       | noclass_declmods deftyp abs_decl {
-               $$ = decl1abs($3);
-         }
-       | noclass_declspecs deftyp abs_decl {
-               $$ = decl1abs($3);
-         }
-       ;
-
-abs_decl:
-         pointer {
-               $$ = addptr(aname(), $1);
-         }
-       | direct_abs_decl {
-               $$ = $1;
-         }
-       | pointer direct_abs_decl {
-               $$ = addptr($2, $1);
-         }
-       ;
-
-direct_abs_decl:
-         T_LPARN abs_decl T_RPARN {
-               $$ = $2;
-         }
-       | T_LBRACK T_RBRACK {
-               $$ = addarray(aname(), 0, 0);
-         }
-       | T_LBRACK constant T_RBRACK {
-               $$ = addarray(aname(), 1, toicon($2));
-         }
-       | direct_abs_decl T_LBRACK T_RBRACK {
-               $$ = addarray($1, 0, 0);
-         }
-       | direct_abs_decl T_LBRACK constant T_RBRACK {
-               $$ = addarray($1, 1, toicon($3));
-         }
-       | abs_decl_param_list {
-               $$ = addfunc(aname(), $1);
-               popdecl();
-               blklev--;
-         }
-       | direct_abs_decl abs_decl_param_list {
-               $$ = addfunc($1, $2);
-               popdecl();
-               blklev--;
-         }
-       ;
-
-stmnt:
-         labeled_stmnt
-       | expr_stmnt
-       | comp_stmnt
-       | selection_stmnt
-       | iteration_stmnt
-       | jump_stmnt {
-               ftflg = 0;
-         }
-       | asm_stmnt
-       ;
-
-labeled_stmnt:
-         label stmnt
-       ;
-
-label:
-         identifier T_COLON {
-               symtyp = FLAB;
-               label(T_NAME, getsym($1), NULL);
-         }
-       | T_CASE constant T_COLON {
-               label(T_CASE, NULL, $2);
-               ftflg = 1;
-         }
-       | T_DEFAULT T_COLON {
-               label(T_DEFAULT, NULL, NULL);
-               ftflg = 1;
-         }
-       ;
-
-comp_stmnt:
-         compstmnt_lbrace declaration_list opt_stmnt_list compstmnt_rbrace
-       | compstmnt_lbrace opt_stmnt_list compstmnt_rbrace
-       ;
-
-compstmnt_lbrace:
-         T_LBRACE {
-               blklev++;
-               mblklev++;
-               pushdecl(AUTO);
-         }
-       ;
-
-compstmnt_rbrace:
-         T_RBRACE {
-               popdecl();
-               freeblk();
-               mblklev--;
-               blklev--;
-               ftflg = 0;
-         }
-       ;
-
-opt_stmnt_list:
-         /* empty */
-       | stmnt_list
-       ;
-
-stmnt_list:
-         stmnt {
-               clrwflgs();
-         }
-       | stmnt_list stmnt {
-               clrwflgs();
-         }
-       | stmnt_list error T_SEMI {
-               clrwflgs();
-         }
-       ;
-
-expr_stmnt:
-         expr T_SEMI {
-               expr($1, 0, 0);
-               ftflg = 0;
-         }
-       | T_SEMI {
-               ftflg = 0;
-         }
-       ;
-
-selection_stmnt:
-         if_without_else {
-               if2();
-               if3(0);
-         }
-       | if_without_else T_ELSE {
-               if2();
-         } stmnt {
-               if3(1);
-         }
-       | if_without_else T_ELSE error {
-               if3(0);
-         }
-       | switch_expr stmnt {
-               switch2();
-         }
-       | switch_expr error {
-               switch2();
-         }
-       ;
-
-if_without_else:
-         if_expr stmnt
-       | if_expr error
-       ;
-
-if_expr:
-         T_IF T_LPARN expr T_RPARN {
-               if1($3);
-               clrwflgs();
-         }
-       ;
-
-switch_expr:
-         T_SWITCH T_LPARN expr T_RPARN {
-               switch1($3);
-               clrwflgs();
-         }
-       ;
-
-iteration_stmnt:
-         while_expr stmnt {
-               while2();
-         }
-       | while_expr error {
-               while2();
-         }
-       | do stmnt do_while_expr {
-               do2($3);
-               ftflg = 0;
-         }
-       | do error {
-               do2(NULL);
-         }
-       | for_exprs stmnt {
-               for2();
-         }
-       | for_exprs error {
-               for2();
-         }
-       ;
-
-while_expr:
-         T_WHILE T_LPARN expr T_RPARN {
-               while1($3);
-               clrwflgs();
-         }
-       ;
-
-do:
-         T_DO {
-               do1();
-         }
-       ;
-
-do_while_expr:
-         T_WHILE T_LPARN expr T_RPARN T_SEMI {
-               $$ = $3;
-         }
-       ;
-
-for_exprs:
-         T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN {
-               for1($3, $5, $7);
-               clrwflgs();
-         }
-       ;
-
-opt_expr:
-         /* empty */ {
-               $$ = NULL;
-         }
-       | expr {
-               $$ = $1;
-         }
-       ;
-
-jump_stmnt:
-         goto identifier T_SEMI {
-               dogoto(getsym($2));
-         }
-       | goto error T_SEMI {
-               symtyp = FVFT;
-         }
-       | T_CONTINUE T_SEMI {
-               docont();
-         }
-       | T_BREAK T_SEMI {
-               dobreak();
-         }
-       | T_RETURN T_SEMI {
-               doreturn(NULL);
-         }
-       | T_RETURN expr T_SEMI {
-               doreturn($2);
-         }
-       ;
-
-goto:
-         T_GOTO {
-               symtyp = FLAB;
-         }
-       ;
-
-asm_stmnt:
-         T_ASM T_LPARN read_until_rparn T_SEMI {
-               setasm();
-         }
-       | T_ASM T_QUAL T_LPARN read_until_rparn T_SEMI {
-               setasm();
-         }
-       | T_ASM error
-       ;
-
-read_until_rparn:
-         /* empty */ {
-               ignuptorp();
-         }
-       ;
-
-declaration_list:
-         declaration {
-               clrwflgs();
-         }
-       | declaration_list declaration {
-               clrwflgs();
-         }
-       ;
-
-constant:
-         expr                          %prec T_COMMA {
-                 $$ = $1;
-         }
-       ;
-
-expr:
-         expr T_MULT expr {
-               $$ = build(MULT, $1, $3);
-         }
-       | expr T_DIVOP expr {
-               $$ = build($2, $1, $3);
-         }
-       | expr T_ADDOP expr {
-               $$ = build($2, $1, $3);
-         }
-       | expr T_SHFTOP expr {
-               $$ = build($2, $1, $3);
-         }
-       | expr T_RELOP expr {
-               $$ = build($2, $1, $3);
-         }
-       | expr T_EQOP expr {
-               $$ = build($2, $1, $3);
-         }
-       | expr T_AND expr {
-               $$ = build(AND, $1, $3);
-         }
-       | expr T_XOR expr {
-               $$ = build(XOR, $1, $3);
-         }
-       | expr T_OR expr {
-               $$ = build(OR, $1, $3);
-         }
-       | expr T_LOGAND expr {
-               $$ = build(LOGAND, $1, $3);
-         }
-       | expr T_LOGOR expr {
-               $$ = build(LOGOR, $1, $3);
-         }
-       | expr T_QUEST expr T_COLON expr {
-               $$ = build(QUEST, $1, build(COLON, $3, $5));
-         }
-       | expr T_ASSIGN expr {
-               $$ = build(ASSIGN, $1, $3);
-         }
-       | expr T_OPASS expr {
-               $$ = build($2, $1, $3);
-         }
-       | expr T_COMMA expr {
-               $$ = build(COMMA, $1, $3);
-         }
-       | term {
-               $$ = $1;
-         }
-       ;
-
-term:
-         T_NAME {
-               /* XXX realy neccessary? */
-               if (yychar < 0)
-                       yychar = yylex();
-               $$ = getnnode(getsym($1), yychar);
-         }
-       | string {
-               $$ = getsnode($1);
-         }
-       | T_CON {
-               $$ = getcnode(gettyp($1->v_tspec), $1);
-         }
-       | T_LPARN expr T_RPARN {
-               if ($2 != NULL)
-                       $2->tn_parn = 1;
-               $$ = $2;
-         }
-       | term T_INCDEC {
-               $$ = build($2 == INC ? INCAFT : DECAFT, $1, NULL);
-         }
-       | T_INCDEC term {
-               $$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL);
-         }
-       | T_MULT term {
-               $$ = build(STAR, $2, NULL);
-         }
-       | T_AND term {
-               $$ = build(AMPER, $2, NULL);
-         }
-       | T_UNOP term {
-               $$ = build($1, $2, NULL);
-         }
-       | T_ADDOP term {
-               if (tflag && $1 == PLUS) {
-                       /* unary + is illegal in traditional C */
-                       warning(100);
-               }
-               $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL);
-         }
-       | term T_LBRACK expr T_RBRACK {
-               $$ = build(STAR, build(PLUS, $1, $3), NULL);
-         }
-       | term T_LPARN T_RPARN {
-               $$ = funccall($1, NULL);
-         }
-       | term T_LPARN func_arg_list T_RPARN {
-               $$ = funccall($1, $3);
-         }
-       | term point_or_arrow T_NAME {
-               if ($1 != NULL) {
-                       sym_t   *msym;
-                       /* XXX strmemb should be integrated in build() */
-                       if ($2 == ARROW) {
-                               /* must to this before strmemb is called */
-                               $1 = cconv($1);
-                       }
-                       msym = strmemb($1, $2, getsym($3));
-                       $$ = build($2, $1, getnnode(msym, 0));
-               } else {
-                       $$ = NULL;
-               }
-         }
-       | T_SIZEOF term                                 %prec T_SIZEOF {
-               if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
-                       chkmisc($2, 0, 0, 0, 0, 0, 1);
-         }
-       | T_SIZEOF T_LPARN type_name T_RPARN            %prec T_SIZEOF {
-               $$ = bldszof($3);
-         }
-       | T_LPARN type_name T_RPARN term                %prec T_UNOP {
-               $$ = cast($4, $2);
-         }
-       ;
-
-string:
-         T_STRING {
-               $$ = $1;
-         }
-       | T_STRING string2 {
-               $$ = catstrg($1, $2);
-         }
-       ;
-
-string2:
-        T_STRING {
-               if (tflag) {
-                       /* concatenated strings are illegal in traditional C */
-                       warning(219);
-               }
-               $$ = $1;
-         }
-       | string2 T_STRING {
-               $$ = catstrg($1, $2);
-         }
-       ;
-
-func_arg_list:
-         expr                                          %prec T_COMMA {
-               $$ = funcarg(NULL, $1);
-         }
-       | func_arg_list T_COMMA expr {
-               $$ = funcarg($1, $3);
-         }
-       ;
-
-point_or_arrow:
-         T_STROP {
-               symtyp = FMOS;
-               $$ = $1;
-         }
-       ;
-
-identifier:
-         T_NAME {
-               $$ = $1;
-         }
-       | T_TYPENAME {
-               $$ = $1;
-         }
-       ;
-
-%%
-
-/* ARGSUSED */
-int
-yyerror(char *msg)
-{
-       error(249);
-       if (++sytxerr >= 5)
-               norecover();
-       return (0);
-}
-
-/*
- * Gets a node for a constant and returns the value of this constant
- * as integer.
- * Is the node not constant or too large for int or of type float,
- * a warning will be printed.
- *
- * toicon() should be used only inside declarations. If it is used in
- * expressions, it frees the memory used for the expression.
- */
-static int
-toicon(tnode_t *tn)
-{
-       int     i;
-       tspec_t t;
-       val_t   *v;
-
-       v = constant(tn);
-
-       /*
-        * Abstract declarations are used inside expression. To free
-        * the memory would be a fatal error.
-        */
-       if (dcs->d_ctx != ABSTRACT)
-               tfreeblk();
-
-       if ((t = v->v_tspec) == FLOAT || t == DOUBLE || t == LDOUBLE) {
-               i = (int)v->v_ldbl;
-               /* integral constant expression expected */
-               error(55);
-       } else {
-               i = (int)v->v_quad;
-               if (isutyp(t)) {
-                       if ((u_quad_t)v->v_quad > INT_MAX) {
-                               /* integral constant too large */
-                               warning(56);
-                       }
-               } else {
-#ifdef XXX_BROKEN_GCC
-                       if (v->v_quad > INT_MAX) {
-                               /* integral constant too large */
-                               warning(56);
-                       }
-                       else if (v->v_quad < INT_MIN) {
-                               /* integral constant too large */
-                               warning(56);
-                       }
-#else
-                       if (v->v_quad > INT_MAX || v->v_quad < INT_MIN) {
-                               /* integral constant too large */
-                               warning(56);
-                       }
-#endif
-               }
-       }
-       free(v);
-       return (i);
-}
-
-static void
-idecl(sym_t *decl, int initflg)
-{
-       initerr = 0;
-       initsym = decl;
-
-       switch (dcs->d_ctx) {
-       case EXTERN:
-               decl1ext(decl, initflg);
-               break;
-       case ARG:
-               (void)decl1arg(decl, initflg);
-               break;
-       case AUTO:
-               decl1loc(decl, initflg);
-               break;
-       default:
-               lerror("idecl()");
-       }
-
-       if (initflg && !initerr)
-               prepinit();
-}
-
-/*
- * Discard all input tokens up to and including the next
- * unmatched right paren
- */
-void
-ignuptorp(void)
-{
-       int     level;
-
-       if (yychar < 0)
-               yychar = yylex();
-       freeyyv(&yylval, yychar);
-
-       level = 1;
-       while (yychar != T_RPARN || --level > 0) {
-               if (yychar == T_LPARN) {
-                       level++;
-               } else if (yychar <= 0) {
-                       break;
-               }
-               freeyyv(&yylval, yychar = yylex());
-       }
-
-       yyclearin;
-}
diff --git a/usr.bin/xlint/lint1/decl.c b/usr.bin/xlint/lint1/decl.c
deleted file mode 100644 (file)
index 7354623..0000000
+++ /dev/null
@@ -1,3050 +0,0 @@
-/*     $NetBSD: decl.c,v 1.11 1995/10/02 17:34:16 jpo Exp $    */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * 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.6 2004/07/07 12:24:00 asmodai Exp $
- */
-
-#include <sys/param.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lint1.h"
-
-const  char *unnamed = "<unnamed>";
-
-/* contains various information and classification on types */
-ttab_t ttab[NTSPEC];
-
-/* shared type structures for arithmtic types and void */
-static type_t  *typetab;
-
-/* value of next enumerator during declaration of enum types */
-int    enumval;
-
-/*
- * pointer to top element of a stack which contains informations local
- * to nested declarations
- */
-dinfo_t        *dcs;
-
-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(void)
-{
-       int     i;
-       static  struct {
-               tspec_t it_tspec;
-               ttab_t  it_ttab;
-       } ittab[] = {
-               { SIGNED,   { 0, 0,
-                             SIGNED, UNSIGN,
-                             0, 0, 0, 0, 0, "signed" } },
-               { UNSIGN,   { 0, 0,
-                             SIGNED, UNSIGN,
-                             0, 0, 0, 0, 0, "unsigned" } },
-               { CHAR,     { CHAR_BIT, CHAR_BIT,
-                             SCHAR, UCHAR,
-                             1, 0, 0, 1, 1, "char" } },
-               { SCHAR,    { CHAR_BIT, CHAR_BIT,
-                             SCHAR, UCHAR,
-                             1, 0, 0, 1, 1, "signed char" } },
-               { UCHAR,    { CHAR_BIT, CHAR_BIT,
-                             SCHAR, UCHAR,
-                             1, 1, 0, 1, 1, "unsigned char" } },
-               { SHORT,    { sizeof (short) * CHAR_BIT, 2 * CHAR_BIT,
-                             SHORT, USHORT,
-                             1, 0, 0, 1, 1, "short" } },
-               { USHORT,   { sizeof (u_short) * CHAR_BIT, 2 * CHAR_BIT,
-                             SHORT, USHORT,
-                             1, 1, 0, 1, 1, "unsigned short" } },
-               { INT,      { sizeof (int) * CHAR_BIT, 3 * CHAR_BIT,
-                             INT, UINT,
-                             1, 0, 0, 1, 1, "int" } },
-               { UINT,     { sizeof (u_int) * CHAR_BIT, 3 * CHAR_BIT,
-                             INT, UINT,
-                             1, 1, 0, 1, 1, "unsigned int" } },
-               { LONG,     { sizeof (long) * CHAR_BIT, 4 * CHAR_BIT,
-                             LONG, ULONG,
-                             1, 0, 0, 1, 1, "long" } },
-               { ULONG,    { sizeof (u_long) * CHAR_BIT, 4 * CHAR_BIT,
-                             LONG, ULONG,
-                             1, 1, 0, 1, 1, "unsigned long" } },
-               { QUAD,     { sizeof (quad_t) * CHAR_BIT, 8 * CHAR_BIT,
-                             QUAD, UQUAD,
-                             1, 0, 0, 1, 1, "long long" } },
-               { UQUAD,    { sizeof (u_quad_t) * CHAR_BIT, 8 * CHAR_BIT,
-                             QUAD, UQUAD,
-                             1, 1, 0, 1, 1, "unsigned long long" } },
-               { FLOAT,    { sizeof (float) * CHAR_BIT, 4 * CHAR_BIT,
-                             FLOAT, FLOAT,
-                             0, 0, 1, 1, 1, "float" } },
-               { DOUBLE,   { sizeof (double) * CHAR_BIT, 8 * CHAR_BIT,
-                             DOUBLE, DOUBLE,
-                             0, 0, 1, 1, 1, "double" } },
-               { LDOUBLE,  { sizeof (ldbl_t) * CHAR_BIT, 10 * CHAR_BIT,
-                             LDOUBLE, LDOUBLE,
-                             0, 0, 1, 1, 1, "long double" } },
-               { VOID,     { -1, -1,
-                             VOID, VOID,
-                             0, 0, 0, 0, 0, "void" } },
-               { STRUCT,   { -1, -1,
-                             STRUCT, STRUCT,
-                             0, 0, 0, 0, 0, "struct" } },
-               { UNION,    { -1, -1,
-                             UNION, UNION,
-                             0, 0, 0, 0, 0, "union" } },
-               { ENUM,     { sizeof (int) * CHAR_BIT, 3 * CHAR_BIT,
-                             ENUM, ENUM,
-                             1, 0, 0, 1, 1, "enum" } },
-               { PTR,      { sizeof (void *) * CHAR_BIT, 4 * CHAR_BIT,
-                             PTR, PTR,
-                             0, 1, 0, 0, 1, "pointer" } },
-               { ARRAY,    { -1, -1,
-                             ARRAY, ARRAY,
-                             0, 0, 0, 0, 0, "array" } },
-               { FUNC,     { -1, -1,
-                             FUNC, FUNC,
-                             0, 0, 0, 0, 0, "function" } },
-       };
-
-       /* declaration stack */
-       dcs = xcalloc(1, sizeof (dinfo_t));
-       dcs->d_ctx = EXTERN;
-       dcs->d_ldlsym = &dcs->d_dlsyms;
-
-       /* type information and classification */
-       for (i = 0; i < sizeof (ittab) / sizeof (ittab[0]); i++)
-               STRUCT_ASSIGN(ttab[ittab[i].it_tspec], ittab[i].it_ttab);
-       if (!pflag) {
-               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++)
-               typetab[i].t_tspec = NOTSPEC;
-       typetab[CHAR].t_tspec = CHAR;
-       typetab[SCHAR].t_tspec = SCHAR;
-       typetab[UCHAR].t_tspec = UCHAR;
-       typetab[SHORT].t_tspec = SHORT;
-       typetab[USHORT].t_tspec = USHORT;
-       typetab[INT].t_tspec = INT;
-       typetab[UINT].t_tspec = UINT;
-       typetab[LONG].t_tspec = LONG;
-       typetab[ULONG].t_tspec = ULONG;
-       typetab[QUAD].t_tspec = QUAD;
-       typetab[UQUAD].t_tspec = UQUAD;
-       typetab[FLOAT].t_tspec = FLOAT;
-       typetab[DOUBLE].t_tspec = DOUBLE;
-       typetab[LDOUBLE].t_tspec = LDOUBLE;
-       typetab[VOID].t_tspec = VOID;
-       /*
-        * Next two are not real types. They are only used by the parser
-        * to return keywords "signed" and "unsigned"
-        */
-       typetab[SIGNED].t_tspec = SIGNED;
-       typetab[UNSIGN].t_tspec = UNSIGN;
-}
-
-/*
- * Returns a shared type structure vor arithmetic types and void.
- *
- * It's important do duplicate this structure (using duptyp() or tdupdyp())
- * if it is to be modified (adding qualifiers or anything else).
- */
-type_t *
-gettyp(tspec_t t)
-{
-       return (&typetab[t]);
-}
-
-type_t *
-duptyp(const type_t *tp)
-{
-       type_t  *ntp;
-
-       ntp = getblk(sizeof (type_t));
-       STRUCT_ASSIGN(*ntp, *tp);
-       return (ntp);
-}
-
-/*
- * Use tduptyp() instead of duptyp() inside expressions (if the
- * allocated memory should be freed after the expr).
- */
-type_t *
-tduptyp(const type_t *tp)
-{
-       type_t  *ntp;
-
-       ntp = tgetblk(sizeof (type_t));
-       STRUCT_ASSIGN(*ntp, *tp);
-       return (ntp);
-}
-
-/*
- * Returns 1 if the argument is void or an incomplete array,
- * struct, union or enum type.
- */
-int
-incompl(type_t *tp)
-{
-       tspec_t t;
-
-       if ((t = tp->t_tspec) == VOID) {
-               return (1);
-       } else if (t == ARRAY) {
-               return (tp->t_aincompl);
-       } else if (t == STRUCT || t == UNION) {
-               return (tp->t_str->sincompl);
-       } else if (t == ENUM) {
-               return (tp->t_enum->eincompl);
-       }
-       return (0);
-}
-
-/*
- * Set the flag for (in)complete array, struct, union or enum
- * types.
- */
-void
-setcompl(type_t *tp, int ic)
-{
-       tspec_t t;
-
-       if ((t = tp->t_tspec) == ARRAY) {
-               tp->t_aincompl = ic;
-       } else if (t == STRUCT || t == UNION) {
-               tp->t_str->sincompl = ic;
-       } else {
-               if (t != ENUM)
-                       lerror("setcompl() 1");
-               tp->t_enum->eincompl = ic;
-       }
-}
-
-/*
- * Remember the storage class of the current declaration in dcs->d_scl
- * (the top element of the declaration stack) and detect multiple
- * storage classes.
- */
-void
-addscl(scl_t sc)
-{
-       if (sc == INLINE) {
-               if (dcs->d_inline)
-                       /* duplicate '%s' */
-                       warning(10, "inline");
-               dcs->d_inline = 1;
-               return;
-       }
-       if (dcs->d_type != NULL || dcs->d_atyp != NOTSPEC ||
-           dcs->d_smod != NOTSPEC || dcs->d_lmod != NOTSPEC) {
-               /* storage class after type is obsolescent */
-               warning(83);
-       }
-       if (dcs->d_scl == NOSCL) {
-               dcs->d_scl = sc;
-       } else {
-               /*
-                * multiple storage classes. An error will be reported in
-                * deftyp().
-                */
-               dcs->d_mscl = 1;
-       }
-}
-
-/*
- * Remember the type, modifier or typedef name returned by the parser
- * in *dcs (top element of decl stack). This information is used in
- * deftyp() to build the type used for all declarators in this
- * declaration.
- *
- * Is tp->t_typedef 1, the type comes from a previously defined typename.
- * Otherwise it comes from a type specifier (int, long, ...) or a
- * struct/union/enum tag.
- */
-void
-addtype(type_t *tp)
-{
-       tspec_t t;
-
-       if (tp->t_typedef) {
-               if (dcs->d_type != NULL || dcs->d_atyp != NOTSPEC ||
-                   dcs->d_lmod != NOTSPEC || dcs->d_smod != NOTSPEC) {
-                       /*
-                        * something like "typedef int a; int a b;"
-                        * This should not happen with current grammar.
-                        */
-                       lerror("addtype()");
-               }
-               dcs->d_type = tp;
-               return;
-       }
-
-       t = tp->t_tspec;
-
-       if (t == STRUCT || t == UNION || t == ENUM) {
-               /*
-                * something like "int struct a ..."
-                * struct/union/enum with anything else is not allowed
-                */
-               if (dcs->d_type != NULL || dcs->d_atyp != NOTSPEC ||
-                   dcs->d_lmod != NOTSPEC || dcs->d_smod != NOTSPEC) {
-                       /*
-                        * remember that an error must be reported in
-                        * deftyp().
-                        */
-                       dcs->d_terr = 1;
-                       dcs->d_atyp = dcs->d_lmod = dcs->d_smod = NOTSPEC;
-               }
-               dcs->d_type = tp;
-               return;
-       }
-
-       if (dcs->d_type != NULL && !dcs->d_type->t_typedef) {
-               /*
-                * something like "struct a int"
-                * struct/union/enum with anything else is not allowed
-                */
-               dcs->d_terr = 1;
-               return;
-       }
-
-       if (t == LONG && dcs->d_lmod == LONG) {
-               /* "long long" or "long ... long" */
-               t = QUAD;
-               dcs->d_lmod = NOTSPEC;
-               if (!quadflg)
-                       /* %s C does not support 'long long' */
-                       (void)gnuism(265, tflag ? "traditional" : "ANSI");
-       }
-
-       if (dcs->d_type != NULL && dcs->d_type->t_typedef) {
-               /* something like "typedef int a; a long ..." */
-               dcs->d_type = tdeferr(dcs->d_type, t);
-               return;
-       }
-
-       /* now it can be only a combination of arithmetic types and void */
-       if (t == SIGNED || t == UNSIGN) {
-               /* remeber specifiers "signed" and "unsigned" in dcs->d_smod */
-               if (dcs->d_smod != NOTSPEC)
-                       /*
-                        * more then one "signed" and/or "unsigned"; print
-                        * an error in deftyp()
-                        */
-                       dcs->d_terr = 1;
-               dcs->d_smod = t;
-       } else if (t == SHORT || t == LONG || t == QUAD) {
-               /*
-                * remember specifiers "short", "long" and "long long" in
-                * dcs->d_lmod
-                */
-               if (dcs->d_lmod != NOTSPEC)
-                       /* more than one, print error in deftyp() */
-                       dcs->d_terr = 1;
-               dcs->d_lmod = t;
-       } else {
-               /*
-                * remember specifiers "void", "char", "int", "float" or
-                * "double" int dcs->d_atyp
-                */
-               if (dcs->d_atyp != NOTSPEC)
-                       /* more than one, print error in deftyp() */
-                       dcs->d_terr = 1;
-               dcs->d_atyp = t;
-       }
-}
-
-/*
- * called if a list of declaration specifiers contains a typedef name
- * and other specifiers (except struct, union, enum, typedef name)
- */
-static type_t *
-tdeferr(type_t *td, tspec_t t)
-{
-       tspec_t t2;
-
-       t2 = td->t_tspec;
-
-       switch (t) {
-       case SIGNED:
-       case UNSIGN:
-               if (t2 == CHAR || t2 == SHORT || t2 == INT || t2 == LONG ||
-                   t2 == QUAD) {
-                       if (!tflag)
-                               /* modifying typedef with ... */
-                               warning(5, ttab[t].tt_name);
-                       td = duptyp(gettyp(mrgtspec(t2, t)));
-                       td->t_typedef = 1;
-                       return (td);
-               }
-               break;
-       case SHORT:
-               if (t2 == INT || t2 == UINT) {
-                       /* modifying typedef with ... */
-                       warning(5, "short");
-                       td = duptyp(gettyp(t2 == INT ? SHORT : USHORT));
-                       td->t_typedef = 1;
-                       return (td);
-               }
-               break;
-       case LONG:
-               if (t2 == INT || t2 == UINT || t2 == LONG || t2 == ULONG ||
-                   t2 == FLOAT || t2 == DOUBLE) {
-                       /* modifying typedef with ... */
-                       warning(5, "long");
-                       if (t2 == INT) {
-                               td = gettyp(LONG);
-                       } else if (t2 == UINT) {
-                               td = gettyp(ULONG);
-                       } else if (t2 == LONG) {
-                               td = gettyp(QUAD);
-                       } else if (t2 == ULONG) {
-                               td = gettyp(UQUAD);
-                       } else if (t2 == FLOAT) {
-                               td = gettyp(DOUBLE);
-                       } else if (t2 == DOUBLE) {
-                               td = gettyp(LDOUBLE);
-                       }
-                       td = duptyp(td);
-                       td->t_typedef = 1;
-                       return (td);
-               }
-               break;
-               /* LINTED (enumeration values not handled in switch) */
-       default:
-               break;
-       }
-
-       /* Anything other is not accepted. */
-
-       dcs->d_terr = 1;
-       return (td);
-}
-
-/*
- * Remember the symbol of a typedef name (2nd arg) in a struct, union
- * or enum tag if the typedef name is the first defined for this tag.
- *
- * If the tag is unnamed, the typdef name is used for identification
- * of this tag in lint2. Although its possible that more then one typedef
- * name is defined for one tag, the first name defined should be unique
- * if the tag is unnamed.
- */
-static void
-settdsym(type_t *tp, sym_t *sym)
-{
-       tspec_t t;
-
-       if ((t = tp->t_tspec) == STRUCT || t == UNION) {
-               if (tp->t_str->stdef == NULL)
-                       tp->t_str->stdef = sym;
-       } else if (t == ENUM) {
-               if (tp->t_enum->etdef == NULL)
-                       tp->t_enum->etdef = sym;
-       }
-}
-
-/*
- * Remember a qualifier which is part of the declaration specifiers
- * (and not the declarator) in the top element of the declaration stack.
- * Also detect multiple qualifiers of the same kind.
-
- * The rememberd qualifier is used by deftyp() to construct the type
- * for all declarators.
- */
-void
-addqual(tqual_t q)
-{
-       if (q == CONST) {
-               if (dcs->d_const) {
-                       /* duplicate "%s" */
-                       warning(10, "const");
-               }
-               dcs->d_const = 1;
-       } else {
-               if (q != VOLATILE)
-                       lerror("addqual() 1");
-               if (dcs->d_volatile) {
-                       /* duplicate "%s" */
-                       warning(10, "volatile");
-               }
-               dcs->d_volatile = 1;
-       }
-}
-
-/*
- * Go to the next declaration level (structs, nested structs, blocks,
- * argument declaration lists ...)
- */
-void
-pushdecl(scl_t sc)
-{
-       dinfo_t *di;
-
-       if (dflag)
-               (void)printf("pushdecl(%d)\n", (int)sc);
-
-       /* put a new element on the declaration stack */
-       di = xcalloc(1, sizeof (dinfo_t));
-       di->d_nxt = dcs;
-       dcs = di;
-       di->d_ctx = sc;
-       di->d_ldlsym = &di->d_dlsyms;
-}
-
-/*
- * Go back to previous declaration level
- */
-void
-popdecl(void)
-{
-       dinfo_t *di;
-
-       if (dflag)
-               (void)printf("popdecl(%d)\n", (int)dcs->d_ctx);
-
-       if (dcs->d_nxt == NULL)
-               lerror("popdecl() 1");
-       di = dcs;
-       dcs = di->d_nxt;
-       switch (di->d_ctx) {
-       case EXTERN:
-               /* there is nothing after external declarations */
-               lerror("popdecl() 2");
-               /* NOTREACHED */
-       case MOS:
-       case MOU:
-       case ENUMCON:
-               /*
-                * Symbols declared in (nested) structs or enums are
-                * part of the next level (they are removed from the
-                * symbol table if the symbols of the outher level are
-                * removed)
-                */
-               if ((*dcs->d_ldlsym = di->d_dlsyms) != NULL)
-                       dcs->d_ldlsym = di->d_ldlsym;
-               break;
-       case ARG:
-               /*
-                * All symbols in dcs->d_dlsyms are introduced in old style
-                * argument declarations (it's not clean, but possible).
-                * They are appended to the list of symbols declared in
-                * an old style argument identifier list or a new style
-                * parameter type list.
-                */
-               if (di->d_dlsyms != NULL) {
-                       *di->d_ldlsym = dcs->d_fpsyms;
-                       dcs->d_fpsyms = di->d_dlsyms;
-               }
-               break;
-       case ABSTRACT:
-               /*
-                * casts and sizeof
-                * Append all symbols declared in the abstract declaration
-                * to the list of symbols declared in the surounding decl.
-                * or block.
-                * XXX I'm not sure whether they should be removed from the
-                * symbol table now or later.
-                */
-               if ((*dcs->d_ldlsym = di->d_dlsyms) != NULL)
-                       dcs->d_ldlsym = di->d_ldlsym;
-               break;
-       case AUTO:
-               /* check usage of local vars */
-               chkusage(di);
-               /* FALLTHROUGH */
-       case PARG:
-               /* usage of arguments will be checked by funcend() */
-               rmsyms(di->d_dlsyms);
-               break;
-       default:
-               lerror("popdecl() 3");
-       }
-       free(di);
-}
-
-/*
- * Set flag d_asm in all declaration stack elements up to the
- * outermost one.
- *
- * This is used to mark compound statements which have, possibly in
- * nested compound statements, asm statements. For these compound
- * statements no warnings about unused or unitialized variables are
- * printed.
- *
- * There is no need to clear d_asm in dinfo structs with context AUTO,
- * because these structs are freed at the end of the compound statement.
- * But it must be cleard in the outermost dinfo struct, which has
- * context EXTERN. This could be done in clrtyp() and would work for
- * C, but not for C++ (due to mixed statements and declarations). Thus
- * we clear it in glclup(), which is used to do some cleanup after
- * global declarations/definitions.
- */
-void
-setasm(void)
-{
-       dinfo_t *di;
-
-       for (di = dcs; di != NULL; di = di->d_nxt)
-               di->d_asm = 1;
-}
-
-/*
- * Clean all elements of the top element of declaration stack which
- * will be used by the next declaration
- */
-void
-clrtyp(void)
-{
-       dcs->d_atyp = dcs->d_smod = dcs->d_lmod = NOTSPEC;
-       dcs->d_scl = NOSCL;
-       dcs->d_type = NULL;
-       dcs->d_const = dcs->d_volatile = 0;
-       dcs->d_inline = 0;
-       dcs->d_mscl = dcs->d_terr = 0;
-       dcs->d_nedecl = 0;
-       dcs->d_notyp = 0;
-}
-
-/*
- * Create a type structure from the informations gathered in
- * the declaration stack.
- * Complain about storage classes which are not possible in current
- * context.
- */
-void
-deftyp(void)
-{
-       tspec_t t, s, l;
-       type_t  *tp;
-       scl_t   scl;
-
-       t = dcs->d_atyp;                /* CHAR, INT, FLOAT, DOUBLE, VOID */
-       s = dcs->d_smod;                /* SIGNED, UNSIGNED */
-       l = dcs->d_lmod;                /* SHORT, LONG, QUAD */
-       tp = dcs->d_type;
-       scl = dcs->d_scl;
-
-       if (t == NOTSPEC && s == NOTSPEC && l == NOTSPEC && tp == NULL)
-               dcs->d_notyp = 1;
-
-       if (tp != NULL && (t != NOTSPEC || s != NOTSPEC || l != NOTSPEC)) {
-               /* should never happen */
-               lerror("deftyp() 1");
-       }
-
-       if (tp == NULL) {
-               switch (t) {
-               case NOTSPEC:
-                       t = INT;
-                       /* FALLTHROUGH */
-               case INT:
-                       if (s == NOTSPEC)
-                               s = SIGNED;
-                       break;
-               case CHAR:
-                       if (l != NOTSPEC) {
-                               dcs->d_terr = 1;
-                               l = NOTSPEC;
-                       }
-                       break;
-               case FLOAT:
-                       if (l == LONG) {
-                               l = NOTSPEC;
-                               t = DOUBLE;
-                               if (!tflag)
-                                       /* use 'double' instead of ...  */
-                                       warning(6);
-                       }
-                       break;
-               case DOUBLE:
-                       if (l == LONG) {
-                               l = NOTSPEC;
-                               t = LDOUBLE;
-                               if (tflag)
-                                       /* 'long double' is illegal in ... */
-                                       warning(266);
-                       }
-                       break;
-               case VOID:
-                       break;
-               default:
-                       lerror("deftyp() 2");
-               }
-               if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
-                       dcs->d_terr = 1;
-                       l = s = NOTSPEC;
-               }
-               if (l != NOTSPEC)
-                       t = l;
-               dcs->d_type = gettyp(mrgtspec(t, s));
-       }
-
-       if (dcs->d_mscl) {
-               /* only one storage class allowed */
-               error(7);
-       }
-       if (dcs->d_terr) {
-               /* illegal type combination */
-               error(4);
-       }
-
-       if (dcs->d_ctx == EXTERN) {
-               if (scl == REG || scl == AUTO) {
-                       /* illegal storage class */
-                       error(8);
-                       scl = NOSCL;
-               }
-       } else if (dcs->d_ctx == ARG || dcs->d_ctx == PARG) {
-               if (scl != NOSCL && scl != REG) {
-                       /* only "register" valid ... */
-                       error(9);
-                       scl = NOSCL;
-               }
-       }
-
-       dcs->d_scl = scl;
-
-       if (dcs->d_const && dcs->d_type->t_const) {
-               if (!dcs->d_type->t_typedef)
-                       lerror("deftyp() 3");
-               /* typedef already qualified with "%s" */
-               warning(68, "const");
-       }
-       if (dcs->d_volatile && dcs->d_type->t_volatile) {
-               if (!dcs->d_type->t_typedef)
-                       lerror("deftyp() 4");
-               /* typedef already qualified with "%s" */
-               warning(68, "volatile");
-       }
-
-       if (dcs->d_const || dcs->d_volatile) {
-               dcs->d_type = duptyp(dcs->d_type);
-               dcs->d_type->t_const |= dcs->d_const;
-               dcs->d_type->t_volatile |= dcs->d_volatile;
-       }
-}
-
-/*
- * Merge type specifiers (char, ..., long long, signed, unsigned).
- */
-static tspec_t
-mrgtspec(tspec_t t, tspec_t s)
-{
-       if (s == SIGNED || s == UNSIGN) {
-               if (t == CHAR) {
-                       t = s == SIGNED ? SCHAR : UCHAR;
-               } else if (t == SHORT) {
-                       t = s == SIGNED ? SHORT : USHORT;
-               } else if (t == INT) {
-                       t = s == SIGNED ? INT : UINT;
-               } else if (t == LONG) {
-                       t = s == SIGNED ? LONG : ULONG;
-               } else if (t == QUAD) {
-                       t = s == SIGNED ? QUAD : UQUAD;
-               }
-       }
-
-       return (t);
-}
-
-/*
- * Return the length of a type in bit.
- *
- * Printing a message if the outhermost dimension of an array is 0 must
- * be done by the caller. All other problems are reported by length()
- * if name is not NULL.
- */
-int
-length(type_t *tp, const char *name)
-{
-       int     elem, elsz;
-
-       elem = 1;
-       while (tp->t_tspec == ARRAY) {
-               elem *= tp->t_dim;
-               tp = tp->t_subt;
-       }
-       switch (tp->t_tspec) {
-       case FUNC:
-               /* compiler takes size of function */
-               lerror("%s", msgs[12]);
-               /* NOTREACHED */
-       case STRUCT:
-       case UNION:
-               if (incompl(tp) && name != NULL) {
-                       /* incomplete structure or union %s: %s */
-                       error(31, tp->t_str->stag->s_name, name);
-               }
-               elsz = tp->t_str->size;
-               break;
-       case ENUM:
-               if (incompl(tp) && name != NULL) {
-                       /* incomplete enum type: %s */
-                       warning(13, name);
-               }
-               /* FALLTHROUGH */
-       default:
-               elsz = size(tp->t_tspec);
-               if (elsz <= 0)
-                       lerror("length()");
-               break;
-       }
-       return (elem * elsz);
-}
-
-/*
- * Get the alignment of the given Type in bits.
- */
-int
-getbound(type_t *tp)
-{
-       int     a;
-       tspec_t t;
-
-       while (tp->t_tspec == ARRAY)
-               tp = tp->t_subt;
-
-       if ((t = tp->t_tspec) == STRUCT || t == UNION) {
-               a = tp->t_str->align;
-       } else if (t == FUNC) {
-               /* compiler takes alignment of function */
-               error(14);
-               a = ALIGN(1) * CHAR_BIT;
-       } else {
-               if ((a = size(t)) == 0) {
-                       a = CHAR_BIT;
-               } else if (a > ALIGN(1) * CHAR_BIT) {
-                       a = ALIGN(1) * CHAR_BIT;
-               }
-       }
-       if (a < CHAR_BIT || a > ALIGN(1) * CHAR_BIT)
-               lerror("getbound() 1");
-       return (a);
-}
-
-/*
- * Concatenate two lists of symbols by s_nxt. Used by declarations of
- * struct/union/enum elements and parameters.
- */
-sym_t *
-lnklst(sym_t *l1, sym_t *l2)
-{
-       sym_t   *l;
-
-       if ((l = l1) == NULL)
-               return (l2);
-       while (l1->s_nxt != NULL)
-               l1 = l1->s_nxt;
-       l1->s_nxt = l2;
-       return (l);
-}
-
-/*
- * Check if the type of the given symbol is valid and print an error
- * message if it is not.
- *
- * Invalid types are:
- * - arrays of incomlete types or functions
- * - functions returning arrays or functions
- * - void types other than type of function or pointer
- */
-void
-chktyp(sym_t *sym)
-{
-       tspec_t to, t;
-       type_t  **tpp, *tp;
-
-       tpp = &sym->s_type;
-       to = NOTSPEC;
-       while ((tp = *tpp) != NULL) {
-               t = tp->t_tspec;
-               /*
-                * If this is the type of an old style function definition,
-                * a better warning is printed in funcdef().
-                */
-               if (t == FUNC && !tp->t_proto &&
-                   !(to == NOTSPEC && sym->s_osdef)) {
-                       if (sflag && hflag)
-                               /* function declaration is not a prototype */
-                               warning(287);
-               }
-               if (to == FUNC) {
-                       if (t == FUNC || t == ARRAY) {
-                               /* function returns illegal type */
-                               error(15);
-                               if (t == FUNC) {
-                                       *tpp = incref(*tpp, PTR);
-                               } else {
-                                       *tpp = incref((*tpp)->t_subt, PTR);
-                               }
-                               return;
-                       } else if (tp->t_const || tp->t_volatile) {
-                               if (sflag) {    /* XXX oder better !tflag ? */
-                                       /* function cannot return const... */
-                                       warning(228);
-                               }
-                       }
-               } if (to == ARRAY) {
-                       if (t == FUNC) {
-                               /* array of function is illegal */
-                               error(16);
-                               *tpp = gettyp(INT);
-                               return;
-                       } else if (t == ARRAY && tp->t_dim == 0) {
-                               /* null dimension */
-                               error(17);
-                               return;
-                       } else if (t == VOID) {
-                               /* illegal use of void */
-                               error(18);
-                               *tpp = gettyp(INT);
-#if 0  /* errors are produced by length() */
-                       } else if (incompl(tp)) {
-                               /* array of incomplete type */
-                               if (sflag) {
-                                       error(301);
-                               } else {
-                                       warning(301);
-                               }
-#endif
-                       }
-               } else if (to == NOTSPEC && t == VOID) {
-                       if (dcs->d_ctx == PARG) {
-                               if (sym->s_scl != ABSTRACT) {
-                                       if (sym->s_name == unnamed)
-                                               lerror("chktyp()");
-                                       /* void param cannot have name: %s */
-                                       error(61, sym->s_name);
-                                       *tpp = gettyp(INT);
-                               }
-                       } else if (dcs->d_ctx == ABSTRACT) {
-                               /* ok */
-                       } else if (sym->s_scl != TYPEDEF) {
-                               /* void type for %s */
-                               error(19, sym->s_name);
-                               *tpp = gettyp(INT);
-                       }
-               }
-               if (t == VOID && to != PTR) {
-                       if (tp->t_const || tp->t_volatile) {
-                               /* inappropriate qualifiers with "void" */
-                               warning(69);
-                               tp->t_const = tp->t_volatile = 0;
-                       }
-               }
-               tpp = &tp->t_subt;
-               to = t;
-       }
-}
-
-/*
- * Process the declarator of a struct/union element.
- */
-sym_t *
-decl1str(sym_t *dsym)
-{
-       type_t  *tp;
-       tspec_t t;
-       int     sz, o, len;
-       scl_t   sc;
-
-       if ((sc = dsym->s_scl) != MOS && sc != MOU)
-               lerror("decl1str() 1");
-
-       if (dcs->d_rdcsym != NULL) {
-               if ((sc = dcs->d_rdcsym->s_scl) != MOS && sc != MOU)
-                       /* should be ensured by storesym() */
-                       lerror("decl1str() 2");
-               if (dsym->s_styp == dcs->d_rdcsym->s_styp) {
-                       /* duplicate member name: %s */
-                       error(33, dsym->s_name);
-                       rmsym(dcs->d_rdcsym);
-               }
-       }
-
-       chktyp(dsym);
-
-       t = (tp = dsym->s_type)->t_tspec;
-
-       if (dsym->s_field) {
-               /*
-                * bit field
-                *
-                * only unsigned und signed int are protable bit-field types
-                *(at least in ANSI C, in traditional C only unsigned int)
-                */
-               if (t == CHAR || t == UCHAR || t == SCHAR ||
-                   t == SHORT || t == USHORT || t == ENUM) {
-                       if (sflag) {
-                               /* bit-field type '%s' invalid in ANSI C */
-                               warning(273, tyname(tp));
-                       } else if (pflag) {
-                               /* nonportable bit-field type */
-                               warning(34);
-                       }
-               } else if (t == INT && dcs->d_smod == NOTSPEC) {
-                       if (pflag) {
-                               /* nonportable bit-field type */
-                               warning(34);
-                       }
-               } else if (t != INT && t != UINT) {
-                       /* illegal bit-field type */
-                       error(35);
-                       sz = tp->t_flen;
-                       dsym->s_type = tp = duptyp(gettyp(t = INT));
-                       if ((tp->t_flen = sz) > size(t))
-                               tp->t_flen = size(t);
-               }
-               if ((len = tp->t_flen) < 0 || len > size(t)) {
-                       /* illegal bit-field size */
-                       error(36);
-                       tp->t_flen = size(t);
-               } else if (len == 0 && dsym->s_name != unnamed) {
-                       /* zero size bit-field */
-                       error(37);
-                       tp->t_flen = size(t);
-               }
-               if (dsym->s_scl == MOU) {
-                       /* illegal use of bit-field */
-                       error(41);
-                       dsym->s_type->t_isfield = 0;
-                       dsym->s_field = 0;
-               }
-       } else if (t == FUNC) {
-               /* function illegal in structure or union */
-               error(38);
-               dsym->s_type = tp = incref(tp, t = PTR);
-       }
-
-       /*
-        * bit-fields of length 0 are not warned about because length()
-        * does not return the length of the bit-field but the length
-        * of the type the bit-field is packed in (its ok)
-        */
-       if ((sz = length(dsym->s_type, dsym->s_name)) == 0) {
-               if (t == ARRAY && dsym->s_type->t_dim == 0) {
-                       /* illegal zero sized structure member: %s */
-                       warning(39, dsym->s_name);
-               }
-       }
-
-       if (dcs->d_ctx == MOU) {
-               o = dcs->d_offset;
-               dcs->d_offset = 0;
-       }
-       if (dsym->s_field) {
-               align(getbound(tp), tp->t_flen);
-               dsym->s_value.v_quad = (dcs->d_offset / size(t)) * size(t);
-               tp->t_foffs = dcs->d_offset - (int)dsym->s_value.v_quad;
-               dcs->d_offset += tp->t_flen;
-       } else {
-               align(getbound(tp), 0);
-               dsym->s_value.v_quad = dcs->d_offset;
-               dcs->d_offset += sz;
-       }
-       if (dcs->d_ctx == MOU) {
-               if (o > dcs->d_offset)
-                       dcs->d_offset = o;
-       }
-
-       chkfdef(dsym, 0);
-
-       return (dsym);
-}
-
-/*
- * Aligns next structure element as required.
- *
- * al contains the required alignment, len the length of a bit-field.
- */
-static void
-align(int al, int len)
-{
-       int     no;
-
-       /*
-        * The alignment of the current element becomes the alignment of
-        * the struct/union if it is larger than the current alignment
-        * of the struct/union.
-        */
-       if (al > dcs->d_stralign)
-               dcs->d_stralign = al;
-
-       no = (dcs->d_offset + (al - 1)) & ~(al - 1);
-       if (len == 0 || dcs->d_offset + len > no)
-               dcs->d_offset = no;
-}
-
-/*
- * Remember the width of the field in its type structure.
- */
-sym_t *
-bitfield(sym_t *dsym, int len)
-{
-       if (dsym == NULL) {
-               dsym = getblk(sizeof (sym_t));
-               dsym->s_name = unnamed;
-               dsym->s_kind = FMOS;
-               dsym->s_scl = MOS;
-               dsym->s_type = gettyp(INT);
-               dsym->s_blklev = -1;
-       }
-       dsym->s_type = duptyp(dsym->s_type);
-       dsym->s_type->t_isfield = 1;
-       dsym->s_type->t_flen = len;
-       dsym->s_field = 1;
-       return (dsym);
-}
-
-/*
- * Collect informations about a sequence of asterisks and qualifiers
- * in a list of type pqinf_t.
- * Qualifiers refer always to the left asterisk. The rightmost asterisk
- * will be at the top of the list.
- */
-pqinf_t *
-mergepq(pqinf_t *p1, pqinf_t *p2)
-{
-       pqinf_t *p;
-
-       if (p2->p_pcnt != 0) {
-               /* left '*' at the end of the list */
-               for (p = p2; p->p_nxt != NULL; p = p->p_nxt) ;
-               p->p_nxt = p1;
-               return (p2);
-       } else {
-               if (p2->p_const) {
-                       if (p1->p_const) {
-                               /* duplicate %s */
-                               warning(10, "const");
-                       }
-                       p1->p_const = 1;
-               }
-               if (p2->p_volatile) {
-                       if (p1->p_volatile) {
-                               /* duplicate %s */
-                               warning(10, "volatile");
-                       }
-                       p1->p_volatile = 1;
-               }
-               free(p2);
-               return (p1);
-       }
-}
-
-/*
- * Followint 3 functions extend the type of a declarator with
- * pointer, function and array types.
- *
- * The current type is the Type built by deftyp() (dcs->d_type) and
- * pointer, function and array types already added for this
- * declarator. The new type extension is inserted between both.
- */
-sym_t *
-addptr(sym_t *decl, pqinf_t *pi)
-{
-       type_t  **tpp, *tp;
-       pqinf_t *npi;
-
-       tpp = &decl->s_type;
-       while (*tpp != dcs->d_type)
-               tpp = &(*tpp)->t_subt;
-
-       while (pi != NULL) {
-               *tpp = tp = getblk(sizeof (type_t));
-               tp->t_tspec = PTR;
-               tp->t_const = pi->p_const;
-               tp->t_volatile = pi->p_volatile;
-               *(tpp = &tp->t_subt) = dcs->d_type;
-               npi = pi->p_nxt;
-               free(pi);
-               pi = npi;
-       }
-       return (decl);
-}
-
-/*
- * If a dimension was specified, dim is 1, otherwise 0
- * n is the specified dimension
- */
-sym_t *
-addarray(sym_t *decl, int dim, int n)
-{
-       type_t  **tpp, *tp;
-
-       tpp = &decl->s_type;
-       while (*tpp != dcs->d_type)
-               tpp = &(*tpp)->t_subt;
-
-       *tpp = tp = getblk(sizeof (type_t));
-       tp->t_tspec = ARRAY;
-       tp->t_subt = dcs->d_type;
-       tp->t_dim = n;
-
-       if (n < 0) {
-               /* zero or negative array dimension */
-               error(20);
-               n = 0;
-       } else if (n == 0 && dim) {
-               /* zero or negative array dimension */
-               warning(20);
-       } else if (n == 0 && !dim) {
-               /* is incomplete type */
-               setcompl(tp, 1);
-       }
-
-       return (decl);
-}
-
-sym_t *
-addfunc(sym_t *decl, sym_t *args)
-{
-       type_t  **tpp, *tp;
-
-       if (dcs->d_proto) {
-               if (tflag)
-                       /* function prototypes are illegal in traditional C */
-                       warning(270);
-               args = nsfunc(decl, args);
-       } else {
-               osfunc(decl, args);
-       }
-
-       /*
-        * The symbols are removed from the symbol table by popdecl() after
-        * addfunc(). To be able to restore them if this is a function
-        * definition, a pointer to the list of all symbols is stored in
-        * dcs->d_nxt->d_fpsyms. Also a list of the arguments (concatenated
-        * by s_nxt) is stored in dcs->d_nxt->d_fargs.
-        * (dcs->d_nxt must be used because *dcs is the declaration stack
-        * element created for the list of params and is removed after
-        * addfunc())
-        */
-       if (dcs->d_nxt->d_ctx == EXTERN &&
-           decl->s_type == dcs->d_nxt->d_type) {
-               dcs->d_nxt->d_fpsyms = dcs->d_dlsyms;
-               dcs->d_nxt->d_fargs = args;
-       }
-
-       tpp = &decl->s_type;
-       while (*tpp != dcs->d_nxt->d_type)
-               tpp = &(*tpp)->t_subt;
-
-       *tpp = tp = getblk(sizeof (type_t));
-       tp->t_tspec = FUNC;
-       tp->t_subt = dcs->d_nxt->d_type;
-       if ((tp->t_proto = dcs->d_proto) != 0)
-               tp->t_args = args;
-       tp->t_vararg = dcs->d_vararg;
-
-       return (decl);
-}
-
-/*
- * Called for new style function declarations.
- */
-/* ARGSUSED */
-static sym_t *
-nsfunc(sym_t *decl, sym_t *args)
-{
-       sym_t   *arg, *sym;
-       scl_t   sc;
-       int     n;
-
-       /*
-        * Declarations of structs/unions/enums in param lists are legal,
-        * but senseless.
-        */
-       for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
-               sc = sym->s_scl;
-               if (sc == STRTAG || sc == UNIONTAG || sc == ENUMTAG) {
-                       /* dubious tag declaration: %s %s */
-                       warning(85, scltoa(sc), sym->s_name);
-               }
-       }
-
-       n = 1;
-       for (arg = args; arg != NULL; arg = arg->s_nxt) {
-               if (arg->s_type->t_tspec == VOID) {
-                       if (n > 1 || arg->s_nxt != NULL) {
-                               /* "void" must be sole parameter */
-                               error(60);
-                               arg->s_type = gettyp(INT);
-                       }
-               }
-               n++;
-       }
-
-       /* return NULL if first param is VOID */
-       return (args != NULL && args->s_type->t_tspec != VOID ? args : NULL);
-}
-
-/*
- * Called for old style function declarations.
- */
-static void
-osfunc(sym_t *decl, sym_t *args)
-{
-       /*
-        * Remember list of params only if this is really seams to be
-        * a function definition.
-        */
-       if (dcs->d_nxt->d_ctx == EXTERN &&
-           decl->s_type == dcs->d_nxt->d_type) {
-               /*
-                * We assume that this becomes a function definition. If
-                * we are wrong, its corrected in chkfdef().
-                */
-               if (args != NULL) {
-                       decl->s_osdef = 1;
-                       decl->s_args = args;
-               }
-       } else {
-               if (args != NULL)
-                       /* function prototype parameters must have types */
-                       warning(62);
-       }
-}
-
-/*
- * Lists of Identifiers in functions declarations are allowed only if
- * its also a function definition. If this is not the case, print a
- * error message.
- */
-void
-chkfdef(sym_t *sym, int msg)
-{
-       if (sym->s_osdef) {
-               if (msg) {
-                       /* incomplete or misplaced function definition */
-                       error(22);
-               }
-               sym->s_osdef = 0;
-               sym->s_args = NULL;
-       }
-}
-
-/*
- * Process the name in a declarator.
- * If the symbol does already exists, a new one is created.
- * The symbol becomes one of the storage classes EXTERN, STATIC, AUTO or
- * TYPEDEF.
- * s_def and s_reg are valid after dname().
- */
-sym_t *
-dname(sym_t *sym)
-{
-       scl_t   sc;
-
-       if (sym->s_scl == NOSCL) {
-               dcs->d_rdcsym = NULL;
-       } else if (sym->s_defarg) {
-               sym->s_defarg = 0;
-               dcs->d_rdcsym = NULL;
-       } else {
-               dcs->d_rdcsym = sym;
-               sym = pushdown(sym);
-       }
-
-       switch (dcs->d_ctx) {
-       case MOS:
-       case MOU:
-               /* Parent setzen */
-               sym->s_styp = dcs->d_tagtyp->t_str;
-               sym->s_def = DEF;
-               sym->s_value.v_tspec = INT;
-               sc = dcs->d_ctx;
-               break;
-       case EXTERN:
-               /*
-                * static and external symbols without "extern" are
-                * considered to be tentative defined, external
-                * symbols with "extern" are declared, and typedef names
-                * are defined. Tentative defined and declared symbols
-                * may become defined if an initializer is present or
-                * this is a function definition.
-                */
-               if ((sc = dcs->d_scl) == NOSCL) {
-                       sc = EXTERN;
-                       sym->s_def = TDEF;
-               } else if (sc == STATIC) {
-                       sym->s_def = TDEF;
-               } else if (sc == TYPEDEF) {
-                       sym->s_def = DEF;
-               } else if (sc == EXTERN) {
-                       sym->s_def = DECL;
-               } else {
-                       lerror("dname() 1");
-               }
-               break;
-       case PARG:
-               sym->s_arg = 1;
-               /* FALLTHROUGH */
-       case ARG:
-               if ((sc = dcs->d_scl) == NOSCL) {
-                       sc = AUTO;
-               } else if (sc == REG) {
-                       sym->s_reg = 1;
-                       sc = AUTO;
-               } else {
-                       lerror("dname() 2");
-               }
-               sym->s_def = DEF;
-               break;
-       case AUTO:
-               if ((sc = dcs->d_scl) == NOSCL) {
-                       /*
-                        * XXX somewhat ugly because we dont know whether
-                        * this is AUTO or EXTERN (functions). If we are
-                        * wrong it must be corrected in decl1loc(), where
-                        * we have the neccessary type information.
-                        */
-                       sc = AUTO;
-                       sym->s_def = DEF;
-               } else if (sc == AUTO || sc == STATIC || sc == TYPEDEF) {
-                       sym->s_def = DEF;
-               } else if (sc == REG) {
-                       sym->s_reg = 1;
-                       sc = AUTO;
-                       sym->s_def = DEF;
-               } else if (sc == EXTERN) {
-                       sym->s_def = DECL;
-               } else {
-                       lerror("dname() 3");
-               }
-               break;
-       default:
-               lerror("dname() 4");
-       }
-       sym->s_scl = sc;
-
-       sym->s_type = dcs->d_type;
-
-       dcs->d_fpsyms = NULL;
-
-       return (sym);
-}
-
-/*
- * Process a name in the list of formal params in an old style function
- * definition.
- */
-sym_t *
-iname(sym_t *sym)
-{
-       if (sym->s_scl != NOSCL) {
-               if (blklev == sym->s_blklev) {
-                       /* redeclaration of formal parameter %s */
-                       error(21, sym->s_name);
-                       if (!sym->s_defarg)
-                               lerror("iname()");
-               }
-               sym = pushdown(sym);
-       }
-       sym->s_type = gettyp(INT);
-       sym->s_scl = AUTO;
-       sym->s_def = DEF;
-       sym->s_defarg = sym->s_arg = 1;
-       return (sym);
-}
-
-/*
- * Create the type of a tag.
- *
- * tag points to the symbol table entry of the tag
- * kind is the kind of the tag (STRUCT/UNION/ENUM)
- * decl is 1 if the type of the tag will be completed in this declaration
- * (the following token is T_LBRACE)
- * semi is 1 if the following token is T_SEMI
- */
-type_t *
-mktag(sym_t *tag, tspec_t kind, int decl, int semi)
-{
-       scl_t   scl;
-       type_t  *tp;
-
-       if (kind == STRUCT) {
-               scl = STRTAG;
-       } else if (kind == UNION) {
-               scl = UNIONTAG;
-       } else if (kind == ENUM) {
-               scl = ENUMTAG;
-       } else {
-               lerror("mktag()");
-       }
-
-       if (tag != NULL) {
-               if (tag->s_scl != NOSCL) {
-                       tag = newtag(tag, scl, decl, semi);
-               } else {
-                       /* a new tag, no empty declaration */
-                       dcs->d_nxt->d_nedecl = 1;
-                       if (scl == ENUMTAG && !decl) {
-                               if (!tflag && (sflag || pflag))
-                                       /* forward reference to enum type */
-                                       warning(42);
-                       }
-               }
-               if (tag->s_scl == NOSCL) {
-                       tag->s_scl = scl;
-                       tag->s_type = tp = getblk(sizeof (type_t));
-               } else {
-                       tp = tag->s_type;
-               }
-       } else {
-               tag = getblk(sizeof (sym_t));
-               tag->s_name = unnamed;
-               STRUCT_ASSIGN(tag->s_dpos, curr_pos);
-               tag->s_kind = FTAG;
-               tag->s_scl = scl;
-               tag->s_blklev = -1;
-               tag->s_type = tp = getblk(sizeof (type_t));
-               dcs->d_nxt->d_nedecl = 1;
-       }
-
-       if (tp->t_tspec == NOTSPEC) {
-               tp->t_tspec = kind;
-               if (kind != ENUM) {
-                       tp->t_str = getblk(sizeof (str_t));
-                       tp->t_str->align = CHAR_BIT;
-                       tp->t_str->stag = tag;
-               } else {
-                       tp->t_isenum = 1;
-                       tp->t_enum = getblk(sizeof (enum_t));
-                       tp->t_enum->etag = tag;
-               }
-               /* ist unvollstaendiger Typ */
-               setcompl(tp, 1);
-       }
-
-       return (tp);
-}
-
-/*
- * Checks all possible cases of tag redeclarations.
- * decl is 1 if T_LBRACE follows
- * semi is 1 if T_SEMI follows
- */
-static sym_t *
-newtag(sym_t *tag, scl_t scl, int decl, int semi)
-{
-       if (tag->s_blklev < blklev) {
-               if (semi) {
-                       /* "struct a;" */
-                       if (!tflag) {
-                               if (!sflag)
-                                       /* decl. introduces new type ... */
-                                       warning(44, scltoa(scl), tag->s_name);
-                               tag = pushdown(tag);
-                       } else if (tag->s_scl != scl) {
-                               /* base type is really "%s %s" */
-                               warning(45, scltoa(tag->s_scl), tag->s_name);
-                       }
-                       dcs->d_nxt->d_nedecl = 1;
-               } else if (decl) {
-                       /* "struct a { ..." */
-                       if (hflag)
-                               /* redefinition hides earlier one: %s */
-                               warning(43, tag->s_name);
-                       tag = pushdown(tag);
-                       dcs->d_nxt->d_nedecl = 1;
-               } else if (tag->s_scl != scl) {
-                       /* base type is really "%s %s" */
-                       warning(45, scltoa(tag->s_scl), tag->s_name);
-                       /* declaration introduces new type in ANSI C: %s %s */
-                       if (!sflag)
-                               warning(44, scltoa(scl), tag->s_name);
-                       tag = pushdown(tag);
-                       dcs->d_nxt->d_nedecl = 1;
-               }
-       } else {
-               if (tag->s_scl != scl) {
-                       /* (%s) tag redeclared */
-                       error(46, scltoa(tag->s_scl));
-                       prevdecl(-1, tag);
-                       tag = pushdown(tag);
-                       dcs->d_nxt->d_nedecl = 1;
-               } else if (decl && !incompl(tag->s_type)) {
-                       /* (%s) tag redeclared */
-                       error(46, scltoa(tag->s_scl));
-                       prevdecl(-1, tag);
-                       tag = pushdown(tag);
-                       dcs->d_nxt->d_nedecl = 1;
-               } else if (semi || decl) {
-                       dcs->d_nxt->d_nedecl = 1;
-               }
-       }
-       return (tag);
-}
-
-const char *
-scltoa(scl_t sc)
-{
-       const   char *s;
-
-       switch (sc) {
-       case EXTERN:    s = "extern";   break;
-       case STATIC:    s = "static";   break;
-       case AUTO:      s = "auto";     break;
-       case REG:       s = "register"; break;
-       case TYPEDEF:   s = "typedef";  break;
-       case STRTAG:    s = "struct";   break;
-       case UNIONTAG:  s = "union";    break;
-       case ENUMTAG:   s = "enum";     break;
-       default:        lerror("tagttoa()");
-       }
-       return (s);
-}
-
-/*
- * Completes the type of a tag in a struct/union/enum declaration.
- * tp points to the type of the, tag, fmem to the list of members/enums.
- */
-type_t *
-compltag(type_t *tp, sym_t *fmem)
-{
-       tspec_t t;
-       str_t   *sp;
-       int     n;
-       sym_t   *mem;
-
-       /* from now a complete type */
-       setcompl(tp, 0);
-
-       if ((t = tp->t_tspec) != ENUM) {
-               align(dcs->d_stralign, 0);
-               sp = tp->t_str;
-               sp->align = dcs->d_stralign;
-               sp->size = dcs->d_offset;
-               sp->memb = fmem;
-               if (sp->size == 0) {
-                       /* zero sized %s */
-                       (void)gnuism(47, ttab[t].tt_name);
-               } else {
-                       n = 0;
-                       for (mem = fmem; mem != NULL; mem = mem->s_nxt) {
-                               if (mem->s_name != unnamed)
-                                       n++;
-                       }
-                       if (n == 0) {
-                               /* %s has no named members */
-                               warning(65,
-                                       t == STRUCT ? "structure" : "union");
-                       }
-               }
-       } else {
-               tp->t_enum->elem = fmem;
-       }
-       return (tp);
-}
-
-/*
- * Processes the name of an enumerator in en enum declaration.
- *
- * sym points to the enumerator
- * val is the value of the enumerator
- * impl is 1 if the the value of the enumerator was not explicit specified.
- */
-sym_t *
-ename(sym_t *sym, int val, int impl)
-{
-       if (sym->s_scl) {
-               if (sym->s_blklev == blklev) {
-                       /* no hflag, because this is illegal!!! */
-                       if (sym->s_arg) {
-                               /* enumeration constant hides parameter: %s */
-                               warning(57, sym->s_name);
-                       } else {
-                               /* redeclaration of %s */
-                               error(27, sym->s_name);
-                               /*
-                                * inside blocks it should not too complicated
-                                * to find the position of the previous
-                                * declaration
-                                */
-                               if (blklev == 0)
-                                       prevdecl(-1, sym);
-                       }
-               } else {
-                       if (hflag)
-                               /* redefinition hides earlier one: %s */
-                               warning(43, sym->s_name);
-               }
-               sym = pushdown(sym);
-       }
-       sym->s_scl = ENUMCON;
-       sym->s_type = dcs->d_tagtyp;
-       sym->s_value.v_tspec = INT;
-       sym->s_value.v_quad = val;
-       if (impl && val - 1 == INT_MAX) {
-               /* overflow in enumeration values: %s */
-               warning(48, sym->s_name);
-       }
-       enumval = val + 1;
-       return (sym);
-}
-
-/*
- * Process a single external declarator.
- */
-void
-decl1ext(sym_t *dsym, int initflg)
-{
-       int     warn, rval, redec;
-       sym_t   *rdsym;
-
-       chkfdef(dsym, 1);
-
-       chktyp(dsym);
-
-       if (initflg && !(initerr = chkinit(dsym)))
-               dsym->s_def = DEF;
-
-       /*
-        * Declarations of functions are marked as "tentative" in dname().
-        * This is wrong because there are no tentative function
-        * definitions.
-        */
-       if (dsym->s_type->t_tspec == FUNC && dsym->s_def == TDEF)
-               dsym->s_def = DECL;
-
-       if (dcs->d_inline) {
-               if (dsym->s_type->t_tspec == FUNC) {
-                       dsym->s_inline = 1;
-               } else {
-                       /* variable declared inline: %s */
-                       warning(268, dsym->s_name);
-               }
-       }
-
-       /* Write the declaration into the output file */
-       if (plibflg && llibflg &&
-           dsym->s_type->t_tspec == FUNC && dsym->s_type->t_proto) {
-               /*
-                * With both LINTLIBRARY and PROTOLIB the prototyp is
-                * written as a function definition to the output file.
-                */
-               rval = dsym->s_type->t_subt->t_tspec != VOID;
-               outfdef(dsym, &dsym->s_dpos, rval, 0, NULL);
-       } else {
-               outsym(dsym, dsym->s_scl, dsym->s_def);
-       }
-
-       if ((rdsym = dcs->d_rdcsym) != NULL) {
-
-               /*
-                * If the old symbol stems from a old style function definition
-                * we have remembered the params in rdsmy->s_args and compare
-                * them with the params of the prototype.
-                */
-               if (rdsym->s_osdef && dsym->s_type->t_proto) {
-                       redec = chkosdef(rdsym, dsym);
-               } else {
-                       redec = 0;
-               }
-
-               if (!redec && !isredec(dsym, (warn = 0, &warn))) {
-
-                       if (warn) {
-                               /* redeclaration of %s */
-                               (*(sflag ? error : warning))(27, dsym->s_name);
-                               prevdecl(-1, rdsym);
-                       }
-
-                       /*
-                        * Overtake the rememberd params if the new symbol
-                        * is not a prototype.
-                        */
-                       if (rdsym->s_osdef && !dsym->s_type->t_proto) {
-                               dsym->s_osdef = rdsym->s_osdef;
-                               dsym->s_args = rdsym->s_args;
-                               STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
-                       }
-
-                       /*
-                        * Remember the position of the declaration if the
-                        * old symbol was a prototype and the new is not.
-                        * Also remember the position if the old symbol
-                        * was defined and the new is not.
-                        */
-                       if (rdsym->s_type->t_proto && !dsym->s_type->t_proto) {
-                               STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
-                       } else if (rdsym->s_def == DEF && dsym->s_def != DEF) {
-                               STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
-                       }
-
-                       /*
-                        * Copy informations about usage of the name into
-                        * the new symbol.
-                        */
-                       cpuinfo(dsym, rdsym);
-
-                       /* Once a name is defined, it remains defined. */
-                       if (rdsym->s_def == DEF)
-                               dsym->s_def = DEF;
-
-                       /* once a function is inline, it remains inline */
-                       if (rdsym->s_inline)
-                               dsym->s_inline = 1;
-
-                       compltyp(dsym, rdsym);
-
-               }
-
-               rmsym(rdsym);
-       }
-
-       if (dsym->s_scl == TYPEDEF) {
-               dsym->s_type = duptyp(dsym->s_type);
-               dsym->s_type->t_typedef = 1;
-               settdsym(dsym->s_type, dsym);
-       }
-
-}
-
-/*
- * Copies informations about usage into a new symbol table entry of
- * the same symbol.
- */
-void
-cpuinfo(sym_t *sym, sym_t *rdsym)
-{
-       sym->s_spos = rdsym->s_spos;
-       sym->s_upos = rdsym->s_upos;
-       sym->s_set = rdsym->s_set;
-       sym->s_used = rdsym->s_used;
-}
-
-/*
- * Prints an error and returns 1 if a symbol is redeclared/redefined.
- * Otherwise returns 0 and, in some cases of minor problems, prints
- * a warning.
- */
-int
-isredec(sym_t *dsym, int *warn)
-{
-       sym_t   *rsym;
-
-       if ((rsym = dcs->d_rdcsym)->s_scl == ENUMCON) {
-               /* redeclaration of %s */
-               error(27, dsym->s_name);
-               prevdecl(-1, rsym);
-               return (1);
-       }
-       if (rsym->s_scl == TYPEDEF) {
-               /* typedef redeclared: %s */
-               error(89, dsym->s_name);
-               prevdecl(-1, rsym);
-               return (1);
-       }
-       if (dsym->s_scl == TYPEDEF) {
-               /* redeclaration of %s */
-               error(27, dsym->s_name);
-               prevdecl(-1, rsym);
-               return (1);
-       }
-       if (rsym->s_def == DEF && dsym->s_def == DEF) {
-               /* redefinition of %s */
-               error(28, dsym->s_name);
-               prevdecl(-1, rsym);
-               return(1);
-       }
-       if (!eqtype(rsym->s_type, dsym->s_type, 0, 0, warn)) {
-               /* redeclaration of %s */
-               error(27, dsym->s_name);
-               prevdecl(-1, rsym);
-               return(1);
-       }
-       if (rsym->s_scl == EXTERN && dsym->s_scl == EXTERN)
-               return(0);
-       if (rsym->s_scl == STATIC && dsym->s_scl == STATIC)
-               return(0);
-       if (rsym->s_scl == STATIC && dsym->s_def == DECL)
-               return(0);
-       if (rsym->s_scl == EXTERN && rsym->s_def == DEF) {
-               /*
-                * All cases except "int a = 1; static int a;" are catched
-                * above with or without a warning
-                */
-               /* redeclaration of %s */
-               error(27, dsym->s_name);
-               prevdecl(-1, rsym);
-               return(1);
-       }
-       if (rsym->s_scl == EXTERN) {
-               /* previously declared extern, becomes static: %s */
-               warning(29, dsym->s_name);
-               prevdecl(-1, rsym);
-               return(0);
-       }
-       /*
-        * Now its on of:
-        * "static a; int a;", "static a; int a = 1;", "static a = 1; int a;"
-        */
-       /* redeclaration of %s; ANSI C requires "static" */
-       if (sflag) {
-               warning(30, dsym->s_name);
-               prevdecl(-1, rsym);
-       }
-       dsym->s_scl = STATIC;
-       return (0);
-}
-
-/*
- * Checks if two types are compatible. Returns 0 if not, otherwise 1.
- *
- * ignqual     ignore qualifiers of type; used for function params
- * promot      promote left type; used for comparision of params of
- *             old style function definitions with params of prototypes.
- * *warn       set to 1 if an old style function declaration is not
- *             compatible with a prototype
- */
-int
-eqtype(type_t *tp1, type_t *tp2, int ignqual, int promot, int *warn)
-{
-       tspec_t t;
-
-       while (tp1 != NULL && tp2 != NULL) {
-
-               t = tp1->t_tspec;
-               if (promot) {
-                       if (t == FLOAT) {
-                               t = DOUBLE;
-                       } else if (t == CHAR || t == SCHAR) {
-                               t = INT;
-                       } else if (t == UCHAR) {
-                               t = tflag ? UINT : INT;
-                       } else if (t == SHORT) {
-                               t = INT;
-                       } else if (t == USHORT) {
-                               /* CONSTCOND */
-                               t = INT_MAX < USHRT_MAX || tflag ? UINT : INT;
-                       }
-               }
-
-               if (t != tp2->t_tspec)
-                       return (0);
-
-               if (tp1->t_const != tp2->t_const && !ignqual && !tflag)
-                       return (0);
-
-               if (tp1->t_volatile != tp2->t_volatile && !ignqual && !tflag)
-                       return (0);
-
-               if (t == STRUCT || t == UNION)
-                       return (tp1->t_str == tp2->t_str);
-
-               if (t == ARRAY && tp1->t_dim != tp2->t_dim) {
-                       if (tp1->t_dim != 0 && tp2->t_dim != 0)
-                               return (0);
-               }
-
-               /* dont check prototypes for traditional */
-               if (t == FUNC && !tflag) {
-                       if (tp1->t_proto && tp2->t_proto) {
-                               if (!eqargs(tp1, tp2, warn))
-                                       return (0);
-                       } else if (tp1->t_proto) {
-                               if (!mnoarg(tp1, warn))
-                                       return (0);
-                       } else if (tp2->t_proto) {
-                               if (!mnoarg(tp2, warn))
-                                       return (0);
-                       }
-               }
-
-               tp1 = tp1->t_subt;
-               tp2 = tp2->t_subt;
-               ignqual = promot = 0;
-
-       }
-
-       return (tp1 == tp2);
-}
-
-/*
- * Compares the parameter types of two prototypes.
- */
-static int
-eqargs(type_t *tp1, type_t *tp2, int *warn)
-{
-       sym_t   *a1, *a2;
-
-       if (tp1->t_vararg != tp2->t_vararg)
-               return (0);
-
-       a1 = tp1->t_args;
-       a2 = tp2->t_args;
-
-       while (a1 != NULL && a2 != NULL) {
-
-               if (eqtype(a1->s_type, a2->s_type, 1, 0, warn) == 0)
-                       return (0);
-
-               a1 = a1->s_nxt;
-               a2 = a2->s_nxt;
-
-       }
-
-       return (a1 == a2);
-}
-
-/*
- * mnoarg() (matches functions with no argument type information)
- * returns 1 if all parameters of a prototype are compatible with
- * and old style function declaration.
- * This is the case if following conditions are met:
- *     1. the prototype must have a fixed number of parameters
- *     2. no parameter is of type float
- *     3. no parameter is converted to another type if integer promotion
- *        is applied on it
- */
-static int
-mnoarg(type_t *tp, int *warn)
-{
-       sym_t   *arg;
-       tspec_t t;
-
-       if (tp->t_vararg) {
-               if (warn != NULL)
-                       *warn = 1;
-       }
-       for (arg = tp->t_args; arg != NULL; arg = arg->s_nxt) {
-               if ((t = arg->s_type->t_tspec) == FLOAT ||
-                   t == CHAR || t == SCHAR || t == UCHAR ||
-                   t == SHORT || t == USHORT) {
-                       if (warn != NULL)
-                               *warn = 1;
-               }
-       }
-       return (1);
-}
-
-/*
- * Compares a prototype declaration with the remembered arguments of
- * a previous old style function definition.
- */
-static int
-chkosdef(sym_t *rdsym, sym_t *dsym)
-{
-       sym_t   *args, *pargs, *arg, *parg;
-       int     narg, nparg, n;
-       int     warn, msg;
-
-       args = rdsym->s_args;
-       pargs = dsym->s_type->t_args;
-
-       msg = 0;
-
-       narg = nparg = 0;
-       for (arg = args; arg != NULL; arg = arg->s_nxt)
-               narg++;
-       for (parg = pargs; parg != NULL; parg = parg->s_nxt)
-               nparg++;
-       if (narg != nparg) {
-               /* prototype does not match old-style definition */
-               error(63);
-               msg = 1;
-               goto end;
-       }
-
-       arg = args;
-       parg = pargs;
-       n = 1;
-       while (narg--) {
-               warn = 0;
-               /*
-                * If it does not match due to promotion and sflag is
-                * not set we print only a warning.
-                */
-               if (!eqtype(arg->s_type, parg->s_type, 1, 1, &warn) || warn) {
-                       /* prototype does not match old-style def., arg #%d */
-                       error(299, n);
-                       msg = 1;
-               }
-               arg = arg->s_nxt;
-               parg = parg->s_nxt;
-               n++;
-       }
-
- end:
-       if (msg)
-               /* old style definition */
-               prevdecl(300, rdsym);
-
-       return (msg);
-}
-
-/*
- * Complets a type by copying the dimension and prototype information
- * from a second compatible type.
- *
- * Following lines are legal:
- *  "typedef a[]; a b; a b[10]; a c; a c[20];"
- *  "typedef ft(); ft f; f(int); ft g; g(long);"
- * This means that, if a type is completed, the type structure must
- * be duplicated.
- */
-void
-compltyp(sym_t *dsym, sym_t *ssym)
-{
-       type_t  **dstp, *src;
-       type_t  *dst;
-
-       dstp = &dsym->s_type;
-       src = ssym->s_type;
-
-       while ((dst = *dstp) != NULL) {
-               if (src == NULL || dst->t_tspec != src->t_tspec)
-                       lerror("compltyp() 1");
-               if (dst->t_tspec == ARRAY) {
-                       if (dst->t_dim == 0 && src->t_dim != 0) {
-                               *dstp = dst = duptyp(dst);
-                               dst->t_dim = src->t_dim;
-                               /* now a complete Typ */
-                               setcompl(dst, 0);
-                       }
-               } else if (dst->t_tspec == FUNC) {
-                       if (!dst->t_proto && src->t_proto) {
-                               *dstp = dst = duptyp(dst);
-                               dst->t_proto = 1;
-                               dst->t_args = src->t_args;
-                       }
-               }
-               dstp = &dst->t_subt;
-               src = src->t_subt;
-       }
-}
-
-/*
- * Completes the declaration of a single argument.
- */
-sym_t *
-decl1arg(sym_t *sym, int initflg)
-{
-       tspec_t t;
-
-       chkfdef(sym, 1);
-
-       chktyp(sym);
-
-       if (dcs->d_rdcsym != NULL && dcs->d_rdcsym->s_blklev == blklev) {
-               /* redeclaration of formal parameter %s */
-               error(237, sym->s_name);
-               rmsym(dcs->d_rdcsym);
-               sym->s_arg = 1;
-       }
-
-       if (!sym->s_arg) {
-               /* declared argument %s is missing */
-               error(53, sym->s_name);
-               sym->s_arg = 1;
-       }
-
-       if (initflg) {
-               /* cannot initialize parameter: %s */
-               error(52, sym->s_name);
-               initerr = 1;
-       }
-
-       if ((t = sym->s_type->t_tspec) == ARRAY) {
-               sym->s_type = incref(sym->s_type->t_subt, PTR);
-       } else if (t == FUNC) {
-               if (tflag)
-                       /* a function is declared as an argument: %s */
-                       warning(50, sym->s_name);
-               sym->s_type = incref(sym->s_type, PTR);
-       } else if (t == FLOAT) {
-               if (tflag)
-                       sym->s_type = gettyp(DOUBLE);
-       }
-
-       if (dcs->d_inline)
-               /* argument declared inline: %s */
-               warning(269, sym->s_name);
-
-       /*
-        * Arguments must have complete types. lengths() prints the needed
-        * error messages (null dimension is impossible because arrays are
-        * converted to pointers).
-        */
-       if (sym->s_type->t_tspec != VOID)
-               (void)length(sym->s_type, sym->s_name);
-
-       setsflg(sym);
-
-       return (sym);
-}
-
-/*
- * Does some checks for lint directives which apply to functions.
- * Processes arguments in old style function definitions which default
- * to int.
- * Checks compatiblility of old style function definition with previous
- * prototype.
- */
-void
-cluparg(void)
-{
-       sym_t   *args, *arg, *pargs, *parg;
-       int     narg, nparg, n, msg;
-       tspec_t t;
-
-       args = funcsym->s_args;
-       pargs = funcsym->s_type->t_args;
-
-       /* check for illegal combinations of lint directives */
-       if (prflstrg != -1 && scflstrg != -1) {
-               /* can't be used together: ** PRINTFLIKE ** ** SCANFLIKE ** */
-               warning(289);
-               prflstrg = scflstrg = -1;
-       }
-       if (nvararg != -1 && (prflstrg != -1 || scflstrg != -1)) {
-               /* dubious use of ** VARARGS ** with ** %s ** */
-               warning(288, prflstrg != -1 ? "PRINTFLIKE" : "SCANFLIKE");
-               nvararg = -1;
-       }
-
-       /*
-        * check if the argument of a lint directive is compatible with the
-        * number of arguments.
-        */
-       narg = 0;
-       for (arg = dcs->d_fargs; arg != NULL; arg = arg->s_nxt)
-               narg++;
-       if (nargusg > narg) {
-               /* argument number mismatch with directive: ** %s ** */
-               warning(283, "ARGSUSED");
-               nargusg = 0;
-       }
-       if (nvararg > narg) {
-               /* argument number mismatch with directive: ** %s ** */
-               warning(283, "VARARGS");
-               nvararg = 0;
-       }
-       if (prflstrg > narg) {
-               /* argument number mismatch with directive: ** %s ** */
-               warning(283, "PRINTFLIKE");
-               prflstrg = -1;
-       } else if (prflstrg == 0) {
-               prflstrg = -1;
-       }
-       if (scflstrg > narg) {
-               /* argument number mismatch with directive: ** %s ** */
-               warning(283, "SCANFLIKE");
-               scflstrg = -1;
-       } else if (scflstrg == 0) {
-               scflstrg = -1;
-       }
-       if (prflstrg != -1 || scflstrg != -1) {
-               narg = prflstrg != -1 ? prflstrg : scflstrg;
-               arg = dcs->d_fargs;
-               for (n = 1; n < narg; n++)
-                       arg = arg->s_nxt;
-               if (arg->s_type->t_tspec != PTR ||
-                   ((t = arg->s_type->t_subt->t_tspec) != CHAR &&
-                    t != UCHAR && t != SCHAR)) {
-                       /* arg. %d must be 'char *' for PRINTFLIKE/SCANFLIKE */
-                       warning(293, narg);
-                       prflstrg = scflstrg = -1;
-               }
-       }
-
-       /*
-        * print a warning for each argument off an old style function
-        * definition which defaults to int
-        */
-       for (arg = args; arg != NULL; arg = arg->s_nxt) {
-               if (arg->s_defarg) {
-                       /* argument type defaults to int: %s */
-                       warning(32, arg->s_name);
-                       arg->s_defarg = 0;
-                       setsflg(arg);
-               }
-       }
-
-       /*
-        * If this is an old style function definition and a prototyp
-        * exists, compare the types of arguments.
-        */
-       if (funcsym->s_osdef && funcsym->s_type->t_proto) {
-               /*
-                * If the number of arguments does not macht, we need not
-                * continue.
-                */
-               narg = nparg = 0;
-               msg = 0;
-               for (parg = pargs; parg != NULL; parg = parg->s_nxt)
-                       nparg++;
-               for (arg = args; arg != NULL; arg = arg->s_nxt)
-                       narg++;
-               if (narg != nparg) {
-                       /* parameter mismatch: %d declared, %d defined */
-                       error(51, nparg, narg);
-                       msg = 1;
-               } else {
-                       parg = pargs;
-                       arg = args;
-                       while (narg--) {
-                               msg |= chkptdecl(arg, parg);
-                               parg = parg->s_nxt;
-                               arg = arg->s_nxt;
-                       }
-               }
-               if (msg)
-                       /* prototype declaration */
-                       prevdecl(285, dcs->d_rdcsym);
-
-               /* from now the prototype is valid */
-               funcsym->s_osdef = 0;
-               funcsym->s_args = NULL;
-
-       }
-
-}
-
-/*
- * Checks compatibility of an old style function definition with a previous
- * prototype declaration.
- * Returns 1 if the position of the previous declaration should be reported.
- */
-static int
-chkptdecl(sym_t *arg, sym_t *parg)
-{
-       type_t  *tp, *ptp;
-       int     warn, msg;
-
-       tp = arg->s_type;
-       ptp = parg->s_type;
-
-       msg = 0;
-       warn = 0;
-
-       if (!eqtype(tp, ptp, 1, 1, &warn)) {
-               if (eqtype(tp, ptp, 1, 0, &warn)) {
-                       /* type does not match prototype: %s */
-                       msg = gnuism(58, arg->s_name);
-               } else {
-                       /* type does not match prototype: %s */
-                       error(58, arg->s_name);
-                       msg = 1;
-               }
-       } else if (warn) {
-               /* type does not match prototype: %s */
-               (*(sflag ? error : warning))(58, arg->s_name);
-               msg = 1;
-       }
-
-       return (msg);
-}
-
-/*
- * Completes a single local declaration/definition.
- */
-void
-decl1loc(sym_t *dsym, int initflg)
-{
-       /* Correct a mistake done in dname(). */
-       if (dsym->s_type->t_tspec == FUNC) {
-               dsym->s_def = DECL;
-               if (dcs->d_scl == NOSCL)
-                       dsym->s_scl = EXTERN;
-       }
-
-       if (dsym->s_type->t_tspec == FUNC) {
-               if (dsym->s_scl == STATIC) {
-                       /* dubious static function at block level: %s */
-                       warning(93, dsym->s_name);
-                       dsym->s_scl = EXTERN;
-               } else if (dsym->s_scl != EXTERN && dsym->s_scl != TYPEDEF) {
-                       /* function has illegal storage class: %s */
-                       error(94, dsym->s_name);
-                       dsym->s_scl = EXTERN;
-               }
-       }
-
-       /*
-        * functions may be declared inline at local scope, although
-        * this has no effect for a later definition of the same
-        * function.
-        * XXX it should have an effect if tflag is set. this would
-        * also be the way gcc behaves.
-        */
-       if (dcs->d_inline) {
-               if (dsym->s_type->t_tspec == FUNC) {
-                       dsym->s_inline = 1;
-               } else {
-                       /* variable declared inline: %s */
-                       warning(268, dsym->s_name);
-               }
-       }
-
-       chkfdef(dsym, 1);
-
-       chktyp(dsym);
-
-       if (dcs->d_rdcsym != NULL && dsym->s_scl == EXTERN)
-               ledecl(dsym);
-
-       if (dsym->s_scl == EXTERN) {
-               /*
-                * XXX wenn die statische Variable auf Ebene 0 erst
-                * spaeter definiert wird, haben wir die Brille auf.
-                */
-               if (dsym->s_xsym == NULL) {
-                       outsym(dsym, EXTERN, dsym->s_def);
-               } else {
-                       outsym(dsym, dsym->s_xsym->s_scl, dsym->s_def);
-               }
-       }
-
-       if (dcs->d_rdcsym != NULL) {
-
-               if (dcs->d_rdcsym->s_blklev == 0) {
-
-                       switch (dsym->s_scl) {
-                       case AUTO:
-                               /* automatic hides external declaration: %s */
-                               if (hflag)
-                                       warning(86, dsym->s_name);
-                               break;
-                       case STATIC:
-                               /* static hides external declaration: %s */
-                               if (hflag)
-                                       warning(87, dsym->s_name);
-                               break;
-                       case TYPEDEF:
-                               /* typedef hides  external declaration: %s */
-                               if (hflag)
-                                       warning(88, dsym->s_name);
-                               break;
-                       case EXTERN:
-                               /*
-                                * Warnings and errors are printed in ledecl()
-                                */
-                               break;
-                       default:
-                               lerror("decl1loc() 1");
-                       }
-
-               } else if (dcs->d_rdcsym->s_blklev == blklev) {
-
-                       /* no hflag, because its illegal! */
-                       if (dcs->d_rdcsym->s_arg) {
-                               /*
-                                * if !tflag, a "redeclaration of %s" error
-                                * is produced below
-                                */
-                               if (tflag) {
-                                       if (hflag)
-                                               /* decl. hides parameter: %s */
-                                               warning(91, dsym->s_name);
-                                       rmsym(dcs->d_rdcsym);
-                               }
-                       }
-
-               } else if (dcs->d_rdcsym->s_blklev < blklev) {
-
-                       if (hflag)
-                               /* declaration hides earlier one: %s */
-                               warning(95, dsym->s_name);
-
-               }
-
-               if (dcs->d_rdcsym->s_blklev == blklev) {
-
-                       /* redeclaration of %s */
-                       error(27, dsym->s_name);
-                       rmsym(dcs->d_rdcsym);
-
-               }
-
-       }
-
-       if (initflg && !(initerr = chkinit(dsym))) {
-               dsym->s_def = DEF;
-               setsflg(dsym);
-       }
-
-       if (dsym->s_scl == TYPEDEF) {
-               dsym->s_type = duptyp(dsym->s_type);
-               dsym->s_type->t_typedef = 1;
-               settdsym(dsym->s_type, dsym);
-       }
-
-       /*
-        * Before we can check the size we must wait for a initialisation
-        * which may follow.
-        */
-}
-
-/*
- * Processes (re)declarations of external Symbols inside blocks.
- */
-static void
-ledecl(sym_t *dsym)
-{
-       int     eqt, warn;
-       sym_t   *esym;
-
-       /* look for a symbol with the same name */
-       esym = dcs->d_rdcsym;
-       while (esym != NULL && esym->s_blklev != 0) {
-               while ((esym = esym->s_link) != NULL) {
-                       if (esym->s_kind != FVFT)
-                               continue;
-                       if (strcmp(dsym->s_name, esym->s_name) == 0)
-                               break;
-               }
-       }
-       if (esym == NULL)
-               return;
-       if (esym->s_scl != EXTERN && esym->s_scl != STATIC) {
-               /* gcc accepts this without a warning, pcc prints an error. */
-               /* redeclaration of %s */
-               warning(27, dsym->s_name);
-               prevdecl(-1, esym);
-               return;
-       }
-
-       warn = 0;
-       eqt = eqtype(esym->s_type, dsym->s_type, 0, 0, &warn);
-
-       if (!eqt || warn) {
-               if (esym->s_scl == EXTERN) {
-                       /* inconsistent redeclaration of extern: %s */
-                       warning(90, dsym->s_name);
-                       prevdecl(-1, esym);
-               } else {
-                       /* inconsistent redeclaration of static: %s */
-                       warning(92, dsym->s_name);
-                       prevdecl(-1, esym);
-               }
-       }
-
-       if (eqt) {
-               /*
-                * Remember the external symbol so we can update usage
-                * information at the end of the block.
-                */
-               dsym->s_xsym = esym;
-       }
-}
-
-/*
- * Print an error or a warning if the symbol cant be initialized due
- * to type/storage class. Returnvalue is 1 if an error has been
- * detected.
- */
-static int
-chkinit(sym_t *sym)
-{
-       int     err;
-
-       err = 0;
-
-       if (sym->s_type->t_tspec == FUNC) {
-               /* cannot initialize function: %s */
-               error(24, sym->s_name);
-               err = 1;
-       } else if (sym->s_scl == TYPEDEF) {
-               /* cannot initialize typedef: %s */
-               error(25, sym->s_name);
-               err = 1;
-       } else if (sym->s_scl == EXTERN && sym->s_def == DECL) {
-               /* cannot initialize "extern" declaration: %s */
-               if (dcs->d_ctx == EXTERN) {
-                       warning(26, sym->s_name);
-               } else {
-                       error(26, sym->s_name);
-                       err = 1;
-               }
-       }
-
-       return (err);
-}
-
-/*
- * Create a symbole for an abstract declaration.
- */
-sym_t *
-aname(void)
-{
-       sym_t   *sym;
-
-       if (dcs->d_ctx != ABSTRACT && dcs->d_ctx != PARG)
-               lerror("aname()");
-
-       sym = getblk(sizeof (sym_t));
-
-       sym->s_name = unnamed;
-       sym->s_def = DEF;
-       sym->s_scl = ABSTRACT;
-       sym->s_blklev = -1;
-
-       if (dcs->d_ctx == PARG)
-               sym->s_arg = 1;
-
-       sym->s_type = dcs->d_type;
-       dcs->d_rdcsym = NULL;
-       dcs->d_vararg = 0;
-
-       return (sym);
-}
-
-/*
- * Removes anything which has nothing to do on global level.
- */
-void
-globclup(void)
-{
-       while (dcs->d_nxt != NULL)
-               popdecl();
-
-       cleanup();
-       blklev = 0;
-       mblklev = 0;
-
-       /*
-        * remove all informations about pending lint directives without
-        * warnings.
-        */
-       glclup(1);
-}
-
-/*
- * Process an abstract type declaration
- */
-sym_t *
-decl1abs(sym_t *sym)
-{
-       chkfdef(sym, 1);
-       chktyp(sym);
-       return (sym);
-}
-
-/*
- * Checks size after declarations of variables and their initialisation.
- */
-void
-chksz(sym_t *dsym)
-{
-       /*
-        * check size only for symbols which are defined and no function and
-        * not typedef name
-        */
-       if (dsym->s_def != DEF)
-               return;
-       if (dsym->s_scl == TYPEDEF)
-               return;
-       if (dsym->s_type->t_tspec == FUNC)
-               return;
-
-       if (length(dsym->s_type, dsym->s_name) == 0 &&
-           dsym->s_type->t_tspec == ARRAY && dsym->s_type->t_dim == 0) {
-               /* empty array declaration: %s */
-               if (tflag) {
-                       warning(190, dsym->s_name);
-               } else {
-                       error(190, dsym->s_name);
-               }
-       }
-}
-
-/*
- * Mark an object as set if it is not already
- */
-void
-setsflg(sym_t *sym)
-{
-       if (!sym->s_set) {
-               sym->s_set = 1;
-               STRUCT_ASSIGN(sym->s_spos, curr_pos);
-       }
-}
-
-/*
- * Mark an object as used if it is not already
- */
-void
-setuflg(sym_t *sym, int fcall, int szof)
-{
-       if (!sym->s_used) {
-               sym->s_used = 1;
-               STRUCT_ASSIGN(sym->s_upos, curr_pos);
-       }
-       /*
-        * for function calls another record is written
-        *
-        * XXX Should symbols used in sizeof() treated as used or not?
-        * Probably not, because there is no sense to declare an
-        * external variable only to get their size.
-        */
-       if (!fcall && !szof && sym->s_kind == FVFT && sym->s_scl == EXTERN)
-               outusg(sym);
-}
-
-/*
- * Prints warnings for a list of variables and labels (concatenated
- * with s_dlnxt) if these are not used or only set.
- */
-void
-chkusage(dinfo_t *di)
-{
-       sym_t   *sym;
-       int     mknowarn;
-
-       /* for this warnings LINTED has no effect */
-       mknowarn = nowarn;
-       nowarn = 0;
-
-       for (sym = di->d_dlsyms; sym != NULL; sym = sym->s_dlnxt)
-               chkusg1(di->d_asm, sym);
-
-       nowarn = mknowarn;
-}
-
-/*
- * Prints a warning for a single variable or label if it is not used or
- * only set.
- */
-void
-chkusg1(int novar, sym_t *sym)
-{
-       pos_t   cpos;
-
-       if (sym->s_blklev == -1)
-               return;
-
-       STRUCT_ASSIGN(cpos, curr_pos);
-
-       if (sym->s_kind == FVFT) {
-               if (sym->s_arg) {
-                       chkausg(novar, sym);
-               } else {
-                       chkvusg(novar, sym);
-               }
-       } else if (sym->s_kind == FLAB) {
-               chklusg(sym);
-       } else if (sym->s_kind == FTAG) {
-               chktusg(sym);
-       }
-
-       STRUCT_ASSIGN(curr_pos, cpos);
-}
-
-static void
-chkausg(int novar, sym_t *arg)
-{
-       if (!arg->s_set)
-               lerror("chkausg() 1");
-
-       if (novar)
-               return;
-
-       if (!arg->s_used && vflag) {
-               STRUCT_ASSIGN(curr_pos, arg->s_dpos);
-               /* argument %s unused in function %s */
-               warning(231, arg->s_name, funcsym->s_name);
-       }
-}
-
-static void
-chkvusg(int novar, sym_t *sym)
-{
-       scl_t   sc;
-       sym_t   *xsym;
-
-       if (blklev == 0 || sym->s_blklev == 0)
-               lerror("chkvusg() 1");
-
-       /* errors in expressions easily cause lots of these warnings */
-       if (nerr != 0)
-               return;
-
-       /*
-        * XXX Only variables are checkd, although types should
-        * probably also be checked
-        */
-       if ((sc = sym->s_scl) != EXTERN && sc != STATIC &&
-           sc != AUTO && sc != REG) {
-               return;
-       }
-
-       if (novar)
-               return;
-
-       if (sc == EXTERN) {
-               if (!sym->s_used && !sym->s_set) {
-                       STRUCT_ASSIGN(curr_pos, sym->s_dpos);
-                       /* %s unused in function %s */
-                       warning(192, sym->s_name, funcsym->s_name);
-               }
-       } else {
-               if (sym->s_set && !sym->s_used) {
-                       STRUCT_ASSIGN(curr_pos, sym->s_spos);
-                       /* %s set but not used in function %s */
-                       warning(191, sym->s_name, funcsym->s_name);
-               } else if (!sym->s_used) {
-                       STRUCT_ASSIGN(curr_pos, sym->s_dpos);
-                       /* %s unused in function %s */
-                       warning(192, sym->s_name, funcsym->s_name);
-               }
-       }
-
-       if (sc == EXTERN) {
-               /*
-                * information about usage is taken over into the symbol
-                * tabel entry at level 0 if the symbol was locally declared
-                * as an external symbol.
-                *
-                * XXX This is wrong for symbols declared static at level 0
-                * if the usage information stems from sizeof(). This is
-                * because symbols at level 0 only used in sizeof() are
-                * considered to not be used.
-                */
-               if ((xsym = sym->s_xsym) != NULL) {
-                       if (sym->s_used && !xsym->s_used) {
-                               xsym->s_used = 1;
-                               STRUCT_ASSIGN(xsym->s_upos, sym->s_upos);
-                       }
-                       if (sym->s_set && !xsym->s_set) {
-                               xsym->s_set = 1;
-                               STRUCT_ASSIGN(xsym->s_spos, sym->s_spos);
-                       }
-               }
-       }
-}
-
-static void
-chklusg(sym_t *lab)
-{
-       if (blklev != 1 || lab->s_blklev != 1)
-               lerror("chklusg() 1");
-
-       if (lab->s_set && !lab->s_used) {
-               STRUCT_ASSIGN(curr_pos, lab->s_spos);
-               /* label %s unused in function %s */
-               warning(192, lab->s_name, funcsym->s_name);
-       } else if (!lab->s_set) {
-               STRUCT_ASSIGN(curr_pos, lab->s_upos);
-               /* undefined label %s */
-               warning(23, lab->s_name);
-       }
-}
-
-static void
-chktusg(sym_t *sym)
-{
-       if (!incompl(sym->s_type))
-               return;
-
-       /* complain alwasy about incomplet tags declared inside blocks */
-       if (!zflag || dcs->d_ctx != EXTERN)
-               return;
-
-       STRUCT_ASSIGN(curr_pos, sym->s_dpos);
-       switch (sym->s_type->t_tspec) {
-       case STRUCT:
-               /* struct %s never defined */
-               warning(233, sym->s_name);
-               break;
-       case UNION:
-               /* union %s never defined */
-               warning(234, sym->s_name);
-               break;
-       case ENUM:
-               /* enum %s never defined */
-               warning(235, sym->s_name);
-               break;
-       default:
-               lerror("chktusg() 1");
-       }
-}
-
-/*
- * Called after the entire translation unit has been parsed.
- * Changes tentative definitions in definitions.
- * Performs some tests on global Symbols. Detected Problems are:
- * - defined variables of incomplete type
- * - constant variables which are not initialized
- * - static symbols which are never used
- */
-void
-chkglsyms(void)
-{
-       sym_t   *sym;
-       pos_t   cpos;
-
-       if (blklev != 0 || dcs->d_nxt != NULL)
-               norecover();
-
-       STRUCT_ASSIGN(cpos, curr_pos);
-
-       for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
-               if (sym->s_blklev == -1)
-                       continue;
-               if (sym->s_kind == FVFT) {
-                       chkglvar(sym);
-               } else if (sym->s_kind == FTAG) {
-                       chktusg(sym);
-               } else {
-                       if (sym->s_kind != FMOS)
-                               lerror("chkglsyms() 1");
-               }
-       }
-
-       STRUCT_ASSIGN(curr_pos, cpos);
-}
-
-static void
-chkglvar(sym_t *sym)
-{
-       if (sym->s_scl == TYPEDEF || sym->s_scl == ENUMCON)
-               return;
-
-       if (sym->s_scl != EXTERN && sym->s_scl != STATIC)
-               lerror("chkglvar() 1");
-
-       glchksz(sym);
-
-       if (sym->s_scl == STATIC) {
-               if (sym->s_type->t_tspec == FUNC) {
-                       if (sym->s_used && sym->s_def != DEF) {
-                               STRUCT_ASSIGN(curr_pos, sym->s_upos);
-                               /* static func. called but not def.. */
-                               error(225, sym->s_name);
-                       }
-               }
-               if (!sym->s_used) {
-                       STRUCT_ASSIGN(curr_pos, sym->s_dpos);
-                       if (sym->s_type->t_tspec == FUNC) {
-                               if (sym->s_def == DEF) {
-                                       if (!sym->s_inline)
-                                               /* static function %s unused */
-                                               warning(236, sym->s_name);
-                               } else {
-                                       /* static function %s decl. but ... */
-                                       warning(290, sym->s_name);
-                               }
-                       } else if (!sym->s_set) {
-                               /* static variable %s unused */
-                               warning(226, sym->s_name);
-                       } else {
-                               /* static variable %s set but not used */
-                               warning(307, sym->s_name);
-                       }
-               }
-               if (!tflag && sym->s_def == TDEF && sym->s_type->t_const) {
-                       STRUCT_ASSIGN(curr_pos, sym->s_dpos);
-                       /* const object %s should have initializer */
-                       warning(227, sym->s_name);
-               }
-       }
-}
-
-static void
-glchksz(sym_t *sym)
-{
-       if (sym->s_def == TDEF) {
-               if (sym->s_type->t_tspec == FUNC)
-                       /*
-                        * this can happen if an syntax error occured
-                        * after a function declaration
-                        */
-                       return;
-               STRUCT_ASSIGN(curr_pos, sym->s_dpos);
-               if (length(sym->s_type, sym->s_name) == 0 &&
-                   sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
-                       /* empty array declaration: %s */
-                       if (tflag || (sym->s_scl == EXTERN && !sflag)) {
-                               warning(190, sym->s_name);
-                       } else {
-                               error(190, sym->s_name);
-                       }
-               }
-       }
-}
-
-/*
- * Prints information about location of previous definition/declaration.
- */
-void
-prevdecl(int msg, sym_t *psym)
-{
-       pos_t   cpos;
-
-       if (!rflag)
-               return;
-
-       STRUCT_ASSIGN(cpos, curr_pos);
-       STRUCT_ASSIGN(curr_pos, psym->s_dpos);
-       if (msg != -1) {
-               message(msg, psym->s_name);
-       } else if (psym->s_def == DEF || psym->s_def == TDEF) {
-               /* previous definition of %s */
-               message(261, psym->s_name);
-       } else {
-               /* previous declaration of %s */
-               message(260, psym->s_name);
-       }
-       STRUCT_ASSIGN(curr_pos, cpos);
-}
diff --git a/usr.bin/xlint/lint1/emit.c b/usr.bin/xlint/lint1/emit.c
deleted file mode 100644 (file)
index a06ba34..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/*     $NetBSD: emit.c,v 1.2 1995/07/03 21:24:00 cgd Exp $     */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * 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.5 2004/07/07 12:13:26 asmodai Exp $
- *
- * $NetBSD: emit.c,v 1.2 1995/07/03 21:24:00 cgd Exp $
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <err.h>
-
-#include "lint.h"
-
-/* name and handle of output file */
-static const   char *loname;
-static FILE    *lout;
-
-/* output buffer data */
-ob_t   ob;
-
-static void    outxbuf(void);
-
-
-/*
- * initialize output
- */
-void
-outopen(const char *name)
-{
-       loname = name;
-
-       /* Ausgabedatei oeffnen */
-       if ((lout = fopen(name, "w")) == NULL)
-               err(1, "cannot open '%s'", name);
-
-       /* Ausgabepuffer anlegen */
-       ob.o_len = 1024;
-       ob.o_end = (ob.o_buf = ob.o_nxt = xmalloc(ob.o_len)) + ob.o_len;
-}
-
-/*
- * flush output buffer and close file
- */
-void
-outclose(void)
-{
-       outclr();
-       if (fclose(lout) == EOF)
-               err(1, "cannot close '%s'", loname);
-}
-
-/*
- * resize output buffer
- */
-static void
-outxbuf(void)
-{
-       ptrdiff_t coffs;
-
-       coffs = ob.o_nxt - ob.o_buf;
-       ob.o_len *= 2;
-       ob.o_end = (ob.o_buf = xrealloc(ob.o_buf, ob.o_len)) + ob.o_len;
-       ob.o_nxt = ob.o_buf + coffs;
-}
-
-/*
- * reset output buffer
- * if it is not empty, it is flushed
- */
-void
-outclr(void)
-{
-       size_t  sz;
-
-       if (ob.o_buf != ob.o_nxt) {
-               outchar('\n');
-               sz = ob.o_nxt - ob.o_buf;
-               if (sz > ob.o_len)
-                       errx(1, "internal error: outclr() 1");
-               if (fwrite(ob.o_buf, sz, 1, lout) != 1)
-                       err(1, "cannot write to %s", loname);
-               ob.o_nxt = ob.o_buf;
-       }
-}
-
-/*
- * write a character to the output buffer
- */
-void
-outchar(int c)
-{
-       if (ob.o_nxt == ob.o_end)
-               outxbuf();
-       *ob.o_nxt++ = (char)c;
-}
-
-/*
- * write a character to the output buffer, qouted if necessary
- */
-void
-outqchar(int c)
-{
-       if (isprint(c) && c != '\\' && c != '"' && c != '\'') {
-               outchar(c);
-       } else {
-               outchar('\\');
-               switch (c) {
-               case '\\':
-                       outchar('\\');
-                       break;
-               case '"':
-                       outchar('"');
-                       break;
-               case '\'':
-                       outchar('\'');
-                       break;
-               case '\b':
-                       outchar('b');
-                       break;
-               case '\t':
-                       outchar('t');
-                       break;
-               case '\n':
-                       outchar('n');
-                       break;
-               case '\f':
-                       outchar('f');
-                       break;
-               case '\r':
-                       outchar('r');
-                       break;
-               case '\v':
-                       outchar('v');
-                       break;
-               case '\a':
-                       outchar('a');
-                       break;
-               default:
-                       outchar((((u_int)c >> 6) & 07) + '0');
-                       outchar((((u_int)c >> 3) & 07) + '0');
-                       outchar((c & 07) + '0');
-                       break;
-               }
-       }
-}
-
-/*
- * write a strint to the output buffer
- * the string must not contain any characters which
- * should be quoted
- */
-void
-outstrg(const char *s)
-{
-       while (*s != '\0') {
-               if (ob.o_nxt == ob.o_end)
-                       outxbuf();
-               *ob.o_nxt++ = *s++;
-       }
-}
-
-/*
- * write an integer value to toe output buffer
- */
-void
-outint(int i)
-{
-       if ((ob.o_end - ob.o_nxt) < 3 * sizeof (int))
-               outxbuf();
-       ob.o_nxt += sprintf(ob.o_nxt, "%d", i);
-}
-
-/*
- * write the name of a symbol to the output buffer
- * the name is preceded by its length
- */
-void
-outname(const char *name)
-{
-       if (name == NULL)
-               errx(1, "internal error: outname() 1");
-       outint((int)strlen(name));
-       outstrg(name);
-}
-
-/*
- * write the name of the .c source
- */
-void
-outsrc(const char *name)
-{
-       outclr();
-       outchar('S');
-       outstrg(name);
-}
diff --git a/usr.bin/xlint/lint1/emit1.c b/usr.bin/xlint/lint1/emit1.c
deleted file mode 100644 (file)
index c2d490b..0000000
+++ /dev/null
@@ -1,573 +0,0 @@
-/*     $NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $    */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $
- * $DragonFly: src/usr.bin/xlint/lint1/emit1.c,v 1.5 2004/07/07 12:13:26 asmodai Exp $
- */
-
-#include <ctype.h>
-
-#include "lint1.h"
-
-static void    outtt(sym_t *, sym_t *);
-static void    outfstrg(strg_t *);
-
-/*
- * Write type into the output buffer.
- * The type is written as a sequence of substrings, each of which describes a
- * node of type type_t
- * a node is coded as follows:
- *     char                    C
- *     signed char             s C
- *     unsigned char           u C
- *     short                   S
- *     unsigned short          u S
- *     int                     I
- *     unsigned int            u I
- *     long                    L
- *     unsigned long           u L
- *     long long               Q
- *     unsigned long long      u Q
- *     float                   s D
- *     double                  D
- *     long double             l D
- *     void                    V
- *     *                       P
- *     [n]                     A n
- *     ()                      F
- *     (void)                  F 0
- *     (n arguments)           F n arg1 arg2 ... argn
- *     (n arguments, ...)      F n arg1 arg2 ... argn-1 E
- *     (a, b, c, ...)          f n arg1 arg2 ...
- *     enum tag                e T tag_or_typename
- *     struct tag              s T tag_or_typename
- *     union tag               u T tag_or_typename
- *
- *     tag_or_typename         0                       no tag or type name
- *                             1 n tag                 Tag
- *                             2 n typename            only type name
- *
- * spaces are only for better readability
- * additionaly it is possible to prepend the characters 'c' (for const)
- * and 'v' (for volatile)
- */
-void
-outtype(type_t *tp)
-{
-       int     t, s, na;
-       sym_t   *arg;
-       tspec_t ts;
-
-       while (tp != NULL) {
-               if ((ts = tp->t_tspec) == INT && tp->t_isenum)
-                       ts = ENUM;
-               switch (ts) {
-               case CHAR:      t = 'C';        s = '\0';       break;
-               case SCHAR:     t = 'C';        s = 's';        break;
-               case UCHAR:     t = 'C';        s = 'u';        break;
-               case SHORT:     t = 'S';        s = '\0';       break;
-               case USHORT:    t = 'S';        s = 'u';        break;
-               case INT:       t = 'I';        s = '\0';       break;
-               case UINT:      t = 'I';        s = 'u';        break;
-               case LONG:      t = 'L';        s = '\0';       break;
-               case ULONG:     t = 'L';        s = 'u';        break;
-               case QUAD:      t = 'Q';        s = '\0';       break;
-               case UQUAD:     t = 'Q';        s = 'u';        break;
-               case FLOAT:     t = 'D';        s = 's';        break;
-               case DOUBLE:    t = 'D';        s = '\0';       break;
-               case LDOUBLE:   t = 'D';        s = 'l';        break;
-               case VOID:      t = 'V';        s = '\0';       break;
-               case PTR:       t = 'P';        s = '\0';       break;
-               case ARRAY:     t = 'A';        s = '\0';       break;
-               case FUNC:      t = 'F';        s = '\0';       break;
-               case ENUM:      t = 'T';        s = 'e';        break;
-               case STRUCT:    t = 'T';        s = 's';        break;
-               case UNION:     t = 'T';        s = 'u';        break;
-               default:
-                       lerror("outtyp() 1");
-               }
-               if (tp->t_const)
-                       outchar('c');
-               if (tp->t_volatile)
-                       outchar('v');
-               if (s != '\0')
-                       outchar(s);
-               outchar(t);
-               if (ts == ARRAY) {
-                       outint(tp->t_dim);
-               } else if (ts == ENUM) {
-                       outtt(tp->t_enum->etag, tp->t_enum->etdef);
-               } else if (ts == STRUCT || ts == UNION) {
-                       outtt(tp->t_str->stag, tp->t_str->stdef);
-               } else if (ts == FUNC && tp->t_proto) {
-                       na = 0;
-                       for (arg = tp->t_args; arg != NULL; arg = arg->s_nxt)
-                                       na++;
-                       if (tp->t_vararg)
-                               na++;
-                       outint(na);
-                       for (arg = tp->t_args; arg != NULL; arg = arg->s_nxt)
-                               outtype(arg->s_type);
-                       if (tp->t_vararg)
-                               outchar('E');
-               }
-               tp = tp->t_subt;
-       }
-}
-
-/*
- * type to string
- * used for debugging output
- *
- * it uses its own output buffer for conversion
- */
-const char *
-ttos(type_t *tp)
-{
-       static  ob_t    tob;
-       ob_t    tmp;
-
-       if (tob.o_buf == NULL) {
-               tob.o_len = 64;
-               tob.o_buf = tob.o_nxt = xmalloc(tob.o_len);
-               tob.o_end = tob.o_buf + tob.o_len;
-       }
-
-       tmp = ob;
-       ob = tob;
-       ob.o_nxt = ob.o_buf;
-       outtype(tp);
-       outchar('\0');
-       tob = ob;
-       ob = tmp;
-
-       return (tob.o_buf);
-}
-
-/*
- * write the name of a tag or typename
- *
- * if the tag is named, the name of the
- * tag is written, otherwise, if a typename exists which
- * refers to this tag, this typename is written
- */
-static void
-outtt(sym_t *tag, sym_t *tdef)
-{
-       if (tag->s_name != unnamed) {
-               outint(1);
-               outname(tag->s_name);
-       } else if (tdef != NULL) {
-               outint(2);
-               outname(tdef->s_name);
-       } else {
-               outint(0);
-       }
-}
-
-/*
- * write information about an global declared/defined symbol
- * with storage class extern
- *
- * informations about function definitions are written in outfdef(),
- * not here
- */
-void
-outsym(sym_t *sym, scl_t sc, def_t def)
-{
-       /*
-        * Static function declarations must also be written to the output
-        * file. Compatibility of function declarations (for both static
-        * and extern functions) must be checked in lint2. Lint1 can't do
-        * this, especially not, if functions are declared at block level
-        * before their first declaration at level 0.
-        */
-       if (sc != EXTERN && !(sc == STATIC && sym->s_type->t_tspec == FUNC))
-               return;
-
-       /* reset buffer */
-       outclr();
-
-       /*
-        * line number of .c source, 'd' for declaration, Id of current
-        * source (.c or .h), and line in current source.
-        */
-       outint(csrc_pos.p_line);
-       outchar('d');
-       outint(getfnid(sym->s_dpos.p_file));
-       outchar('.');
-       outint(sym->s_dpos.p_line);
-
-       /* flags */
-
-       switch (def) {
-       case DEF:
-               /* defined */
-               outchar('d');
-               break;
-       case TDEF:
-               /* tentative defined */
-               outchar('t');
-               break;
-       case DECL:
-               /* declared */
-               outchar('e');
-               break;
-       default:
-               lerror("outsym() 2");
-       }
-       if (llibflg && def != DECL) {
-               /*
-                * mark it as used so we get no warnings from lint2 about
-                * unused symbols in libraries.
-                */
-               outchar('u');
-       }
-
-       if (sc == STATIC)
-               outchar('s');
-
-       /* name of the symbol */
-       outname(sym->s_name);
-
-       /* type of the symbol */
-       outtype(sym->s_type);
-}
-
-/*
- * write information about function definition
- *
- * this is also done for static functions so we are able to check if
- * they are called with proper argument types
- */
-void
-outfdef(sym_t *fsym, pos_t *posp, int rval, int osdef, sym_t *args)
-{
-       int     narg;
-       sym_t   *arg;
-
-       /* reset the buffer */
-       outclr();
-
-       /*
-        * line number of .c source, 'd' for declaration, Id of current
-        * source (.c or .h), and line in current source
-        *
-        * we are already at the end of the function. If we are in the
-        * .c source, posp->p_line is correct, otherwise csrc_pos.p_line
-        * (for functions defined in header files).
-        */
-       if (posp->p_file == csrc_pos.p_file) {
-               outint(posp->p_line);
-       } else {
-               outint(csrc_pos.p_line);
-       }
-       outchar('d');
-       outint(getfnid(posp->p_file));
-       outchar('.');
-       outint(posp->p_line);
-
-       /* flags */
-
-       /* both SCANFLIKE and PRINTFLIKE imply VARARGS */
-       if (prflstrg != -1) {
-               nvararg = prflstrg;
-       } else if (scflstrg != -1) {
-               nvararg = scflstrg;
-       }
-
-       if (nvararg != -1) {
-               outchar('v');
-               outint(nvararg);
-       }
-       if (scflstrg != -1) {
-               outchar('S');
-               outint(scflstrg);
-       }
-       if (prflstrg != -1) {
-               outchar('P');
-               outint(prflstrg);
-       }
-       nvararg = prflstrg = scflstrg = -1;
-
-       outchar('d');
-
-       if (rval)
-               /* has return value */
-               outchar('r');
-
-       if (llibflg)
-               /*
-                * mark it as used so lint2 does not complain about
-                * unused symbols in libraries
-                */
-               outchar('u');
-
-       if (osdef)
-               /* old style function definition */
-               outchar('o');
-
-       if (fsym->s_scl == STATIC)
-               outchar('s');
-
-       /* name of function */
-       outname(fsym->s_name);
-
-       /* argument types and return value */
-       if (osdef) {
-               narg = 0;
-               for (arg = args; arg != NULL; arg = arg->s_nxt)
-                       narg++;
-               outchar('f');
-               outint(narg);
-               for (arg = args; arg != NULL; arg = arg->s_nxt)
-                       outtype(arg->s_type);
-               outtype(fsym->s_type->t_subt);
-       } else {
-               outtype(fsym->s_type);
-       }
-}
-
-/*
- * write out all information necessary for lint2 to check function
- * calls
- *
- * rvused is set if the return value is used (asigned to a variable)
- * rvdisc is set if the return value is not used and not ignored
- * (casted to void)
- */
-void
-outcall(tnode_t *tn, int rvused, int rvdisc)
-{
-       tnode_t *args, *arg;
-       int     narg, n, i;
-       quad_t  q;
-       tspec_t t;
-
-       /* reset buffer */
-       outclr();
-
-       /*
-        * line number of .c source, 'c' for function call, Id of current
-        * source (.c or .h), and line in current source
-        */
-       outint(csrc_pos.p_line);
-       outchar('c');
-       outint(getfnid(curr_pos.p_file));
-       outchar('.');
-       outint(curr_pos.p_line);
-
-       /*
-        * flags; 'u' and 'i' must be last to make sure a letter
-        * is between the numeric argument of a flag and the name of
-        * the function
-        */
-       narg = 0;
-       args = tn->tn_right;
-       for (arg = args; arg != NULL; arg = arg->tn_right)
-               narg++;
-       /* informations about arguments */
-       for (n = 1; n <= narg; n++) {
-               /* the last argument is the top one in the tree */
-               for (i = narg, arg = args; i > n; i--, arg = arg->tn_right) ;
-               arg = arg->tn_left;
-               if (arg->tn_op == CON) {
-                       if (isityp(t = arg->tn_type->t_tspec)) {
-                               /*
-                                * XXX it would probably be better to
-                                * explizitly test the sign
-                                */
-                               if ((q = arg->tn_val->v_quad) == 0) {
-                                       /* zero constant */
-                                       outchar('z');
-                               } else if (msb(q, t, 0) == 0) {
-                                       /* positive if casted to signed */
-                                       outchar('p');
-                               } else {
-                                       /* negative if casted to signed */
-                                       outchar('n');
-                               }
-                               outint(n);
-                       }
-               } else if (arg->tn_op == AMPER &&
-                          arg->tn_left->tn_op == STRING &&
-                          arg->tn_left->tn_strg->st_tspec == CHAR) {
-                       /* constant string, write all format specifiers */
-                       outchar('s');
-                       outint(n);
-                       outfstrg(arg->tn_left->tn_strg);
-               }
-
-       }
-       /* return value discarded/used/ignored */
-       outchar(rvdisc ? 'd' : (rvused ? 'u' : 'i'));
-
-       /* name of the called function */
-       outname(tn->tn_left->tn_left->tn_sym->s_name);
-
-       /* types of arguments */
-       outchar('f');
-       outint(narg);
-       for (n = 1; n <= narg; n++) {
-               /* the last argument is the top one in the tree */
-               for (i = narg, arg = args; i > n; i--, arg = arg->tn_right) ;
-               outtype(arg->tn_left->tn_type);
-       }
-       /* expected type of return value */
-       outtype(tn->tn_type);
-}
-
-/*
- * extracts potential format specifiers for printf() and scanf() and
- * writes them, enclosed in "" and qouted if necessary, to the output buffer
- */
-static void
-outfstrg(strg_t *strg)
-{
-       int     c, oc, first;
-       u_char  *cp;
-
-       if (strg->st_tspec != CHAR)
-               lerror("outfstrg() 1");
-
-       cp = strg->st_cp;
-
-       outchar('"');
-
-       c = *cp++;
-
-       while (c != '\0') {
-
-               if (c != '%') {
-                       c = *cp++;
-                       continue;
-               }
-
-               outqchar('%');
-               c = *cp++;
-
-               /* flags for printf and scanf and *-fieldwidth for printf */
-               while (c != '\0' && (c == '-' || c == '+' || c == ' ' ||
-                                    c == '#' || c == '0' || c == '*')) {
-                       outqchar(c);
-                       c = *cp++;
-               }
-
-               /* numeric field width */
-               while (c != '\0' && isdigit(c)) {
-                       outqchar(c);
-                       c = *cp++;
-               }
-
-               /* precision for printf */
-               if (c == '.') {
-                       outqchar(c);
-                       if ((c = *cp++) == '*') {
-                               outqchar(c);
-                               c = *cp++;
-                       } else {
-                               while (c != '\0' && isdigit(c)) {
-                                       outqchar(c);
-                                       c = *cp++;
-                               }
-                       }
-               }
-
-               /* h, l, L and q flags fpr printf and scanf */
-               if (c == 'h' || c == 'l' || c == 'L' || c == 'q') {
-                       outqchar(c);
-                       c = *cp++;
-               }
-
-               /*
-                * The last character. It is always written so we can detect
-                * invalid format specifiers.
-                */
-               if (c != '\0') {
-                       outqchar(c);
-                       oc = c;
-                       c = *cp++;
-                       /*
-                        * handle [ for scanf. [-] means that a minus sign
-                        * was found at an undefined position.
-                        */
-                       if (oc == '[') {
-                               if (c == '^')
-                                       c = *cp++;
-                               if (c == ']')
-                                       c = *cp++;
-                               first = 1;
-                               while (c != '\0' && c != ']') {
-                                       if (c == '-') {
-                                               if (!first && *cp != ']')
-                                                       outqchar(c);
-                                       }
-                                       first = 0;
-                                       c = *cp++;
-                               }
-                               if (c == ']') {
-                                       outqchar(c);
-                                       c = *cp++;
-                               }
-                       }
-               }
-
-       }
-
-       outchar('"');
-}
-
-/*
- * writes a record if sym was used
- */
-void
-outusg(sym_t *sym)
-{
-       /* reset buffer */
-       outclr();
-
-       /*
-        * line number of .c source, 'u' for used, Id of current
-        * source (.c or .h), and line in current source
-        */
-       outint(csrc_pos.p_line);
-       outchar('u');
-       outint(getfnid(curr_pos.p_file));
-       outchar('.');
-       outint(curr_pos.p_line);
-
-       /* necessary to delimit both numbers */
-       outchar('x');
-
-       /* Den Namen des Symbols ausgeben */
-       outname(sym->s_name);
-}
diff --git a/usr.bin/xlint/lint1/err.c b/usr.bin/xlint/lint1/err.c
deleted file mode 100644 (file)
index 30070c8..0000000
+++ /dev/null
@@ -1,483 +0,0 @@
-/*     $NetBSD: err.c,v 1.8 1995/10/02 17:37:00 jpo Exp $      */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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: err.c,v 1.8 1995/10/02 17:37:00 jpo Exp $
- * $DragonFly: src/usr.bin/xlint/lint1/err.c,v 1.7 2008/04/20 13:44:26 swildner Exp $
- */
-
-/* number of errors found */
-int    nerr;
-
-/* number of syntax errors */
-int    sytxerr;
-
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "lint1.h"
-
-static const   char *basename(const char *);
-static void    verror(int, va_list);
-static void    vwarning(int, va_list);
-
-
-const  char *msgs[] = {
-       "syntax error: empty declaration",                            /* 0 */
-       "old style declaration; add int",                             /* 1 */
-       "empty declaration",                                          /* 2 */
-       "%s declared in argument declaration list",                   /* 3 */
-       "illegal type combination",                                   /* 4 */
-       "modifying typedef with '%s'; only qualifiers allowed",       /* 5 */
-       "use 'double' instead of 'long float'",                       /* 6 */
-       "only one storage class allowed",                             /* 7 */
-       "illegal storage class",                                      /* 8 */
-       "only register valid as formal parameter storage class",      /* 9 */
-       "duplicate '%s'",                                             /* 10 */
-       "bit-field initializer out of range",                         /* 11 */
-       "compiler takes size of function",                            /* 12 */
-       "incomplete enum type: %s",                                   /* 13 */
-       "compiler takes alignment of function",                       /* 14 */
-       "function returns illegal type",                              /* 15 */
-       "array of function is illegal",                               /* 16 */
-       "null dimension",                                             /* 17 */
-       "illegal use of 'void'",                                      /* 18 */
-       "void type for %s",                                           /* 19 */
-       "zero or negative array dimension",                           /* 20 */
-       "redeclaration of formal parameter %s",                       /* 21 */
-       "incomplete or misplaced function definition",                /* 22 */
-       "undefined label %s",                                         /* 23 */
-       "cannot initialize function: %s",                             /* 24 */
-       "cannot initialize typedef: %s",                              /* 25 */
-       "cannot initialize extern declaration: %s",                   /* 26 */
-       "redeclaration of %s",                                        /* 27 */
-       "redefinition of %s",                                         /* 28 */
-       "previously declared extern, becomes static: %s",             /* 29 */
-       "redeclaration of %s; ANSI C requires static",                /* 30 */
-       "incomplete structure or union %s: %s",                       /* 31 */
-       "argument type defaults to 'int': %s",                        /* 32 */
-       "duplicate member name: %s",                                  /* 33 */
-       "nonportable bit-field type",                                 /* 34 */
-       "illegal bit-field type",                                     /* 35 */
-       "illegal bit-field size",                                     /* 36 */
-       "zero size bit-field",                                        /* 37 */
-       "function illegal in structure or union",                     /* 38 */
-       "illegal zero sized structure member: %s",                    /* 39 */
-       "unknown size: %s",                                           /* 40 */
-       "illegal use of bit-field",                                   /* 41 */
-       "forward reference to enum type",                             /* 42 */
-       "redefinition hides earlier one: %s",                         /* 43 */
-       "declaration introduces new type in ANSI C: %s %s",           /* 44 */
-       "base type is really '%s %s'",                                /* 45 */
-       "(%s) tag redeclared",                                        /* 46 */
-       "zero sized %s",                                              /* 47 */
-       "overflow in enumeration values: %s",                         /* 48 */
-       "struct or union member must be named",                       /* 49 */
-       "a function is declared as an argument: %s",                  /* 50 */
-       "parameter mismatch: %d declared, %d defined",                /* 51 */
-       "cannot initialize parameter: %s",                            /* 52 */
-       "declared argument %s is missing",                            /* 53 */
-       "trailing ',' prohibited in enum declaration",                /* 54 */
-       "integral constant expression expected",                      /* 55 */
-       "integral constant too large",                                /* 56 */
-       "enumeration constant hides parameter: %s",                   /* 57 */
-       "type does not match prototype: %s",                          /* 58 */
-       "formal parameter lacks name: param #%d",                     /* 59 */
-       "void must be sole parameter",                                /* 60 */
-       "void parameter cannot have name: %s",                        /* 61 */
-       "function prototype parameters must have types",              /* 62 */
-       "prototype does not match old-style definition",              /* 63 */
-       "()-less function definition",                                /* 64 */
-       "%s has no named members",                                    /* 65 */
-       "syntax requires ';' after last struct/union member",         /* 66 */
-       "cannot return incomplete type",                              /* 67 */
-       "typedef already qualified with '%s'",                        /* 68 */
-       "inappropriate qualifiers with 'void'",                       /* 69 */
-       "%soperand of '%s' is unsigned in ANSI C",                    /* 70 */
-       "too many characters in character constant",                  /* 71 */
-       "typedef declares no type name",                              /* 72 */
-       "empty character constant",                                   /* 73 */
-       "no hex digits follow \\x",                                   /* 74 */
-       "overflow in hex escape",                                     /* 75 */
-       "character escape does not fit in character",                 /* 76 */
-       "bad octal digit %c",                                         /* 77 */
-       "nonportable character escape",                               /* 78 */
-       "dubious escape \\%c",                                        /* 79 */
-       "dubious escape \\%o",                                        /* 80 */
-       "\\a undefined in traditional C",                             /* 81 */
-       "\\x undefined in traditional C",                             /* 82 */
-       "storage class after type is obsolescent",                    /* 83 */
-       "ANSI C requires formal parameter before '...'",              /* 84 */
-       "dubious tag declaration: %s %s",                             /* 85 */
-       "automatic hides external declaration: %s",                   /* 86 */
-       "static hides external declaration: %s",                      /* 87 */
-       "typedef hides external declaration: %s",                     /* 88 */
-       "typedef redeclared: %s",                                     /* 89 */
-       "inconsistent redeclaration of extern: %s",                   /* 90 */
-       "declaration hides parameter: %s",                            /* 91 */
-       "inconsistent redeclaration of static: %s",                   /* 92 */
-       "dubious static function at block level: %s",                 /* 93 */
-       "function has illegal storage class: %s",                     /* 94 */
-       "declaration hides earlier one: %s",                          /* 95 */
-       "cannot dereference non-pointer type",                        /* 96 */
-       "suffix U is illegal in traditional C",                       /* 97 */
-       "suffixes F and L are illegal in traditional C",              /* 98 */
-       "%s undefined",                                               /* 99 */
-       "unary + is illegal in traditional C",                        /* 100 */
-       "undefined struct/union member: %s",                          /* 101 */
-       "illegal member use: %s",                                     /* 102 */
-       "left operand of '.' must be struct/union object",            /* 103 */
-       "left operand of '->' must be pointer to struct/union",       /* 104 */
-       "non-unique member requires struct/union %s",                 /* 105 */
-       "left operand of '->' must be pointer",                       /* 106 */
-       "operands of '%s' have incompatible types",                   /* 107 */
-       "operand of '%s' has incompatible type",                      /* 108 */
-       "void type illegal in expression",                            /* 109 */
-       "pointer to function is not allowed here",                    /* 110 */
-       "unacceptable operand of '%s'",                               /* 111 */
-       "cannot take address of bit-field",                           /* 112 */
-       "cannot take address of register %s",                         /* 113 */
-       "%soperand of '%s' must be lvalue",                           /* 114 */
-       "%soperand of '%s' must be modifiable lvalue",                /* 115 */
-       "illegal pointer subtraction",                                /* 116 */
-       "bitwise operation on signed value possibly nonportable",     /* 117 */
-       "semantics of '%s' change in ANSI C; use explicit cast",      /* 118 */
-       "conversion of '%s' to '%s' is out of range",                 /* 119 */
-       "bitwise operation on signed value nonportable",              /* 120 */
-       "negative shift",                                             /* 121 */
-       "shift greater than size of object",                          /* 122 */
-       "illegal combination of pointer and integer, op %s",          /* 123 */
-       "illegal pointer combination, op %s",                         /* 124 */
-       "ANSI C forbids ordered comparisons of pointers to functions",/* 125 */
-       "incompatible types in conditional",                          /* 126 */
-       "'&' before array or function: ignored",                      /* 127 */
-       "operands have incompatible pointer types, op %s",            /* 128 */
-       "expression has null effect",                                 /* 129 */
-       "enum type mismatch, op %s",                                  /* 130 */
-       "conversion to '%s' may sign-extend incorrectly",             /* 131 */
-       "conversion from '%s' may lose accuracy",                     /* 132 */
-       "conversion of pointer to '%s' loses bits",                   /* 133 */
-       "conversion of pointer to '%s' may lose bits",                /* 134 */
-       "possible pointer alignment problem",                         /* 135 */
-       "cannot do pointer arithmetic on operand of unknown size",    /* 136 */
-       "use of incomplete enum type, op %s",                         /* 137 */
-       "unknown operand size, op %s",                                /* 138 */
-       "division by 0",                                              /* 139 */
-       "modulus by 0",                                               /* 140 */
-       "integer overflow detected, op %s",                           /* 141 */
-       "floating point overflow detected, op %s",                    /* 142 */
-       "cannot take size of incomplete type",                        /* 143 */
-       "cannot take size of function",                               /* 144 */
-       "cannot take size of bit-field",                              /* 145 */
-       "cannot take size of void",                                   /* 146 */
-       "invalid cast expression",                                    /* 147 */
-       "improper cast of void expression",                           /* 148 */
-       "illegal function",                                           /* 149 */
-       "argument mismatch: %d arg%s passed, %d expected",            /* 150 */
-       "void expressions may not be arguments, arg #%d",             /* 151 */
-       "argument cannot have unknown size, arg #%d",                 /* 152 */
-       "argument has incompatible pointer type, arg #%d",            /* 153 */
-       "illegal combination of pointer and integer, arg #%d",        /* 154 */
-       "argument is incompatible with prototype, arg #%d",           /* 155 */
-       "enum type mismatch, arg #%d",                                /* 156 */
-       "ANSI C treats constant as unsigned",                         /* 157 */
-       "%s may be used before set",                                  /* 158 */
-       "assignment in conditional context",                          /* 159 */
-       "operator '==' found where '=' was expected",                 /* 160 */
-       "constant in conditional context",                            /* 161 */
-       "comparison of %s with %s, op %s",                            /* 162 */
-       "a cast does not yield an lvalue",                            /* 163 */
-       "assignment of negative constant to unsigned type",           /* 164 */
-       "constant truncated by assignment",                           /* 165 */
-       "precision lost in bit-field assignment",                     /* 166 */
-       "array subscript cannot be negative: %ld",                    /* 167 */
-       "array subscript cannot be > %d: %ld",                        /* 168 */
-       "precedence confusion possible: parenthesize!",               /* 169 */
-       "first operand must have scalar type, op ? :",                /* 170 */
-       "assignment type mismatch",                                   /* 171 */
-       "too many struct/union initializers",                         /* 172 */
-       "too many array initializers",                                /* 173 */
-       "too many initializers",                                      /* 174 */
-       "initialisation of an incomplete type",                       /* 175 */
-       "invalid initializer",                                        /* 176 */
-       "non-constant initializer",                                   /* 177 */
-       "initializer does not fit",                                   /* 178 */
-       "cannot initialize struct/union with no named member",        /* 179 */
-       "bit-field initializer does not fit",                         /* 180 */
-       "{}-enclosed initializer required",                           /* 181 */
-       "incompatible pointer types",                                 /* 182 */
-       "illegal combination of pointer and integer",                 /* 183 */
-       "illegal pointer combination",                                /* 184 */
-       "initialisation type mismatch",                               /* 185 */
-       "bit-field initialisation is illegal in traditional C",       /* 186 */
-       "non-null byte ignored in string initializer",                /* 187 */
-       "no automatic aggregate initialization in traditional C",     /* 188 */
-       "assignment of struct/union illegal in traditional C",        /* 189 */
-       "empty array declaration: %s",                                /* 190 */
-       "%s set but not used in function %s",                         /* 191 */
-       "%s unused in function %s",                                   /* 192 */
-       "statement not reached",                                      /* 193 */
-       "label %s redefined",                                         /* 194 */
-       "case not in switch",                                         /* 195 */
-       "case label affected by conversion",                          /* 196 */
-       "non-constant case expression",                               /* 197 */
-       "non-integral case expression",                               /* 198 */
-       "duplicate case in switch: %ld",                              /* 199 */
-       "duplicate case in switch: %lu",                              /* 200 */
-       "default outside switch",                                     /* 201 */
-       "duplicate default in switch",                                /* 202 */
-       "case label must be of type `int' in traditional C",          /* 203 */
-       "controlling expressions must have scalar type",              /* 204 */
-       "switch expression must have integral type",                  /* 205 */
-       "enumeration value(s) not handled in switch",                 /* 206 */
-       "loop not entered at top",                                    /* 207 */
-       "break outside loop or switch",                               /* 208 */
-       "continue outside loop",                                      /* 209 */
-       "enum type mismatch in initialisation",                       /* 210 */
-       "return value type mismatch",                                 /* 211 */
-       "cannot return incomplete type",                              /* 212 */
-       "void function %s cannot return value",                       /* 213 */
-       "function %s expects to return value",                        /* 214 */
-       "function implicitly declared to return int",                 /* 215 */
-       "function %s has return (e); and return;",                    /* 216 */
-       "function %s falls off bottom without returning value",       /* 217 */
-       "ANSI C treats constant as unsigned, op %s",                  /* 218 */
-       "concatenated strings are illegal in traditional C",          /* 219 */
-       "fallthrough on case statement",                              /* 220 */
-       "initialisation of unsigned with negative constant",          /* 221 */
-       "conversion of negative constant to unsigned type",           /* 222 */
-       "end-of-loop code not reached",                               /* 223 */
-       "cannot recover from previous errors",                        /* 224 */
-       "static function called but not defined: %s()",               /* 225 */
-       "static variable %s unused",                                  /* 226 */
-       "const object %s should have initializer",                    /* 227 */
-       "function cannot return const or volatile object",            /* 228 */
-       "questionable conversion of function pointer",                /* 229 */
-       "nonportable character comparison, op %s",                    /* 230 */
-       "argument %s unused in function %s",                          /* 231 */
-       "label %s unused in function %s",                             /* 232 */
-       "struct %s never defined",                                    /* 233 */
-       "union %s never defined",                                     /* 234 */
-       "enum %s never defined",                                      /* 235 */
-       "static function %s unused",                                  /* 236 */
-       "redeclaration of formal parameter %s",                       /* 237 */
-       "initialisation of union is illegal in traditional C",        /* 238 */
-       "constant argument to NOT",                                   /* 239 */
-       "assignment of different structures",                         /* 240 */
-       "dubious operation on enum, op %s",                           /* 241 */
-       "combination of '%s' and '%s', op %s",                        /* 242 */
-       "dubious comparison of enums, op %s",                         /* 243 */
-       "illegal structure pointer combination",                      /* 244 */
-       "illegal structure pointer combination, op %s",               /* 245 */
-       "dubious conversion of enum to '%s'",                         /* 246 */
-       "pointer casts may be troublesome",                           /* 247 */
-       "floating-point constant out of range",                       /* 248 */
-       "syntax error",                                               /* 249 */
-       "unknown character \\%o",                                     /* 250 */
-       "malformed integer constant",                                 /* 251 */
-       "integer constant out of range",                              /* 252 */
-       "unterminated character constant",                            /* 253 */
-       "newline in string or char constant",                         /* 254 */
-       "undefined or invalid # directive",                           /* 255 */
-       "unterminated comment",                                       /* 256 */
-       "extra characters in lint comment",                           /* 257 */
-       "unterminated string constant",                               /* 258 */
-       "conversion to '%s' due to prototype, arg #%d",               /* 259 */
-       "previous declaration of %s",                                 /* 260 */
-       "previous definition of %s",                                  /* 261 */
-       "\\\" inside character constants undefined in traditional C", /* 262 */
-       "\\? undefined in traditional C",                             /* 263 */
-       "\\v undefined in traditional C",                             /* 264 */
-       "%s C does not support 'long long'",                          /* 265 */
-       "'long double' is illegal in traditional C",                  /* 266 */
-       "shift equal to size of object",                              /* 267 */
-       "variable declared inline: %s",                               /* 268 */
-       "argument declared inline: %s",                               /* 269 */
-       "function prototypes are illegal in traditional C",           /* 270 */
-       "switch expression must be of type `int' in traditional C",   /* 271 */
-       "empty translation unit",                                     /* 272 */
-       "bit-field type '%s' invalid in ANSI C",                      /* 273 */
-       "ANSI C forbids comparison of %s with %s",                    /* 274 */
-       "cast discards 'const' from pointer target type",             /* 275 */
-       "",                                                           /* 276 */
-       "initialisation of '%s' with '%s'",                           /* 277 */
-       "combination of '%s' and '%s', arg #%d",                      /* 278 */
-       "combination of '%s' and '%s' in return",                     /* 279 */
-       "must be outside function: /* %s */",                         /* 280 */
-       "duplicate use of /* %s */",                                  /* 281 */
-       "must precede function definition: /* %s */",                 /* 282 */
-       "argument number mismatch with directive: /* %s */",          /* 283 */
-       "fallthrough on default statement",                           /* 284 */
-       "prototype declaration",                                      /* 285 */
-       "function definition is not a prototype",                     /* 286 */
-       "function declaration is not a prototype",                    /* 287 */
-       "dubious use of /* VARARGS */ with /* %s */",                 /* 288 */
-       "can't be used together: /* PRINTFLIKE */ /* SCANFLIKE */",   /* 289 */
-       "static function %s declared but not defined",                /* 290 */
-       "invalid multibyte character",                                /* 291 */
-       "cannot concatenate wide and regular string literals",        /* 292 */
-       "argument %d must be 'char *' for PRINTFLIKE/SCANFLIKE",      /* 293 */
-       "multi-character character constant",                         /* 294 */
-       "conversion of '%s' to '%s' is out of range, arg #%d",        /* 295 */
-       "conversion of negative constant to unsigned type, arg #%d",  /* 296 */
-       "conversion to '%s' may sign-extend incorrectly, arg #%d",    /* 297 */
-       "conversion from '%s' may lose accuracy, arg #%d",            /* 298 */
-       "prototype does not match old style definition, arg #%d",     /* 299 */
-       "old style definition",                                       /* 300 */
-       "array of incomplete type",                                   /* 301 */
-       "%s returns pointer to automatic object",                     /* 302 */
-       "ANSI C forbids conversion of %s to %s",                      /* 303 */
-       "ANSI C forbids conversion of %s to %s, arg #%d",             /* 304 */
-       "ANSI C forbids conversion of %s to %s, op %s",               /* 305 */
-       "constant truncated by conversion, op %s",                    /* 306 */
-       "static variable %s set but not used",                        /* 307 */
-       "",                                                           /* 308 */
-       "extra bits set to 0 in conversion of '%s' to '%s', op %s",   /* 309 */
-};
-
-/*
- * If Fflag is not set basename() returns a pointer to the last
- * component of the path, otherwise it returns the argument.
- */
-static const char *
-basename(const char *path)
-{
-       const   char *cp, *cp1, *cp2;
-
-       if (Fflag)
-               return (path);
-
-       cp = cp1 = cp2 = path;
-       while (*cp != '\0') {
-               if (*cp++ == '/') {
-                       cp2 = cp1;
-                       cp1 = cp;
-               }
-       }
-       return (*cp1 == '\0' ? cp2 : cp1);
-}
-
-static void
-verror(int n, va_list ap)
-{
-       const   char *fn;
-
-       fn = basename(curr_pos.p_file);
-       (void)printf("%s:%d: ", fn, curr_pos.p_line);
-       (void)vprintf(msgs[n], ap);
-       (void)printf("\n");
-       nerr++;
-}
-
-static void
-vwarning(int n, va_list ap)
-{
-       const   char *fn;
-
-       if (nowarn)
-               /* this warning is suppressed by a LINTED comment */
-               return;
-
-       fn = basename(curr_pos.p_file);
-       (void)printf("%s:%d: warning: ", fn, curr_pos.p_line);
-       (void)vprintf(msgs[n], ap);
-       (void)printf("\n");
-}
-
-void
-error(int n, ...)
-{
-       va_list ap;
-
-       va_start(ap, n);
-       verror(n, ap);
-       va_end(ap);
-}
-
-void
-lerror(const char *msg, ...)
-{
-       va_list ap;
-       const   char *fn;
-
-       va_start(ap, msg);
-       fn = basename(curr_pos.p_file);
-       (void)fprintf(stderr, "%s:%d: lint error: ", fn, curr_pos.p_line);
-       (void)vfprintf(stderr, msg, ap);
-       (void)fprintf(stderr, "\n");
-       va_end(ap);
-       exit(1);
-}
-
-void
-warning(int n, ...)
-{
-       va_list ap;
-
-       va_start(ap, n);
-       vwarning(n, ap);
-       va_end(ap);
-}
-
-void
-message(int n, ...)
-{
-       va_list ap;
-       const   char *fn;
-
-       va_start(ap, n);
-       fn = basename(curr_pos.p_file);
-       (void)printf("%s:%d: ", fn, curr_pos.p_line);
-       (void)vprintf(msgs[n], ap);
-       (void)printf("\n");
-       va_end(ap);
-}
-
-int
-gnuism(int n, ...)
-{
-       va_list ap;
-       int     msg;
-
-       va_start(ap, n);
-       if (sflag && !gflag) {
-               verror(n, ap);
-               msg = 1;
-       } else if (!sflag && gflag) {
-               msg = 0;
-       } else {
-               vwarning(n, ap);
-               msg = 1;
-       }
-       va_end(ap);
-
-       return (msg);
-}
diff --git a/usr.bin/xlint/lint1/externs.h b/usr.bin/xlint/lint1/externs.h
deleted file mode 100644 (file)
index 1f2f7fa..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*     $NetBSD: externs.h,v 1.2 1995/07/03 21:24:06 cgd Exp $  */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $DragonFly: src/usr.bin/xlint/lint1/externs.h,v 1.3 2003/11/03 19:31:34 eirikn Exp $
- */
-
-/*
- * mem.c
- */
-extern void    *xmalloc(size_t);
-extern void    *xcalloc(size_t, size_t);
-extern void    *xrealloc(void *, size_t);
-extern char    *xstrdup(const char *);
-extern void    nomem(void);
-
-/*
- * emit.c
- */
-extern ob_t    ob;
-
-extern void    outopen(const char *);
-extern void    outclose(void);
-extern void    outclr(void);
-extern void    outchar(int);
-extern void    outqchar(int);
-extern void    outstrg(const char *);
-extern void    outint(int);
-extern void    outname(const char *);
-extern void    outsrc(const char *);
diff --git a/usr.bin/xlint/lint1/externs1.h b/usr.bin/xlint/lint1/externs1.h
deleted file mode 100644 (file)
index 74d4e27..0000000
+++ /dev/null
@@ -1,284 +0,0 @@
-/*     $NetBSD: externs1.h,v 1.7 1995/10/02 17:31:39 jpo Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: src/usr.bin/xlint/lint1/externs1.h,v 1.1.1.1.8.1 2001/07/19 01:28:12 kris Exp $
- * $DragonFly: src/usr.bin/xlint/lint1/externs1.h,v 1.3 2003/11/03 19:31:34 eirikn Exp $
- */
-
-/*
- * main.c
- */
-extern int     aflag;
-extern int     bflag;
-extern int     cflag;
-extern int     dflag;
-extern int     eflag;
-extern int     Fflag;
-extern int     gflag;
-extern int     hflag;
-extern int     pflag;
-extern int     rflag;
-extern int     sflag;
-extern int     tflag;
-extern int     uflag;
-extern int     vflag;
-extern int     yflag;
-extern int     zflag;
-
-extern void    norecover(void);
-
-/*
- * cgram.y
- */
-extern int     blklev;
-extern int     mblklev;
-extern int     yydebug;
-
-extern int     yyerror(char *);
-extern int     yyparse(void);
-
-/*
- * scan.l
- */
-extern pos_t   curr_pos;
-extern pos_t   csrc_pos;
-extern symt_t  symtyp;
-extern FILE    *yyin;
-extern u_quad_t qbmasks[], qlmasks[], qumasks[];
-
-extern void    initscan(void);
-extern int     sign(quad_t, tspec_t, int);
-extern int     msb(quad_t, tspec_t, int);
-extern quad_t  xsign(quad_t, tspec_t, int);
-extern void    clrwflgs(void);
-extern sym_t   *getsym(sbuf_t *);
-extern void    cleanup(void);
-extern sym_t   *pushdown(sym_t *);
-extern void    rmsym(sym_t *);
-extern void    rmsyms(sym_t *);
-extern void    inssym(int, sym_t *);
-extern void    freeyyv(void *, int);
-extern int     yylex(void);
-
-/*
- * mem1.c
- */
-extern const   char *fnalloc(const char *);
-extern const   char *fnnalloc(const char *, size_t);
-extern int     getfnid(const char *);
-
-extern void    initmem(void);
-
-extern void    *getblk(size_t);
-extern void    *getlblk(int, size_t);
-extern void    freeblk(void);
-extern void    freelblk(int);
-
-extern void    *tgetblk(size_t);
-extern tnode_t *getnode(void);
-extern void    tfreeblk(void);
-extern struct  mbl *tsave(void);
-extern void    trestor(struct mbl *);
-
-/*
- * err.c
- */
-extern int     nerr;
-extern int     sytxerr;
-extern const   char *msgs[];
-
-extern void    error(int, ...);
-extern void    warning(int, ...);
-extern void    message(int, ...);
-extern int     gnuism(int, ...);
-extern void    lerror(const char *, ...) __printflike(1, 2);
-
-/*
- * decl.c
- */
-extern dinfo_t *dcs;
-extern const   char *unnamed;
-extern int     enumval;
-
-extern void    initdecl(void);
-extern type_t  *gettyp(tspec_t);
-extern type_t  *duptyp(const type_t *);
-extern type_t  *tduptyp(const type_t *);
-extern int     incompl(type_t *);
-extern void    setcompl(type_t *, int);
-extern void    addscl(scl_t);
-extern void    addtype(type_t *);
-extern void    addqual(tqual_t);
-extern void    pushdecl(scl_t);
-extern void    popdecl(void);
-extern void    setasm(void);
-extern void    clrtyp(void);
-extern void    deftyp(void);
-extern int     length(type_t *, const char *);
-extern int     getbound(type_t *);
-extern sym_t   *lnklst(sym_t *, sym_t *);
-extern void    chktyp(sym_t *);
-extern sym_t   *decl1str(sym_t *);
-extern sym_t   *bitfield(sym_t *, int);
-extern pqinf_t *mergepq(pqinf_t *, pqinf_t *);
-extern sym_t   *addptr(sym_t *, pqinf_t *);
-extern sym_t   *addarray(sym_t *, int, int);
-extern sym_t   *addfunc(sym_t *, sym_t *);
-extern void    chkfdef(sym_t *, int);
-extern sym_t   *dname(sym_t *);
-extern sym_t   *iname(sym_t *);
-extern type_t  *mktag(sym_t *, tspec_t, int, int);
-extern const   char *scltoa(scl_t);
-extern type_t  *compltag(type_t *, sym_t *);
-extern sym_t   *ename(sym_t *, int, int);
-extern void    decl1ext(sym_t *, int);
-extern void    cpuinfo(sym_t *, sym_t *);
-extern int     isredec(sym_t *, int *);
-extern int     eqtype(type_t *, type_t *, int, int, int *);
-extern void    compltyp(sym_t *, sym_t *);
-extern sym_t   *decl1arg(sym_t *, int);
-extern void    cluparg(void);
-extern void    decl1loc(sym_t *, int);
-extern sym_t   *aname(void);
-extern void    globclup(void);
-extern sym_t   *decl1abs(sym_t *);
-extern void    chksz(sym_t *);
-extern void    setsflg(sym_t *);
-extern void    setuflg(sym_t *, int, int);
-extern void    chkusage(dinfo_t *);
-extern void    chkusg1(int, sym_t *);
-extern void    chkglsyms(void);
-extern void    prevdecl(int, sym_t *);
-
-/*
- * tree.c
- */
-extern void    initmtab(void);
-extern type_t  *incref(type_t *, tspec_t);
-extern type_t  *tincref(type_t *, tspec_t);
-extern tnode_t *getcnode(type_t *, val_t *);
-extern tnode_t *getnnode(sym_t *, int);
-extern tnode_t *getsnode(strg_t *);
-extern sym_t   *strmemb(tnode_t *, op_t, sym_t *);
-extern tnode_t *build(op_t, tnode_t *, tnode_t *);
-extern tnode_t *cconv(tnode_t *);
-extern int     typeok(op_t, int, tnode_t *, tnode_t *);
-extern tnode_t *promote(op_t, int, tnode_t *);
-extern tnode_t *convert(op_t, int, type_t *, tnode_t *);
-extern void    cvtcon(op_t, int, type_t *, val_t *, val_t *);
-extern const   char *tyname(type_t *);
-extern tnode_t *bldszof(type_t *);
-extern tnode_t *cast(tnode_t *, type_t *);
-extern tnode_t *funcarg(tnode_t *, tnode_t *);
-extern tnode_t *funccall(tnode_t *, tnode_t *);
-extern val_t   *constant(tnode_t *);
-extern void    expr(tnode_t *, int, int);
-extern void    chkmisc(tnode_t *, int, int, int, int, int, int);
-extern int     conaddr(tnode_t *, sym_t **, ptrdiff_t *);
-extern strg_t  *catstrg(strg_t *, strg_t *);
-
-/*
- * func.c
- */
-extern sym_t   *funcsym;
-extern int     reached;
-extern int     rchflg;
-extern int     ftflg;
-extern int     nargusg;
-extern pos_t   aupos;
-extern int     nvararg;
-extern pos_t   vapos;
-extern int     prflstrg;
-extern pos_t   prflpos;
-extern int     scflstrg;
-extern pos_t   scflpos;
-extern int     ccflg;
-extern int     llibflg;
-extern int     nowarn;
-extern int     plibflg;
-extern int     quadflg;
-
-extern void    pushctrl(int);
-extern void    popctrl(int);
-extern void    chkreach(void);
-extern void    funcdef(sym_t *);
-extern void    funcend(void);
-extern void    label(int, sym_t *, tnode_t *);
-extern void    if1(tnode_t *);
-extern void    if2(void);
-extern void    if3(int);
-extern void    switch1(tnode_t *);
-extern void    switch2(void);
-extern void    while1(tnode_t *);
-extern void    while2(void);
-extern void    do1(void);
-extern void    do2(tnode_t *);
-extern void    for1(tnode_t *, tnode_t *, tnode_t *);
-extern void    for2(void);
-extern void    dogoto(sym_t *);
-extern void    docont(void);
-extern void    dobreak(void);
-extern void    doreturn(tnode_t *);
-extern void    glclup(int);
-extern void    argsused(int);
-extern void    constcond(int);
-extern void    fallthru(int);
-extern void    notreach(int);
-extern void    lintlib(int);
-extern void    linted(int);
-extern void    varargs(int);
-extern void    printflike(int);
-extern void    scanflike(int);
-extern void    protolib(int);
-extern void    longlong(int);
-
-/*
- * init.c
- */
-extern int     initerr;
-extern sym_t   *initsym;
-extern int     startinit;
-
-extern void    prepinit(void);
-extern void    initrbr(void);
-extern void    initlbr(void);
-extern void    mkinit(tnode_t *);
-
-/*
- * emit.c
- */
-extern void    outtype(type_t *);
-extern const   char *ttos(type_t *);
-extern void    outsym(sym_t *, scl_t, def_t);
-extern void    outfdef(sym_t *, pos_t *, int, int, sym_t *);
-extern void    outcall(tnode_t *, int, int);
-extern void    outusg(sym_t *);
diff --git a/usr.bin/xlint/lint1/func.c b/usr.bin/xlint/lint1/func.c
deleted file mode 100644 (file)
index cf66f9a..0000000
+++ /dev/null
@@ -1,1231 +0,0 @@
-/*     $NetBSD: func.c,v 1.7 1995/10/02 17:31:40 jpo Exp $     */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "lint1.h"
-#include "y.tab.h"
-
-/*
- * Contains a pointer to the symbol table entry of the current function
- * definition.
- */
-sym_t  *funcsym;
-
-/* Is set as long as a statement can be reached. Must be set at level 0. */
-int    reached = 1;
-
-/*
- * Is set as long as NOTREACHED is in effect.
- * Is reset everywhere where reached can become 0.
- */
-int    rchflg;
-
-/*
- * In conjunction with reached ontrols printing of "fallthrough on ..."
- * warnings.
- * Reset by each statement and set by FALLTHROUGH, switch (switch1())
- * and case (label()).
- *
- * Control statements if, for, while and switch do not reset ftflg because
- * this must be done by the controled statement. At least for if this is
- * important because ** FALLTHROUGH ** after "if (expr) stmnt" is evaluated
- * befor the following token, wich causes reduction of above, is read.
- * This means that ** FALLTHROUGH ** after "if ..." would always be ignored.
- */
-int    ftflg;
-
-/* Top element of stack for control statements */
-cstk_t *cstk;
-
-/*
- * Number of arguments which will be checked for usage in following
- * function definition. -1 stands for all arguments.
- *
- * The position of the last ARGSUSED comment is stored in aupos.
- */
-int    nargusg = -1;
-pos_t  aupos;
-
-/*
- * Number of arguments of the following function definition whose types
- * shall be checked by lint2. -1 stands for all arguments.
- *
- * The position of the last VARARGS comment is stored in vapos.
- */
-int    nvararg = -1;
-pos_t  vapos;
-
-/*
- * Both prflstr and scflstrg contain the number of the argument which
- * shall be used to check the types of remaining arguments (for PRINTFLIKE
- * and SCANFLIKE).
- *
- * prflpos and scflpos are the positions of the last PRINTFLIKE or
- * SCANFLIKE comment.
- */
-int    prflstrg = -1;
-int    scflstrg = -1;
-pos_t  prflpos;
-pos_t  scflpos;
-
-/*
- * Are both plibflg and llibflg set, prototypes are writen as function
- * definitions to the output file.
- */
-int    plibflg;
-
-/*
- * Nonzero means that no warnings about constands in conditional
- * context are printed.
- */
-int    ccflg;
-
-/*
- * llibflg is set if a lint library shall be created. The effect of
- * llibflg is that all defined symbols are treated as used.
- * (The LINTLIBRARY comment also resets vflag.)
- */
-int    llibflg;
-
-/*
- * Nonzero if warnings are suppressed by a LINTED directive
- */
-int    nowarn;
-
-/*
- * Nonzero if complaints about use of "long long" are suppressed in
- * the next statement or declaration.
- */
-int    quadflg;
-
-/*
- * Puts a new element at the top of the stack used for control statements.
- */
-void
-pushctrl(int env)
-{
-       cstk_t  *ci;
-
-       ci = xcalloc(1, sizeof (cstk_t));
-       ci->c_env = env;
-       ci->c_nxt = cstk;
-       cstk = ci;
-}
-
-/*
- * Removes the top element of the stack used for control statements.
- */
-void
-popctrl(int env)
-{
-       cstk_t  *ci;
-       clst_t  *cl;
-
-       if (cstk == NULL || cstk->c_env != env)
-               lerror("popctrl() 1");
-
-       cstk = (ci = cstk)->c_nxt;
-
-       while ((cl = ci->c_clst) != NULL) {
-               ci->c_clst = cl->cl_nxt;
-               free(cl);
-       }
-
-       if (ci->c_swtype != NULL)
-               free(ci->c_swtype);
-
-       free(ci);
-}
-
-/*
- * Prints a warning if a statement cannot be reached.
- */
-void
-chkreach(void)
-{
-       if (!reached && !rchflg) {
-               /* statement not reached */
-               warning(193);
-               reached = 1;
-       }
-}
-
-/*
- * Called after a function declaration which introduces a function definition
- * and before an (optional) old style argument declaration list.
- *
- * Puts all symbols declared in the Prototype or in an old style argument
- * list back to the symbol table.
- *
- * Does the usual checking of storage class, type (return value),
- * redeclaration etc..
- */
-void
-funcdef(sym_t *fsym)
-{
-       int     n, warn;
-       sym_t   *arg, *sym, *rdsym;
-
-       funcsym = fsym;
-
-       /*
-        * Put all symbols declared in the argument list back to the
-        * symbol table.
-        */
-       for (sym = dcs->d_fpsyms; sym != NULL; sym = sym->s_dlnxt) {
-               if (sym->s_blklev != -1) {
-                       if (sym->s_blklev != 1)
-                               lerror("funcdef() 1");
-                       inssym(1, sym);
-               }
-       }
-
-       /*
-        * In osfunc() we did not know whether it is an old style function
-        * definition or only an old style declaration, if there are no
-        * arguments inside the argument list ("f()").
-        */
-       if (!fsym->s_type->t_proto && fsym->s_args == NULL)
-               fsym->s_osdef = 1;
-
-       chktyp(fsym);
-
-       /*
-        * chktyp() checks for almost all possible errors, but not for
-        * incomplete return values (these are allowed in declarations)
-        */
-       if (fsym->s_type->t_subt->t_tspec != VOID &&
-           incompl(fsym->s_type->t_subt)) {
-               /* cannot return incomplete type */
-               error(67);
-       }
-
-       fsym->s_def = DEF;
-
-       if (fsym->s_scl == TYPEDEF) {
-               fsym->s_scl = EXTERN;
-               /* illegal storage class */
-               error(8);
-       }
-
-       if (dcs->d_inline)
-               fsym->s_inline = 1;
-
-       /*
-        * Arguments in new style function declarations need a name.
-        * (void is already removed from the list of arguments)
-        */
-       n = 1;
-       for (arg = fsym->s_type->t_args; arg != NULL; arg = arg->s_nxt) {
-               if (arg->s_scl == ABSTRACT) {
-                       if (arg->s_name != unnamed)
-                               lerror("funcdef() 2");
-                       /* formal parameter lacks name: param #%d */
-                       error(59, n);
-               } else {
-                       if (arg->s_name == unnamed)
-                               lerror("funcdef() 3");
-               }
-               n++;
-       }
-
-       /*
-        * We must also remember the position. s_dpos is overwritten
-        * if this is an old style definition and we had already a
-        * prototype.
-        */
-       STRUCT_ASSIGN(dcs->d_fdpos, fsym->s_dpos);
-
-       if ((rdsym = dcs->d_rdcsym) != NULL) {
-
-               if (!isredec(fsym, (warn = 0, &warn))) {
-
-                       /*
-                        * Print nothing if the newly defined function
-                        * is defined in old style. A better warning will
-                        * be printed in cluparg().
-                        */
-                       if (warn && !fsym->s_osdef) {
-                               /* redeclaration of %s */
-                               (*(sflag ? error : warning))(27, fsym->s_name);
-                               prevdecl(-1, rdsym);
-                       }
-
-                       /* copy usage information */
-                       cpuinfo(fsym, rdsym);
-
-                       /*
-                        * If the old symbol was a prototype and the new
-                        * one is none, overtake the position of the
-                        * declaration of the prototype.
-                        */
-                       if (fsym->s_osdef && rdsym->s_type->t_proto)
-                               STRUCT_ASSIGN(fsym->s_dpos, rdsym->s_dpos);
-
-                       /* complete the type */
-                       compltyp(fsym, rdsym);
-
-                       /* once a function is inline it remains inline */
-                       if (rdsym->s_inline)
-                               fsym->s_inline = 1;
-
-               }
-
-               /* remove the old symbol from the symbol table */
-               rmsym(rdsym);
-
-       }
-
-       if (fsym->s_osdef && !fsym->s_type->t_proto) {
-               if (sflag && hflag && strcmp(fsym->s_name, "main") != 0)
-                       /* function definition is not a prototyp */
-                       warning(286);
-       }
-
-       if (dcs->d_notyp)
-               /* return value is implizitly declared to be int */
-               fsym->s_rimpl = 1;
-
-       reached = 1;
-}
-
-/*
- * Called at the end of a function definition.
- */
-void
-funcend(void)
-{
-       sym_t   *arg;
-       int     n;
-
-       if (reached) {
-               cstk->c_noretval = 1;
-               if (funcsym->s_type->t_subt->t_tspec != VOID &&
-                   !funcsym->s_rimpl) {
-                       /* func. %s falls off bottom without returning value */
-                       warning(217, funcsym->s_name);
-               }
-       }
-
-       /*
-        * This warning is printed only if the return value was implizitly
-        * declared to be int. Otherwise the wrong return statement
-        * has already printed a warning.
-        */
-       if (cstk->c_noretval && cstk->c_retval && funcsym->s_rimpl)
-               /* function %s has return (e); and return; */
-               warning(216, funcsym->s_name);
-
-       /* Print warnings for unused arguments */
-       arg = dcs->d_fargs;
-       n = 0;
-       while (arg != NULL && (nargusg == -1 || n < nargusg)) {
-               chkusg1(dcs->d_asm, arg);
-               arg = arg->s_nxt;
-               n++;
-       }
-       nargusg = -1;
-
-       /*
-        * write the information about the function definition to the
-        * output file
-        * inline functions explicitely declared extern are written as
-        * declarations only.
-        */
-       if (dcs->d_scl == EXTERN && funcsym->s_inline) {
-               outsym(funcsym, funcsym->s_scl, DECL);
-       } else {
-               outfdef(funcsym, &dcs->d_fdpos, cstk->c_retval,
-                       funcsym->s_osdef, dcs->d_fargs);
-       }
-
-       /*
-        * remove all symbols declared during argument declaration from
-        * the symbol table
-        */
-       if (dcs->d_nxt != NULL || dcs->d_ctx != EXTERN)
-               lerror("funcend() 1");
-       rmsyms(dcs->d_fpsyms);
-
-       /* must be set on level 0 */
-       reached = 1;
-}
-
-/*
- * Process a label.
- *
- * typ         type of the label (T_NAME, T_DEFAULT or T_CASE).
- * sym         symbol table entry of label if typ == T_NAME
- * tn          expression if typ == T_CASE
- */
-void
-label(int typ, sym_t *sym, tnode_t *tn)
-{
-       cstk_t  *ci;
-       clst_t  *cl;
-       val_t   *v, *nv;
-       tspec_t t;
-
-       switch (typ) {
-
-       case T_NAME:
-               if (sym->s_set) {
-                       /* label %s redefined */
-                       error(194, sym->s_name);
-               } else {
-                       setsflg(sym);
-               }
-               break;
-
-       case T_CASE:
-
-               /* find the stack entry for the innermost switch statement */
-               for (ci = cstk; ci != NULL && !ci->c_switch; ci = ci->c_nxt) ;
-
-               if (ci == NULL) {
-                       /* case not in switch */
-                       error(195);
-                       tn = NULL;
-               } else if (tn != NULL && tn->tn_op != CON) {
-                       /* non-constant case expression */
-                       error(197);
-                       tn = NULL;
-               } else if (tn != NULL && !isityp(tn->tn_type->t_tspec)) {
-                       /* non-integral case expression */
-                       error(198);
-                       tn = NULL;
-               }
-
-               if (tn != NULL) {
-
-                       if (ci->c_swtype == NULL)
-                               lerror("label() 1");
-
-                       if (reached && !ftflg) {
-                               if (hflag)
-                                       /* fallthrough on case statement */
-                                       warning(220);
-                       }
-
-                       t = tn->tn_type->t_tspec;
-                       if (t == LONG || t == ULONG ||
-                           t == QUAD || t == UQUAD) {
-                               if (tflag)
-                                       /* case label must be of type ... */
-                                       warning(203);
-                       }
-
-                       /*
-                        * get the value of the expression and convert it
-                        * to the type of the switch expression
-                        */
-                       v = constant(tn);
-                       nv = xcalloc(1, sizeof (val_t));
-                       cvtcon(CASE, 0, ci->c_swtype, nv, v);
-                       free(v);
-
-                       /* look if we had this value already */
-                       for (cl = ci->c_clst; cl != NULL; cl = cl->cl_nxt) {
-                               if (cl->cl_val.v_quad == nv->v_quad)
-                                       break;
-                       }
-                       if (cl != NULL && isutyp(nv->v_tspec)) {
-                               /* duplicate case in switch, %lu */
-                               error(200, (u_long)nv->v_quad);
-                       } else if (cl != NULL) {
-                               /* duplicate case in switch, %ld */
-                               error(199, (long)nv->v_quad);
-                       } else {
-                               /*
-                                * append the value to the list of
-                                * case values
-                                */
-                               cl = xcalloc(1, sizeof (clst_t));
-                               STRUCT_ASSIGN(cl->cl_val, *nv);
-                               cl->cl_nxt = ci->c_clst;
-                               ci->c_clst = cl;
-                       }
-               }
-               tfreeblk();
-               break;
-
-       case T_DEFAULT:
-
-               /* find the stack entry for the innermost switch statement */
-               for (ci = cstk; ci != NULL && !ci->c_switch; ci = ci->c_nxt) ;
-
-               if (ci == NULL) {
-                       /* default outside switch */
-                       error(201);
-               } else if (ci->c_default) {
-                       /* duplicate default in switch */
-                       error(202);
-               } else {
-                       if (reached && !ftflg) {
-                               if (hflag)
-                                       /* fallthrough on default statement */
-                                       warning(284);
-                       }
-                       ci->c_default = 1;
-               }
-               break;
-       }
-       reached = 1;
-}
-
-/*
- * T_IF T_LPARN expr T_RPARN
- */
-void
-if1(tnode_t *tn)
-{
-       if (tn != NULL)
-               tn = cconv(tn);
-       if (tn != NULL)
-               tn = promote(NOOP, 0, tn);
-       expr(tn, 0, 1);
-       pushctrl(T_IF);
-}
-
-/*
- * if_without_else
- * if_without_else T_ELSE
- */
-void
-if2(void)
-{
-       cstk->c_rchif = reached ? 1 : 0;
-       reached = 1;
-}
-
-/*
- * if_without_else
- * if_without_else T_ELSE stmnt
- */
-void
-if3(int els)
-{
-       if (els) {
-               reached |= cstk->c_rchif;
-       } else {
-               reached = 1;
-       }
-       popctrl(T_IF);
-}
-
-/*
- * T_SWITCH T_LPARN expr T_RPARN
- */
-void
-switch1(tnode_t *tn)
-{
-       tspec_t t;
-       type_t  *tp;
-
-       if (tn != NULL)
-               tn = cconv(tn);
-       if (tn != NULL)
-               tn = promote(NOOP, 0, tn);
-       if (tn != NULL && !isityp(tn->tn_type->t_tspec)) {
-               /* switch expression must have integral type */
-               error(205);
-               tn = NULL;
-       }
-       if (tn != NULL && tflag) {
-               t = tn->tn_type->t_tspec;
-               if (t == LONG || t == ULONG || t == QUAD || t == UQUAD) {
-                       /* switch expr. must be of type `int' in trad. C */
-                       warning(271);
-               }
-       }
-
-       /*
-        * Remember the type of the expression. Because its possible
-        * that (*tp) is allocated on tree memory the type must be
-        * duplicated. This is not too complicated because it is
-        * only an integer type.
-        */
-       tp = xcalloc(1, sizeof (type_t));
-       if (tn != NULL) {
-               tp->t_tspec = tn->tn_type->t_tspec;
-               if ((tp->t_isenum = tn->tn_type->t_isenum) != 0)
-                       tp->t_enum = tn->tn_type->t_enum;
-       } else {
-               tp->t_tspec = INT;
-       }
-
-       expr(tn, 1, 0);
-
-       pushctrl(T_SWITCH);
-       cstk->c_switch = 1;
-       cstk->c_swtype = tp;
-
-       reached = rchflg = 0;
-       ftflg = 1;
-}
-
-/*
- * switch_expr stmnt
- */
-void
-switch2(void)
-{
-       int     nenum, nclab;
-       sym_t   *esym;
-       clst_t  *cl;
-
-       if (cstk->c_swtype == NULL)
-               lerror("switch2() 1");
-
-       /*
-        * If the switch expression was of type enumeration, count the case
-        * labels and the number of enumerators. If both counts are not
-        * equal print a warning.
-        */
-       if (cstk->c_swtype->t_isenum) {
-               nenum = nclab = 0;
-               if (cstk->c_swtype->t_enum == NULL)
-                       lerror("switch2() 2");
-               for (esym = cstk->c_swtype->t_enum->elem;
-                    esym != NULL; esym = esym->s_nxt) {
-                       nenum++;
-               }
-               for (cl = cstk->c_clst; cl != NULL; cl = cl->cl_nxt)
-                       nclab++;
-               if (hflag && eflag && nenum != nclab && !cstk->c_default) {
-                       /* enumeration value(s) not handled in switch */
-                       warning(206);
-               }
-       }
-
-       if (cstk->c_break) {
-               /*
-                * end of switch alway reached (c_break is only set if the
-                * break statement can be reached).
-                */
-               reached = 1;
-       } else if (!cstk->c_default &&
-                  (!hflag || !cstk->c_swtype->t_isenum || nenum != nclab)) {
-               /*
-                * there are possible values which are not handled in
-                * switch
-                */
-               reached = 1;
-       }       /*
-                * otherwise the end of the switch expression is reached
-                * if the end of the last statement inside it is reached.
-                */
-
-       popctrl(T_SWITCH);
-}
-
-/*
- * T_WHILE T_LPARN expr T_RPARN
- */
-void
-while1(tnode_t *tn)
-{
-       if (!reached) {
-               /* loop not entered at top */
-               warning(207);
-               reached = 1;
-       }
-
-       if (tn != NULL)
-               tn = cconv(tn);
-       if (tn != NULL)
-               tn = promote(NOOP, 0, tn);
-       if (tn != NULL && !issclt(tn->tn_type->t_tspec)) {
-               /* controlling expressions must have scalar type */
-               error(204);
-               tn = NULL;
-       }
-
-       pushctrl(T_WHILE);
-       cstk->c_loop = 1;
-       if (tn != NULL && tn->tn_op == CON) {
-               if (isityp(tn->tn_type->t_tspec)) {
-                       cstk->c_infinite = tn->tn_val->v_quad != 0;
-               } else {
-                       cstk->c_infinite = tn->tn_val->v_ldbl != 0.0;
-               }
-       }
-
-       expr(tn, 0, 1);
-}
-
-/*
- * while_expr stmnt
- * while_expr error
- */
-void
-while2(void)
-{
-       /*
-        * The end of the loop can be reached if it is no endless loop
-        * or there was a break statement which was reached.
-        */
-       reached = !cstk->c_infinite || cstk->c_break;
-       rchflg = 0;
-
-       popctrl(T_WHILE);
-}
-
-/*
- * T_DO
- */
-void
-do1(void)
-{
-       if (!reached) {
-               /* loop not entered at top */
-               warning(207);
-               reached = 1;
-       }
-
-       pushctrl(T_DO);
-       cstk->c_loop = 1;
-}
-
-/*
- * do stmnt do_while_expr
- * do error
- */
-void
-do2(tnode_t *tn)
-{
-       /*
-        * If there was a continue statement the expression controlling the
-        * loop is reached.
-        */
-       if (cstk->c_cont)
-               reached = 1;
-
-       if (tn != NULL)
-               tn = cconv(tn);
-       if (tn != NULL)
-               tn = promote(NOOP, 0, tn);
-       if (tn != NULL && !issclt(tn->tn_type->t_tspec)) {
-               /* controlling expressions must have scalar type */
-               error(204);
-               tn = NULL;
-       }
-
-       if (tn != NULL && tn->tn_op == CON) {
-               if (isityp(tn->tn_type->t_tspec)) {
-                       cstk->c_infinite = tn->tn_val->v_quad != 0;
-               } else {
-                       cstk->c_infinite = tn->tn_val->v_ldbl != 0.0;
-               }
-       }
-
-       expr(tn, 0, 1);
-
-       /*
-        * The end of the loop is only reached if it is no endless loop
-        * or there was a break statement which could be reached.
-        */
-       reached = !cstk->c_infinite || cstk->c_break;
-       rchflg = 0;
-
-       popctrl(T_DO);
-}
-
-/*
- * T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN
- */
-void
-for1(tnode_t *tn1, tnode_t *tn2, tnode_t *tn3)
-{
-       /*
-        * If there is no initialisation expression it is possible that
-        * it is intended not to enter the loop at top.
-        */
-       if (tn1 != NULL && !reached) {
-               /* loop not entered at top */
-               warning(207);
-               reached = 1;
-       }
-
-       pushctrl(T_FOR);
-       cstk->c_loop = 1;
-
-       /*
-        * Store the tree memory for the reinitialisation expression.
-        * Also remember this expression itself. We must check it at
-        * the end of the loop to get "used but not set" warnings correct.
-        */
-       cstk->c_fexprm = tsave();
-       cstk->c_f3expr = tn3;
-       STRUCT_ASSIGN(cstk->c_fpos, curr_pos);
-       STRUCT_ASSIGN(cstk->c_cfpos, csrc_pos);
-
-       if (tn1 != NULL)
-               expr(tn1, 0, 0);
-
-       if (tn2 != NULL)
-               tn2 = cconv(tn2);
-       if (tn2 != NULL)
-               tn2 = promote(NOOP, 0, tn2);
-       if (tn2 != NULL && !issclt(tn2->tn_type->t_tspec)) {
-               /* controlling expressions must have scalar type */
-               error(204);
-               tn2 = NULL;
-       }
-       if (tn2 != NULL)
-               expr(tn2, 0, 1);
-
-       if (tn2 == NULL) {
-               cstk->c_infinite = 1;
-       } else if (tn2->tn_op == CON) {
-               if (isityp(tn2->tn_type->t_tspec)) {
-                       cstk->c_infinite = tn2->tn_val->v_quad != 0;
-               } else {
-                       cstk->c_infinite = tn2->tn_val->v_ldbl != 0.0;
-               }
-       }
-
-       /* Checking the reinitialisation expression is done in for2() */
-
-       reached = 1;
-}
-
-/*
- * for_exprs stmnt
- * for_exprs error
- */
-void
-for2(void)
-{
-       pos_t   cpos, cspos;
-       tnode_t *tn3;
-
-       if (cstk->c_cont)
-               reached = 1;
-
-       STRUCT_ASSIGN(cpos, curr_pos);
-       STRUCT_ASSIGN(cspos, csrc_pos);
-
-       /* Restore the tree memory for the reinitialisation expression */
-       trestor(cstk->c_fexprm);
-       tn3 = cstk->c_f3expr;
-       STRUCT_ASSIGN(curr_pos, cstk->c_fpos);
-       STRUCT_ASSIGN(csrc_pos, cstk->c_cfpos);
-
-       /* simply "statement not reached" would be confusing */
-       if (!reached && !rchflg) {
-               /* end-of-loop code not reached */
-               warning(223);
-               reached = 1;
-       }
-
-       if (tn3 != NULL) {
-               expr(tn3, 0, 0);
-       } else {
-               tfreeblk();
-       }
-
-       STRUCT_ASSIGN(curr_pos, cpos);
-       STRUCT_ASSIGN(csrc_pos, cspos);
-
-       /* An endless loop without break will never terminate */
-       reached = cstk->c_break || !cstk->c_infinite;
-       rchflg = 0;
-
-       popctrl(T_FOR);
-}
-
-/*
- * T_GOTO identifier T_SEMI
- * T_GOTO error T_SEMI
- */
-void
-dogoto(sym_t *lab)
-{
-       setuflg(lab, 0, 0);
-
-       chkreach();
-
-       reached = rchflg = 0;
-}
-
-/*
- * T_BREAK T_SEMI
- */
-void
-dobreak(void)
-{
-       cstk_t  *ci;
-
-       ci = cstk;
-       while (ci != NULL && !ci->c_loop && !ci->c_switch)
-               ci = ci->c_nxt;
-
-       if (ci == NULL) {
-               /* break outside loop or switch */
-               error(208);
-       } else {
-               if (reached)
-                       ci->c_break = 1;
-       }
-
-       if (bflag)
-               chkreach();
-
-       reached = rchflg = 0;
-}
-
-/*
- * T_CONTINUE T_SEMI
- */
-void
-docont(void)
-{
-       cstk_t  *ci;
-
-       for (ci = cstk; ci != NULL && !ci->c_loop; ci = ci->c_nxt) ;
-
-       if (ci == NULL) {
-               /* continue outside loop */
-               error(209);
-       } else {
-               ci->c_cont = 1;
-       }
-
-       chkreach();
-
-       reached = rchflg = 0;
-}
-
-/*
- * T_RETURN T_SEMI
- * T_RETURN expr T_SEMI
- */
-void
-doreturn(tnode_t *tn)
-{
-       tnode_t *ln, *rn;
-       cstk_t  *ci;
-       op_t    op;
-
-       for (ci = cstk; ci->c_nxt != NULL; ci = ci->c_nxt) ;
-
-       if (tn != NULL) {
-               ci->c_retval = 1;
-       } else {
-               ci->c_noretval = 1;
-       }
-
-       if (tn != NULL && funcsym->s_type->t_subt->t_tspec == VOID) {
-               /* void function %s cannot return value */
-               error(213, funcsym->s_name);
-               tfreeblk();
-               tn = NULL;
-       } else if (tn == NULL && funcsym->s_type->t_subt->t_tspec != VOID) {
-               /*
-                * Assume that the function has a return value only if it
-                * is explicitly declared.
-                */
-               if (!funcsym->s_rimpl)
-                       /* function %s expects to return value */
-                       warning(214, funcsym->s_name);
-       }
-
-       if (tn != NULL) {
-
-               /* Create a temporary node for the left side */
-               ln = tgetblk(sizeof (tnode_t));
-               ln->tn_op = NAME;
-               ln->tn_type = tduptyp(funcsym->s_type->t_subt);
-               ln->tn_type->t_const = 0;
-               ln->tn_lvalue = 1;
-               ln->tn_sym = funcsym;           /* better than nothing */
-
-               tn = build(RETURN, ln, tn);
-
-               if (tn != NULL) {
-                       rn = tn->tn_right;
-                       while ((op = rn->tn_op) == CVT || op == PLUS)
-                               rn = rn->tn_left;
-                       if (rn->tn_op == AMPER && rn->tn_left->tn_op == NAME &&
-                           rn->tn_left->tn_sym->s_scl == AUTO) {
-                               /* %s returns pointer to automatic object */
-                               warning(302, funcsym->s_name);
-                       }
-               }
-
-               expr(tn, 1, 0);
-
-       } else {
-
-               chkreach();
-
-       }
-
-       reached = rchflg = 0;
-}
-
-/*
- * Do some cleanup after a global declaration or definition.
- * Especially remove informations about unused lint comments.
- */
-void
-glclup(int silent)
-{
-       pos_t   cpos;
-
-       STRUCT_ASSIGN(cpos, curr_pos);
-
-       if (nargusg != -1) {
-               if (!silent) {
-                       STRUCT_ASSIGN(curr_pos, aupos);
-                       /* must precede function definition: %s */
-                       warning(282, "ARGSUSED");
-               }
-               nargusg = -1;
-       }
-       if (nvararg != -1) {
-               if (!silent) {
-                       STRUCT_ASSIGN(curr_pos, vapos);
-                       /* must precede function definition: %s */
-                       warning(282, "VARARGS");
-               }
-               nvararg = -1;
-       }
-       if (prflstrg != -1) {
-               if (!silent) {
-                       STRUCT_ASSIGN(curr_pos, prflpos);
-                       /* must precede function definition: %s */
-                       warning(282, "PRINTFLIKE");
-               }
-               prflstrg = -1;
-       }
-       if (scflstrg != -1) {
-               if (!silent) {
-                       STRUCT_ASSIGN(curr_pos, scflpos);
-                       /* must precede function definition: %s */
-                       warning(282, "SCANFLIKE");
-               }
-               scflstrg = -1;
-       }
-
-       STRUCT_ASSIGN(curr_pos, cpos);
-
-       dcs->d_asm = 0;
-}
-
-/*
- * ARGSUSED comment
- *
- * Only the first n arguments of the following function are checked
- * for usage. A missing argument is taken to be 0.
- */
-void
-argsused(int n)
-{
-       if (n == -1)
-               n = 0;
-
-       if (dcs->d_ctx != EXTERN) {
-               /* must be outside function: ** %s ** */
-               warning(280, "ARGSUSED");
-               return;
-       }
-       if (nargusg != -1) {
-               /* duplicate use of ** %s ** */
-               warning(281, "ARGSUSED");
-       }
-       nargusg = n;
-       STRUCT_ASSIGN(aupos, curr_pos);
-}
-
-/*
- * VARARGS comment
- *
- * Makes that lint2 checks only the first n arguments for compatibility
- * to the function definition. A missing argument is taken to be 0.
- */
-void
-varargs(int n)
-{
-       if (n == -1)
-               n = 0;
-
-       if (dcs->d_ctx != EXTERN) {
-               /* must be outside function: ** %s ** */
-               warning(280, "VARARGS");
-               return;
-       }
-       if (nvararg != -1) {
-               /* duplicate use of  ** %s ** */
-               warning(281, "VARARGS");
-       }
-       nvararg = n;
-       STRUCT_ASSIGN(vapos, curr_pos);
-}
-
-/*
- * PRINTFLIKE comment
- *
- * Check all arguments until the (n-1)-th as usual. The n-th argument is
- * used the check the types of remaining arguments.
- */
-void
-printflike(int n)
-{
-       if (n == -1)
-               n = 0;
-
-       if (dcs->d_ctx != EXTERN) {
-               /* must be outside function: ** %s ** */
-               warning(280, "PRINTFLIKE");
-               return;
-       }
-       if (prflstrg != -1) {
-               /* duplicate use of ** %s ** */
-               warning(281, "PRINTFLIKE");
-       }
-       prflstrg = n;
-       STRUCT_ASSIGN(prflpos, curr_pos);
-}
-
-/*
- * SCANFLIKE comment
- *
- * Check all arguments until the (n-1)-th as usual. The n-th argument is
- * used the check the types of remaining arguments.
- */
-void
-scanflike(int n)
-{
-       if (n == -1)
-               n = 0;
-
-       if (dcs->d_ctx != EXTERN) {
-               /* must be outside function: ** %s ** */
-               warning(280, "SCANFLIKE");
-               return;
-       }
-       if (scflstrg != -1) {
-               /* duplicate use of ** %s ** */
-               warning(281, "SCANFLIKE");
-       }
-       scflstrg = n;
-       STRUCT_ASSIGN(scflpos, curr_pos);
-}
-
-/*
- * Set the linenumber for a CONSTCOND comment. At this and the following
- * line no warnings about constants in conditional contexts are printed.
- */
-/* ARGSUSED */
-void
-constcond(int n)
-{
-       ccflg = 1;
-}
-
-/*
- * Suppress printing of "fallthrough on ..." warnings until next
- * statement.
- */
-/* ARGSUSED */
-void
-fallthru(int n)
-{
-       ftflg = 1;
-}
-
-/*
- * Stop warnings about statements which cannot be reached. Also tells lint
- * that the following statements cannot be reached (e.g. after exit()).
- */
-/* ARGSUSED */
-void
-notreach(int n)
-{
-       reached = 0;
-       rchflg = 1;
-}
-
-/* ARGSUSED */
-void
-lintlib(int n)
-{
-       if (dcs->d_ctx != EXTERN) {
-               /* must be outside function: ** %s ** */
-               warning(280, "LINTLIBRARY");
-               return;
-       }
-       llibflg = 1;
-       vflag = 0;
-}
-
-/*
- * Suppress most warnings at the current and the following line.
- */
-/* ARGSUSED */
-void
-linted(int n)
-{
-       nowarn = 1;
-}
-
-/*
- * PROTOTLIB in conjunction with LINTLIBRARY can be used to handle
- * prototypes like function definitions. This is done if the argument
- * to PROTOLIB is nonzero. Otherwise prototypes are handled normaly.
- */
-void
-protolib(int n)
-{
-       if (dcs->d_ctx != EXTERN) {
-               /* must be outside function: ** %s ** */
-               warning(280, "PROTOLIB");
-               return;
-       }
-       plibflg = n == 0 ? 0 : 1;
-}
-
-/*
- * Set quadflg to nonzero which means that the next statement/declaration
- * may use "long long" without an error or warning.
- */
-/* ARGSUSED */
-void
-longlong(int n)
-{
-       quadflg = 1;
-}
diff --git a/usr.bin/xlint/lint1/init.c b/usr.bin/xlint/lint1/init.c
deleted file mode 100644 (file)
index 0e75363..0000000
+++ /dev/null
@@ -1,508 +0,0 @@
-/*     $NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $     */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Jochen Pohl for
- *     The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $
- * $DragonFly: src/usr.bin/xlint/lint1/init.c,v 1.6 2004/07/07 12:24:00 asmodai Exp $
- */
-
-#include <stdlib.h>
-
-#include "lint1.h"
-
-/*
- * initerr is set as soon as a fatal error occured in an initialisation.
- * The effect is that the rest of the initialisation is ignored (parsed
- * by yacc, expression trees built, but no initialisation takes place).
- */
-int    initerr;
-
-/* Pointer to the symbol which is to be initialized. */
-sym_t  *initsym;
-
-/* Points to the top element of the initialisation stack. */
-istk_t *initstk;
-
-
-static void    popi2(void);
-static void    popinit(int);
-static void    pushinit(void);
-static void    testinit(void);
-static void    nextinit(int);
-static int     strginit(tnode_t *);
-
-
-/*
- * Initialize the initialisation stack by putting an entry for the variable
- * which is to be initialized on it.
- */
-void
-prepinit(void)
-{
-       istk_t  *istk;
-
-       if (initerr)
-               return;
-
-       /* free memory used in last initialisation */
-       while ((istk = initstk) != NULL) {
-               initstk = istk->i_nxt;
-               free(istk);
-       }
-
-       /*
-        * If the type which is to be initialized is an incomplete type,
-        * it must be duplicated.
-        */
-       if (initsym->s_type->t_tspec == ARRAY && incompl(initsym->s_type))
-               initsym->s_type = duptyp(initsym->s_type);
-
-       istk = initstk = xcalloc(1, sizeof (istk_t));
-       istk->i_subt = initsym->s_type;
-       istk->i_cnt = 1;
-
-}
-
-static void
-popi2(void)
-{
-       istk_t  *istk;
-       sym_t   *m;
-
-       initstk = (istk = initstk)->i_nxt;
-       if (initstk == NULL)
-               lerror("popi2() 1");
-       free(istk);
-
-       istk = initstk;
-
-       istk->i_cnt--;
-       if (istk->i_cnt < 0)
-               lerror("popi2() 3");
-
-       /*
-        * If the removed element was a structure member, we must go
-        * to the next structure member.
-        */
-       if (istk->i_cnt > 0 && istk->i_type->t_tspec == STRUCT) {
-               do {
-                       m = istk->i_mem = istk->i_mem->s_nxt;
-                       if (m == NULL)
-                               lerror("popi2() 2");
-               } while (m->s_field && m->s_name == unnamed);
-               istk->i_subt = m->s_type;
-       }
-}
-
-static void
-popinit(int brace)
-{
-       if (brace) {
-               /*
-                * Take all entries, including the first which requires
-                * a closing brace, from the stack.
-                */
-               do {
-                       brace = initstk->i_brace;
-                       popi2();
-               } while (!brace);
-       } else {
-               /*
-                * Take all entries which cannot be used for further
-                * initializers from the stack, but do this only if
-                * they do not require a closing brace.
-                */
-               while (!initstk->i_brace &&
-                      initstk->i_cnt == 0 && !initstk->i_nolimit) {
-                       popi2();
-               }
-       }
-}
-
-static void
-pushinit(void)
-{
-       istk_t  *istk;
-       int     cnt;
-       sym_t   *m;
-
-       istk = initstk;
-
-       /* Extend an incomplete array type by one element */
-       if (istk->i_cnt == 0) {
-               /*
-                * Inside of other aggregate types must not be an incomplete
-                * type.
-                */
-               if (istk->i_nxt->i_nxt != NULL)
-                       lerror("pushinit() 1");
-               istk->i_cnt = 1;
-        &n