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 BADBRANCHCONT \
54 do { llassertprint (FALSE, ("Bad branch taken!")); } while (FALSE)
58 default: llassertprint (FALSE, ("Unexpected default case reached!")); \
63 # define llassertprint(tst,p) \
66 llbug (message("%q:%d: llassert failed: " #tst ": %q", \
67 cstring_makeLiteral (__FILE__), __LINE__,\
68 /*@-mustfree@*/ message p) /*@=mustfree@*/ ); \
72 # define llassertprintret(tst,p,r) \
74 { llbug (message("%q:%d: %q", cstring_makeLiteral (__FILE__), __LINE__, message p)); \
75 /*@-unreachable@*/ return (r); /*@=unreachable@*/ \
79 # define abst_typedef typedef /*@abstract@*/
82 # define immut_typedef typedef /*@abstract@*/ /*@immutable@*/
87 ** SunOS4 can't handle bit fields correctly.
99 ** some stupid proprocessors replace the s in %s...had
100 ** to change s to arg.
104 # define NOALIAS(s,t) (/*@ignore@*/ (s == NULL) || (s != t) /*@end@*/)
106 /*@i343434*/ /*fix this before release verion*/
107 /* get rid of @-formatconst@ */
110 # define TPRINTF(arg) \
111 do { /*@-mustfree@*/ /*@-null@*/ /*@-formatconst@*/ (void) fflush (stderr); (void) fflush (stdout); \
112 printf ("%s:%d [%s]: >> ", __FILE__, __LINE__, cstring_toCharsSafe (fileloc_unparse(g_currentloc))); \
113 (void)printf arg; printf("\n"); /*@=formatconst@*/ /*@=mustfree@*/ /*@=null@*/ (void) fflush (stdout); \
119 # define DPRINTF(s) /*@access cstring@*/ TPRINTF(s) /*@noaccess cstring@*/
126 # define INTCOMPARERETURN(x,y) \
127 do { if ((x) > (y)) { return 1; } \
128 else { if ((x) < (y)) { return -1; }}} while (FALSE);
131 # define COMPARERETURN(z) \
132 do { if (z != 0) { return z; } } while (FALSE);
135 # error "Multiple include"