2 ** Copyright (c) Massachusetts Institute of Technology 1994, 1995.
3 ** All Rights Reserved.
4 ** Unpublished rights reserved under the copyright laws of
7 ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 ** OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
10 ** This code is distributed freely and may be used freely under the
11 ** following conditions:
13 ** 1. This notice may not be removed or altered.
15 ** 2. This code may not be re-distributed or modified
16 ** without permission from MIT (contact
17 ** lclint-request@larch.lcs.mit.edu.)
19 ** Modification and re-distribution are encouraged,
20 ** but we want to keep track of changes and
21 ** distribution sites.
24 # ifndef LCLINTMACROS_H
25 # define LCLINTMACROS_H
29 ** This file contains notfunction macros (hence, the .nf extension to
30 ** prevent it being skipped when +neverinclude is used.)
45 /*@notreached@*/ do { llassertprint(FALSE, ("Reached dead code!")); \
46 exit(EXIT_FAILURE); } while (FALSE)
50 /*@notreached@*/ BADBRANCHCONT
53 # define BADBRANCHNULL \
54 /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return NULL; /*@=mustfree@*/ /*@=globstate@*/
57 # define BADBRANCHCONT \
58 do { llassertprint (FALSE, ("Bad branch taken!")); } while (FALSE)
61 # define BADBRANCHRET(r) \
62 /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return (r); /*@=mustfree@*/ /*@=globstate@*/
66 default: llassertprint (FALSE, ("Unexpected default case reached!")); \
71 # define llassertprint(tst,p) \
74 llbug (message("%q:%d: llassert failed: " #tst ": %q", \
75 cstring_makeLiteral (__FILE__), __LINE__,\
76 /*@-mustfree@*/ message p) /*@=mustfree@*/ ); \
80 # define llassertprintret(tst,p,r) \
82 { llbug (message("%q:%d: %q", cstring_makeLiteral (__FILE__), __LINE__, message p)); \
83 /*@-unreachable@*/ return (r); /*@=unreachable@*/ \
87 # define abst_typedef typedef /*@abstract@*/
90 # define immut_typedef typedef /*@abstract@*/ /*@immutable@*/
95 ** SunOS4 can't handle bit fields correctly.
103 # define BOOLBITS : 1
107 ** some stupid proprocessors replace the s in %s...had
108 ** to change s to arg.
112 # define NOALIAS(s,t) (/*@ignore@*/ (s == NULL) || (s != t) /*@end@*/)
114 /* evans 2002-02-24: got rid of -formatconst */
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); \
124 ** DPRINTF does nothing, just a marker to save TPRINTF's
131 # define INTCOMPARERETURN(x,y) \
132 do { if ((x) > (y)) { return 1; } \
133 else { if ((x) < (y)) { return -1; }}} while (FALSE);
136 # define COMPARERETURN(z) \
137 do { if (z != 0) { return z; } } while (FALSE);
140 # error "Multiple include"