]> andersk Git - splint.git/blob - src/Headers/splintMacros.nf
Fixed all /*@i...@*/ tags (except 1).
[splint.git] / src / Headers / splintMacros.nf
1 /* ;-*-C-*-; 
2 **    Copyright (c) Massachusetts Institute of Technology 1994, 1995.
3 **          All Rights Reserved.
4 **          Unpublished rights reserved under the copyright laws of
5 **          the United States.
6 **
7 ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 ** OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
9 **
10 ** This code is distributed freely and may be used freely under the 
11 ** following conditions:
12 **
13 **     1. This notice may not be removed or altered.
14 **
15 **     2. This code may not be re-distributed or modified
16 **        without permission from MIT (contact 
17 **        lclint-request@larch.lcs.mit.edu.)  
18 **
19 **        Modification and re-distribution are encouraged,
20 **        but we want to keep track of changes and
21 **        distribution sites.
22 */
23
24 # ifndef LCLINTMACROS_H
25 # define LCLINTMACROS_H
26
27
28 /*
29 ** This file contains notfunction macros (hence, the .nf extension to
30 ** prevent it being skipped when +neverinclude is used.)
31 */
32
33 #ifndef PARAMS
34 #ifdef __STDC
35 /*@notfunction@*/
36 #define PARAMS(P) P
37 #else
38 /*@notfunction@*/
39 #define PARAMS(P) ()
40 #endif
41 #endif /* !PARAMS */
42
43 /*@notfunction@*/
44 # define BADEXIT \
45  /*@notreached@*/ do { llassertprint(FALSE, ("Reached dead code!")); \
46                        exit(EXIT_FAILURE); } while (FALSE) 
47
48 /*@notfunction@*/
49 # define BADBRANCH \
50   /*@notreached@*/ BADBRANCHCONT
51
52 /*@notfunction@*/
53 # define BADBRANCHNULL \
54   /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return NULL; /*@=mustfree@*/ /*@=globstate@*/
55
56 /*@notfunction@*/
57 # define BADBRANCHCONT \
58   do { llassertprint (FALSE, ("Bad branch taken!")); } while (FALSE) 
59
60 /*@notfunction@*/
61 # define BADBRANCHRET(r) \
62   /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return (r); /*@=mustfree@*/ /*@=globstate@*/
63
64 /*@notfunction@*/
65 # define BADDEFAULT \
66   default: llassertprint (FALSE, ("Unexpected default case reached!")); \
67            exit (EXIT_FAILURE);
68
69 /*@-namechecks@*/
70 /*@notfunction@*/
71 # define llassertprint(tst,p) \
72    do { \
73      if (!(tst)) { \
74       llbug (message("%q:%d: llassert failed: " #tst ": %q", \
75                      cstring_makeLiteral (__FILE__), __LINE__,\
76                      /*@-mustfree@*/ message p) /*@=mustfree@*/ ); \
77      }} while (FALSE)
78
79 /*@notfunction@*/
80 # define llassertprintret(tst,p,r) \
81     do { if (!(tst)) \
82          { llbug (message("%q:%d: %q", cstring_makeLiteral (__FILE__), __LINE__, message p)); \
83            /*@-unreachable@*/ return (r); /*@=unreachable@*/ \
84        } } while (FALSE)
85
86 /*@notfunction@*/
87 # define abst_typedef typedef /*@abstract@*/ 
88
89 /*@notfunction@*/
90 # define immut_typedef typedef /*@abstract@*/ /*@immutable@*/
91
92 /*@=namechecks@*/
93
94 /*
95 ** SunOS4 can't handle bit fields correctly.
96 */
97
98 # ifdef SYSSunOS
99 /*@notfunction@*/
100 # define BOOLBITS
101 # else 
102 /*@notfunction@*/
103 # define BOOLBITS : 1
104 # endif
105
106 /*
107 ** some stupid proprocessors replace the s in %s...had
108 ** to change s to arg.
109 */
110
111 /*@notfunction@*/
112 # define NOALIAS(s,t) (/*@ignore@*/ (s == NULL) || (s != t) /*@end@*/)
113
114 /* evans 2002-02-24: got rid of -formatconst */
115
116 /*@notfunction@*/
117 # define TPRINTF(arg) \
118   do { /*@-mustfree@*/ /*@-null@*/ (void) fflush (stderr); (void) fflush (stdout); \
119         printf ("%s:%d [%s]: >> ", __FILE__, __LINE__, cstring_toCharsSafe (fileloc_unparse(g_currentloc))); \
120         (void)printf arg; printf("\n"); /*@=mustfree@*/ /*@=null@*/ (void) fflush (stdout); \
121         } while (FALSE)
122
123 /*
124 ** DPRINTF does nothing, just a marker to save TPRINTF's
125 */
126
127 /*@notfunction@*/
128 # define DPRINTF(s)   
129
130 /*@notfunction@*/
131 # define INTCOMPARERETURN(x,y) \
132    do { if ((x) > (y)) { return 1; } \
133         else { if ((x) < (y)) { return -1; }}} while (FALSE);
134
135 /*@notfunction@*/
136 # define COMPARERETURN(z) \
137    do { if (z != 0) { return z; } } while (FALSE);
138
139 # else
140 # error "Multiple include"
141 # endif
142
143
This page took 0.052777 seconds and 5 git commands to generate.