[BACK]Return to lint.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / xlint / common

Annotation of src/usr.bin/xlint/common/lint.h, Revision 1.23

1.22      rillig      1: /*     $NetBSD: lint.h,v 1.21 2021/01/02 01:06:15 rillig Exp $ */
1.1       thorpej     2:
                      3: /*
                      4:  * Copyright (c) 1994, 1995 Jochen Pohl
                      5:  * All Rights Reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  * 3. All advertising materials mentioning features or use of this software
                     16:  *    must display the following acknowledgement:
                     17:  *      This product includes software developed by Jochen Pohl for
                     18:  *     The NetBSD Project.
                     19:  * 4. The name of the author may not be used to endorse or promote products
                     20:  *    derived from this software without specific prior written permission.
                     21:  *
                     22:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     23:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     24:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     25:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     26:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     27:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     28:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     29:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     30:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     31:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     32:  */
                     33:
1.7       lukem      34: #if HAVE_NBTOOL_CONFIG_H
                     35: #include "nbtool_config.h"
1.2       tv         36: #else
                     37: #define HAVE_DECL_SYS_SIGNAME 1
                     38: #endif
                     39:
1.1       thorpej    40: #include <sys/types.h>
1.3       tv         41: #include <err.h>
1.6       tv         42: #include <inttypes.h>
1.21      rillig     43: #include <stdbool.h>
                     44: #include <stddef.h>
1.5       tv         45: #include <stdio.h>
1.1       thorpej    46:
                     47: #include "param.h"
                     48:
                     49: /*
1.17      rillig     50:  * Type specifiers, used in type structures (type_t) and elsewhere.
1.1       thorpej    51:  */
                     52: typedef enum {
                     53:        NOTSPEC = 0,
                     54:        SIGNED,         /* keyword "signed", only used in the parser */
                     55:        UNSIGN,         /* keyword "unsigned", only used in the parser */
1.8       yamt       56:        BOOL,           /* _Bool */
1.1       thorpej    57:        CHAR,           /* char */
                     58:        SCHAR,          /* signed char */
                     59:        UCHAR,          /* unsigned char */
                     60:        SHORT,          /* (signed) short */
                     61:        USHORT,         /* unsigned short */
                     62:        INT,            /* (signed) int */
                     63:        UINT,           /* unsigned int */
                     64:        LONG,           /* (signed) long */
                     65:        ULONG,          /* unsigned long */
                     66:        QUAD,           /* (signed) long long */
                     67:        UQUAD,          /* unsigned long long */
1.14      christos   68: #ifdef INT128_SIZE
                     69:        INT128,         /* (signed) __int128_t */
                     70:        UINT128,        /* __uint128_t */
                     71: #endif
1.1       thorpej    72:        FLOAT,          /* float */
                     73:        DOUBLE,         /* double or, with tflag, long float */
                     74:        LDOUBLE,        /* long double */
                     75:        VOID,           /* void */
                     76:        STRUCT,         /* structure tag */
                     77:        UNION,          /* union tag */
                     78:        ENUM,           /* enum tag */
                     79:        PTR,            /* pointer */
                     80:        ARRAY,          /* array */
                     81:        FUNC,           /* function */
1.12      matt       82:        COMPLEX,        /* _Complex */
1.11      christos   83:        FCOMPLEX,       /* float _Complex */
                     84:        DCOMPLEX,       /* double _Complex */
1.19      rillig     85:        LCOMPLEX        /* long double _Complex */
                     86: #define NTSPEC (LCOMPLEX + 1)
1.1       thorpej    87: } tspec_t;
                     88:
1.19      rillig     89:
1.1       thorpej    90: /*
                     91:  * size of types, name and classification
                     92:  */
                     93: typedef        struct {
1.13      christos   94:        size_t  tt_sz;                  /* size in bits */
                     95:        size_t  tt_psz;                 /* size, different from tt_sz
1.1       thorpej    96:                                           if pflag is set */
1.20      rillig     97:        tspec_t tt_signed_counterpart;
                     98:        tspec_t tt_unsigned_counterpart;
1.21      rillig     99:        bool    tt_is_int : 1;          /* integer type */
                    100:        bool    tt_is_uint : 1;         /* unsigned integer type */
                    101:        bool    tt_is_float : 1;        /* floating point type */
                    102:        bool    tt_is_arith : 1;        /* arithmetic type */
                    103:        bool    tt_is_scalar : 1;       /* scalar type */
                    104:        bool    tt_is_complex : 1;      /* complex type */
1.15      rillig    105:        const char *tt_name;            /* name of the type */
1.1       thorpej   106: } ttab_t;
                    107:
1.16      rillig    108: #define size(t)                        (ttab[t].tt_sz)
                    109: #define psize(t)               (ttab[t].tt_psz)
1.20      rillig    110: #define signed_type(t)         (ttab[t].tt_signed_counterpart)
                    111: #define unsigned_type(t)       (ttab[t].tt_unsigned_counterpart)
1.16      rillig    112: #define tspec_is_int(t)                (ttab[t].tt_is_int)
                    113: #define tspec_is_uint(t)       (ttab[t].tt_is_uint)
                    114: #define tspec_is_float(t)      (ttab[t].tt_is_float)
                    115: #define tspec_is_arith(t)      (ttab[t].tt_is_arith)
                    116: #define tspec_is_complex(t)    (ttab[t].tt_is_complex)
                    117: #define tspec_is_scalar(t)     (ttab[t].tt_is_scalar)
1.1       thorpej   118:
                    119: extern ttab_t  ttab[];
                    120:
                    121:
                    122: typedef        enum {
1.19      rillig    123:        NODECL,                 /* not declared until now */
1.1       thorpej   124:        DECL,                   /* declared */
                    125:        TDEF,                   /* tentative defined */
                    126:        DEF                     /* defined */
                    127: } def_t;
                    128:
1.19      rillig    129: /* Some data used for the output buffer. */
1.1       thorpej   130: typedef        struct  ob {
                    131:        char    *o_buf;         /* buffer */
                    132:        char    *o_end;         /* first byte after buffer */
                    133:        size_t  o_len;          /* length of buffer */
1.18      rillig    134:        char    *o_next;        /* next free byte in buffer */
1.1       thorpej   135: } ob_t;
                    136:
1.9       christos  137: typedef struct type type_t;
                    138:
1.1       thorpej   139: #include "externs.h"

CVSweb <webmaster@jp.NetBSD.org>