]> andersk Git - splint.git/blame - src/Headers/splintMacros.nf
Modified the doc/Makefile.am so that the man page is install under make install.
[splint.git] / src / Headers / splintMacros.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
8250fa4a 52/*@notfunction@*/
53# define BADBRANCHNULL \
54 /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return NULL; /*@=mustfree@*/ /*@=globstate@*/
55
885824d3 56/*@notfunction@*/
57# define BADBRANCHCONT \
58 do { llassertprint (FALSE, ("Bad branch taken!")); } while (FALSE)
59
8250fa4a 60/*@notfunction@*/
61# define BADBRANCHRET(r) \
62 /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return (r); /*@=mustfree@*/ /*@=globstate@*/
63
885824d3 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
28bf4b0b 114/*@i343434*/ /*fix this before release verion*/
115/* get rid of @-formatconst@ */
116
885824d3 117/*@notfunction@*/
118# define TPRINTF(arg) \
28bf4b0b 119 do { /*@-mustfree@*/ /*@-null@*/ /*@-formatconst@*/ (void) fflush (stderr); (void) fflush (stdout); \
885824d3 120 printf ("%s:%d [%s]: >> ", __FILE__, __LINE__, cstring_toCharsSafe (fileloc_unparse(g_currentloc))); \
28bf4b0b 121 (void)printf arg; printf("\n"); /*@=formatconst@*/ /*@=mustfree@*/ /*@=null@*/ (void) fflush (stdout); \
885824d3 122 } while (FALSE)
123
7ac543fa 124/*
125** DPRINTF does nothing, just a marker to save TPRINTF's
126*/
ef2aa32a 127
885824d3 128/*@notfunction@*/
129# define DPRINTF(s)
885824d3 130
131/*@notfunction@*/
132# define INTCOMPARERETURN(x,y) \
133 do { if ((x) > (y)) { return 1; } \
134 else { if ((x) < (y)) { return -1; }}} while (FALSE);
135
136/*@notfunction@*/
137# define COMPARERETURN(z) \
138 do { if (z != 0) { return z; } } while (FALSE);
139
140# else
141# error "Multiple include"
142# endif
143
144
This page took 0.090636 seconds and 5 git commands to generate.