]> andersk Git - splint.git/blame - src/Headers/lclintMacros.nf
Updating to use the LEnsures and LRequires instead of the ensures requires so
[splint.git] / src / Headers / lclintMacros.nf
CommitLineData
885824d3 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 BADBRANCHCONT \
54 do { llassertprint (FALSE, ("Bad branch taken!")); } while (FALSE)
55
56/*@notfunction@*/
57# define BADDEFAULT \
58 default: llassertprint (FALSE, ("Unexpected default case reached!")); \
59 exit (EXIT_FAILURE);
60
61/*@-namechecks@*/
62/*@notfunction@*/
63# define llassertprint(tst,p) \
64 do { \
65 if (!(tst)) { \
66 llbug (message("%q:%d: llassert failed: " #tst ": %q", \
67 cstring_makeLiteral (__FILE__), __LINE__,\
68 /*@-mustfree@*/ message p) /*@=mustfree@*/ ); \
69 }} while (FALSE)
70
71/*@notfunction@*/
72# define llassertprintret(tst,p,r) \
73 do { if (!(tst)) \
74 { llbug (message("%q:%d: %q", cstring_makeLiteral (__FILE__), __LINE__, message p)); \
75 /*@-unreachable@*/ return (r); /*@=unreachable@*/ \
76 } } while (FALSE)
77
78/*@notfunction@*/
79# define abst_typedef typedef /*@abstract@*/
80
81/*@notfunction@*/
82# define immut_typedef typedef /*@abstract@*/ /*@immutable@*/
83
84/*@=namechecks@*/
85
86/*
87** SunOS4 can't handle bit fields correctly.
88*/
89
90# ifdef SYSSunOS
91/*@notfunction@*/
92# define BOOLBITS
93# else
94/*@notfunction@*/
95# define BOOLBITS : 1
96# endif
97
98/*
99** some stupid proprocessors replace the s in %s...had
100** to change s to arg.
101*/
102
103/*@notfunction@*/
104# define NOALIAS(s,t) (/*@ignore@*/ (s == NULL) || (s != t) /*@end@*/)
105
106/*@notfunction@*/
107# define TPRINTF(arg) \
108 do { /*@-mustfree@*/ /*@-null@*/ (void) fflush (stderr); (void) fflush (stdout); \
109 printf ("%s:%d [%s]: >> ", __FILE__, __LINE__, cstring_toCharsSafe (fileloc_unparse(g_currentloc))); \
110 (void)printf arg; printf("\n"); /*@=mustfree@*/ /*@=null@*/ (void) fflush (stdout); \
111 } while (FALSE)
112
ef2aa32a 113
885824d3 114# if DEBUGPRINT
115/*@notfunction@*/
116# define DPRINTF(s) /*@access cstring@*/ TPRINTF(s) /*@noaccess cstring@*/
117# else
118/*@notfunction@*/
119# define DPRINTF(s)
120# endif
121
122/*@notfunction@*/
123# define INTCOMPARERETURN(x,y) \
124 do { if ((x) > (y)) { return 1; } \
125 else { if ((x) < (y)) { return -1; }}} while (FALSE);
126
127/*@notfunction@*/
128# define COMPARERETURN(z) \
129 do { if (z != 0) { return z; } } while (FALSE);
130
131# else
132# error "Multiple include"
133# endif
134
135
This page took 0.098498 seconds and 5 git commands to generate.