]> andersk Git - splint.git/blob - src/Headers/general.h
Added checking for union initializers.
[splint.git] / src / Headers / general.h
1 /*
2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001.
3 ** See ../LICENSE for license information.
4 **
5 */
6
7 # ifndef GENERAL_H
8 # define GENERAL_H
9
10 /* sgi's don't let you undef NULL */
11 # ifndef IRIX 
12 # ifdef NULL
13 # undef NULL
14 # endif
15 # endif
16
17 # include "forwardTypes.h"
18
19 # ifdef USEDMALLOC
20 # define sfree(x) do { if (x != NULL) free(x); } while (FALSE)
21 # else
22 extern void sfree (/*@out@*/ /*@only@*/ /*@null@*/ void *p_x) /*@modifies p_x@*/; 
23 # endif
24
25 # include "misc.h"
26 # include "cstring.h"
27 # include "bool.h"
28
29 extern /*@out@*/ /*@only@*/ void *dimalloc  (size_t p_size, const char *p_name, int p_line);
30 extern /*@only@*/ void *dicalloc  (size_t p_num, size_t p_size, const char *p_name, int p_line);
31 extern /*@notnull@*/ /*@out@*/ /*@only@*/ void *
32   direalloc (/*@returned@*/ /*@only@*/ /*@out@*/ /*@null@*/ void *p_x, 
33              size_t p_size, char *p_name, int p_line);
34
35 extern /*@only@*/ void *
36   drealloc (/*@special@*/ /*@null@*/ /*@sef@*/ void *p_x,
37             /*@sef@*/ size_t p_size)
38   /*@releases p_x@*/
39   /*@modifies *p_x@*/ ;
40
41 extern /*@out@*/ /*@only@*/ void *dmalloc (/*@sef@*/ size_t p_size) /*@*/
42    /*:ensures MaxSet(result) == (p_size - 1):*/ ;
43
44 # ifdef USEDMALLOC
45 # define dmalloc(s)    (malloc(s))
46 # define drealloc(s,l) (realloc(s,l))
47 # else
48 # define dmalloc(s)    (dimalloc(s, __FILE__, __LINE__))
49 # define drealloc(s,l) (direalloc(s, l, __FILE__, __LINE__))
50 # endif
51
52 # include "system_constants.h"
53
54 # ifdef USEGC
55 # include <gc.h>
56 # define NOFREE
57 # define free(s) ; /* nothing */ 
58 # else
59 # endif
60
61 # ifdef USEDMALLOC
62 # include "dmalloc.h"
63 # endif
64
65 /*
66 ** no file except general.c should use primitive
67 ** memory operations:
68 */
69
70 /*@-exportlocal@*/
71 # ifndef USEDMALLOC
72 # undef malloc
73 # undef realloc
74 # undef calloc
75 # define malloc(s)     (dimalloc(s, __FILE__, __LINE__))
76 # define calloc(n, s)  (dicalloc(n, s, __FILE__, __LINE__))
77 # define realloc(v, s) (direalloc(v, s, __FILE__, __LINE__))
78 # endif
79 /*@=exportlocal@*/
80
81 # ifndef NULL
82 # define NULL 0
83 # endif 
84
85 extern void sfreeEventually (/*@owned@*/ /*@null@*/ void *p_x) 
86    /*@modifies internalState@*/; 
87
88 typedef /*@dependent@*/ char *d_char;
89
90 /*@constant int NOT_FOUND;@*/
91 # define NOT_FOUND (-23)
92
93 # else
94 # error "Multiple include"
95 # endif
96
97
98
99
100
101
This page took 0.248782 seconds and 5 git commands to generate.