xref: /illumos-gate/usr/src/tools/lintdump/lnstuff.h (revision c4d175c6)
1*34c98957Smeem /*
2*34c98957Smeem  * CDDL HEADER START
3*34c98957Smeem  *
4*34c98957Smeem  * The contents of this file are subject to the terms of the
5*34c98957Smeem  * Common Development and Distribution License (the "License").
6*34c98957Smeem  * You may not use this file except in compliance with the License.
7*34c98957Smeem  *
8*34c98957Smeem  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*34c98957Smeem  * or http://www.opensolaris.org/os/licensing.
10*34c98957Smeem  * See the License for the specific language governing permissions
11*34c98957Smeem  * and limitations under the License.
12*34c98957Smeem  *
13*34c98957Smeem  * When distributing Covered Code, include this CDDL HEADER in each
14*34c98957Smeem  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*34c98957Smeem  * If applicable, add the following below this CDDL HEADER, with the
16*34c98957Smeem  * fields enclosed by brackets "[]" replaced with your own identifying
17*34c98957Smeem  * information: Portions Copyright [yyyy] [name of copyright owner]
18*34c98957Smeem  *
19*34c98957Smeem  * CDDL HEADER END
20*34c98957Smeem  */
21*34c98957Smeem 
22*34c98957Smeem /*
23*34c98957Smeem  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*34c98957Smeem  * Use is subject to license terms.
25*34c98957Smeem  */
26*34c98957Smeem 
27*34c98957Smeem /*	Copyright (c) 1989 AT&T					*/
28*34c98957Smeem /*	  All Rights Reserved  					*/
29*34c98957Smeem 
30*34c98957Smeem /*
31*34c98957Smeem  *	Based on @(#)lnstuff.h 1.5 02/06/05 from lint
32*34c98957Smeem  */
33*34c98957Smeem 
34*34c98957Smeem #ifndef	LNSTUFF_H
35*34c98957Smeem #define	LNSTUFF_H
36*34c98957Smeem 
37*34c98957Smeem #include <sys/types.h>
38*34c98957Smeem 
39*34c98957Smeem #define	LDI 01		/* defined and initialized: storage set aside	*/
40*34c98957Smeem #define	LIB 02		/* defined on a library				*/
41*34c98957Smeem #define	LDC 04		/* defined as a common region on UNIX		*/
42*34c98957Smeem #define	LDX 010		/* defined by an extern: if ! pflag, same as LDI */
43*34c98957Smeem #define	LRV 020		/* function returns a value			*/
44*34c98957Smeem #define	LUV 040		/* function used in a value context		*/
45*34c98957Smeem #define	LUE 0100	/* function used in effects context		*/
46*34c98957Smeem #define	LUM 0200	/* mentioned somewhere other than at the declaration */
47*34c98957Smeem #define	LDS 0400	/* defined static object (like LDI)		*/
48*34c98957Smeem #define	LFN 01000	/* filename record				*/
49*34c98957Smeem #define	LSU 02000	/* struct/union def				*/
50*34c98957Smeem #define	LPR 04000	/* prototype declaration			*/
51*34c98957Smeem #define	LND 010000	/* end module marker				*/
52*34c98957Smeem #define	LPF 020000	/* printf like					*/
53*34c98957Smeem #define	LSF 040000	/* scanf like					*/
54*34c98957Smeem 
55*34c98957Smeem #define	LNQUAL		00037		/* type w/o qualifiers		*/
56*34c98957Smeem #define	LNUNQUAL	0174000		/* remove type, keep other info */
57*34c98957Smeem #define	LCON		(1<<15)		/* type qualified by const	*/
58*34c98957Smeem #define	LVOL		(1<<14)		/* type qualified by volatile	*/
59*34c98957Smeem #define	LNOAL		(1<<13)		/* not used */
60*34c98957Smeem #define	LCONV		(1<<12)		/* type is an integer constant	*/
61*34c98957Smeem #define	LPTR		(1<<11)		/* last modifier is a pointer	*/
62*34c98957Smeem #define	LINTVER		4
63*34c98957Smeem 
64*34c98957Smeem typedef unsigned long T1WORD;
65*34c98957Smeem typedef long FILEPOS;
66*34c98957Smeem typedef short TY;
67*34c98957Smeem 
68*34c98957Smeem typedef struct flens {
69*34c98957Smeem 	long		f1, f2, f3, f4;
70*34c98957Smeem 	unsigned short	ver, mno;
71*34c98957Smeem } FLENS;
72*34c98957Smeem 
73*34c98957Smeem typedef struct {
74*34c98957Smeem 	TY		aty;		/* base type			*/
75*34c98957Smeem 	unsigned long	dcl_mod;	/* ptr/ftn/ary modifiers	*/
76*34c98957Smeem 	unsigned short	dcl_con;	/* const qualifiers		*/
77*34c98957Smeem 	unsigned short	dcl_vol;	/* volatile qualifiers		*/
78*34c98957Smeem 	union {
79*34c98957Smeem 		T1WORD	ty;
80*34c98957Smeem 		FILEPOS	pos;
81*34c98957Smeem 	} extra;
82*34c98957Smeem } ATYPE;
83*34c98957Smeem 
84*34c98957Smeem typedef struct {
85*34c98957Smeem 	short		decflag;	/* what type of record is this	*/
86*34c98957Smeem 	short		nargs;		/* # of args (or members)	*/
87*34c98957Smeem 	int		fline;		/* line defined/used in		*/
88*34c98957Smeem 	ATYPE		type;		/* type information		*/
89*34c98957Smeem } LINE;
90*34c98957Smeem 
91*34c98957Smeem union rec {
92*34c98957Smeem 	LINE l;
93*34c98957Smeem 	struct {
94*34c98957Smeem 		short decflag;
95*34c98957Smeem 		char *fn;
96*34c98957Smeem 	} f;
97*34c98957Smeem };
98*34c98957Smeem 
99*34c98957Smeem /* type modifiers */
100*34c98957Smeem #define	LN_TMASK 3
101*34c98957Smeem #define	LN_ISPTR(x)	(((x)&LN_TMASK) == 1)  /* is x a pointer type */
102*34c98957Smeem #define	LN_ISFTN(x)	(((x)&LN_TMASK) == 2)  /* is x a function type */
103*34c98957Smeem #define	LN_ISARY(x)	(((x)&LN_TMASK) == 3)  /* is x an array type */
104*34c98957Smeem 
105*34c98957Smeem /* type numbers for pass2 */
106*34c98957Smeem #define	LN_STRUCT	21	/* generic struct */
107*34c98957Smeem #define	LN_UNION	22	/* generic union */
108*34c98957Smeem 
109*34c98957Smeem #endif	/* LNSTUFF_H */
110