1281168Spfg/* $NetBSD: lint.h,v 1.7 2003/10/27 00:12:44 lukem Exp $ */ 291586Smarkm 391586Smarkm/* 491586Smarkm * Copyright (c) 1994, 1995 Jochen Pohl 591586Smarkm * All Rights Reserved. 691586Smarkm * 791586Smarkm * Redistribution and use in source and binary forms, with or without 891586Smarkm * modification, are permitted provided that the following conditions 991586Smarkm * are met: 1091586Smarkm * 1. Redistributions of source code must retain the above copyright 1191586Smarkm * notice, this list of conditions and the following disclaimer. 1291586Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1391586Smarkm * notice, this list of conditions and the following disclaimer in the 1491586Smarkm * documentation and/or other materials provided with the distribution. 1591586Smarkm * 3. All advertising materials mentioning features or use of this software 1691586Smarkm * must display the following acknowledgement: 1791586Smarkm * This product includes software developed by Jochen Pohl for 1891586Smarkm * The NetBSD Project. 1991586Smarkm * 4. The name of the author may not be used to endorse or promote products 2091586Smarkm * derived from this software without specific prior written permission. 2191586Smarkm * 2291586Smarkm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2391586Smarkm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2491586Smarkm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2591586Smarkm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2691586Smarkm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2791586Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2891586Smarkm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2991586Smarkm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3091586Smarkm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3191586Smarkm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32281168Spfg * 33281168Spfg * $FreeBSD$ 3491586Smarkm */ 3591586Smarkm 3691586Smarkm#if HAVE_CONFIG_H 3791586Smarkm#include "config.h" 3891586Smarkm#else 3991586Smarkm#define HAVE_DECL_SYS_SIGNAME 1 4091586Smarkm#endif 4191586Smarkm 4291586Smarkm#include <sys/types.h> 4391586Smarkm#include <stddef.h> 4491586Smarkm#include <err.h> 4591586Smarkm#include <inttypes.h> 4691586Smarkm#include <stdio.h> 4791586Smarkm 4891586Smarkm#include "param.h" 4991586Smarkm 5091586Smarkm/* 5191586Smarkm * Type specifiers, used in type structures (type_t) and otherwere. 5291586Smarkm */ 5391586Smarkmtypedef enum { 5491586Smarkm NOTSPEC = 0, 5591586Smarkm SIGNED, /* keyword "signed", only used in the parser */ 5691586Smarkm UNSIGN, /* keyword "unsigned", only used in the parser */ 5791586Smarkm CHAR, /* char */ 5891586Smarkm SCHAR, /* signed char */ 5991586Smarkm UCHAR, /* unsigned char */ 6091586Smarkm SHORT, /* (signed) short */ 6191586Smarkm USHORT, /* unsigned short */ 6291586Smarkm INT, /* (signed) int */ 6391586Smarkm UINT, /* unsigned int */ 6491586Smarkm LONG, /* (signed) long */ 6591586Smarkm ULONG, /* unsigned long */ 6691586Smarkm QUAD, /* (signed) long long */ 6791586Smarkm UQUAD, /* unsigned long long */ 6891586Smarkm FLOAT, /* float */ 6991586Smarkm DOUBLE, /* double or, with tflag, long float */ 7091586Smarkm LDOUBLE, /* long double */ 7191586Smarkm VOID, /* void */ 7291586Smarkm STRUCT, /* structure tag */ 7391586Smarkm UNION, /* union tag */ 7491586Smarkm ENUM, /* enum tag */ 7591586Smarkm PTR, /* pointer */ 7691586Smarkm ARRAY, /* array */ 7791586Smarkm FUNC, /* function */ 7891586Smarkm NTSPEC 7991586Smarkm} tspec_t; 8091586Smarkm 8191586Smarkm/* 8291586Smarkm * size of types, name and classification 8391586Smarkm */ 8491586Smarkmtypedef struct { 8591586Smarkm int tt_sz; /* size in bits */ 8691586Smarkm int tt_psz; /* size, different from tt_sz 8791586Smarkm if pflag is set */ 8891586Smarkm tspec_t tt_styp; /* signed counterpart */ 8991586Smarkm tspec_t tt_utyp; /* unsigned counterpart */ 9091586Smarkm u_int tt_isityp : 1; /* 1 if integer type */ 9191586Smarkm u_int tt_isutyp : 1; /* 1 if unsigned integer type */ 9291586Smarkm u_int tt_isftyp : 1; /* 1 if floating point type */ 9391586Smarkm u_int tt_isatyp : 1; /* 1 if arithmetic type */ 9491586Smarkm u_int tt_issclt : 1; /* 1 if scalar type */ 95281168Spfg const char *tt_name; /* Bezeichnung des Typs */ 9691586Smarkm} ttab_t; 9791586Smarkm 9891586Smarkm#define size(t) (ttab[t].tt_sz) 9991586Smarkm#define psize(t) (ttab[t].tt_psz) 10091586Smarkm#define styp(t) (ttab[t].tt_styp) 10191586Smarkm#define utyp(t) (ttab[t].tt_utyp) 10291586Smarkm#define isityp(t) (ttab[t].tt_isityp) 10391586Smarkm#define isutyp(t) (ttab[t].tt_isutyp) 10491586Smarkm#define isftyp(t) (ttab[t].tt_isftyp) 10591586Smarkm#define isatyp(t) (ttab[t].tt_isatyp) 10691586Smarkm#define issclt(t) (ttab[t].tt_issclt) 10791586Smarkm 10891586Smarkmextern ttab_t ttab[]; 10991586Smarkm 11091586Smarkm 11191586Smarkmtypedef enum { 11291586Smarkm NODECL, /* until now not declared */ 11391586Smarkm DECL, /* declared */ 11491586Smarkm TDEF, /* tentative defined */ 11591586Smarkm DEF /* defined */ 11691586Smarkm} def_t; 11791586Smarkm 11891586Smarkm/* 11991586Smarkm * Following structure contains some data used for the output buffer. 12091586Smarkm */ 12191586Smarkmtypedef struct ob { 12291586Smarkm char *o_buf; /* buffer */ 12391586Smarkm char *o_end; /* first byte after buffer */ 12491586Smarkm size_t o_len; /* length of buffer */ 12591586Smarkm char *o_nxt; /* next free byte in buffer */ 12691586Smarkm} ob_t; 12791586Smarkm 12891586Smarkm#include "externs.h" 129