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.)
35 /*@notreached@*/ do { llassertprint(FALSE, ("Reached dead code!")); \
36 exit(EXIT_FAILURE); } while (FALSE)
40 /*@notreached@*/ BADBRANCHCONT
43 # define BADBRANCHNULL \
44 /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return NULL; /*@=mustfree@*/ /*@=globstate@*/
47 # define BADBRANCHCONT \
48 do { llassertprint (FALSE, ("Bad branch taken!")); } while (FALSE)
51 # define BADBRANCHRET(r) \
52 /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return (r); /*@=mustfree@*/ /*@=globstate@*/
56 default: llassertprint (FALSE, ("Unexpected default case reached!")); \
61 # define llassertprint(tst,p) \
64 llbug (message("%q:%d: llassert failed: " #tst ": %q", \
65 cstring_makeLiteral (__FILE__), __LINE__,\
66 /*@-mustfree@*/ message p) /*@=mustfree@*/ ); \
70 # define abst_typedef typedef /*@abstract@*/
73 # define immut_typedef typedef /*@abstract@*/ /*@immutable@*/
78 ** SunOS4 can't handle bit fields correctly.
90 ** some stupid proprocessors replace the s in %s...had
91 ** to change s to arg.
95 # define NOALIAS(s,t) (/*@ignore@*/ (s == NULL) || (s != t) /*@end@*/)
97 /* evans 2002-02-24: got rid of -formatconst */
100 # define TPRINTF(arg) \
101 do { /*@-mustfree@*/ /*@-null@*/ (void) fflush (stderr); (void) fflush (stdout); \
102 printf ("%s:%d [%s]: >> ", __FILE__, __LINE__, cstring_toCharsSafe (fileloc_unparse(g_currentloc))); \
103 (void)printf arg; printf("\n"); /*@=mustfree@*/ /*@=null@*/ (void) fflush (stdout); \
107 ** DPRINTF does nothing, just a marker to save TPRINTF's
114 # define INTCOMPARERETURN(x,y) \
115 do { if ((x) > (y)) { return 1; } \
116 else { if ((x) < (y)) { return -1; }}} while (FALSE);
119 # define COMPARERETURN(z) \
120 do { if (z != 0) { return z; } } while (FALSE);
123 # error "Multiple include"