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