CBMC
cprover.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C library check
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #ifndef CPROVER_ANSI_C_LIBRARY_CPROVER_H
10 #define CPROVER_ANSI_C_LIBRARY_CPROVER_H
11 
15 
16 // NOLINTNEXTLINE(readability/identifiers)
17 typedef __typeof__(sizeof(int)) __CPROVER_size_t;
18 // NOLINTNEXTLINE(readability/identifiers)
19 typedef signed long long __CPROVER_ssize_t;
20 
21 #define __CPROVER_constant_infinity_uint 1
22 
23 void *__CPROVER_allocate(__CPROVER_size_t size, __CPROVER_bool zero);
24 void __CPROVER_deallocate(void *);
25 extern const void *__CPROVER_deallocated;
26 extern const void *__CPROVER_memory_leak;
27 
29 extern __CPROVER_bool __CPROVER_malloc_may_fail;
30 // The maximum size of an object that we can handle under the object:offset
31 // pointer encoding. Marked thread-local as it is a per-analysis constant that
32 // can safely be constant-propagated even in concurrent execution.
33 extern __CPROVER_thread_local __CPROVER_size_t __CPROVER_max_malloc_size;
34 
35 // malloc failure modes
38 
40  _Bool widowed;
41  char data[4];
42  short next_avail;
43  short next_unread;
44 };
45 
46 // __CPROVER_equal expects two arguments of the same type -- any type is
47 // permitted, unsigned long long is just used for the benefit of running syntax
48 // checks using system compilers
49 __CPROVER_bool __CPROVER_equal(unsigned long long, unsigned long long);
50 
51 // The following built-ins are type checked by our C front-end and do not
52 // require declarations. They work with any types as described below. unsigned
53 // long long is just used to enable checks using system compilers.
54 
55 // detect overflow
56 // the following expect two numeric arguments
57 __CPROVER_bool __CPROVER_overflow_minus(unsigned long long, unsigned long long);
58 __CPROVER_bool __CPROVER_overflow_mult(unsigned long long, unsigned long long);
59 __CPROVER_bool __CPROVER_overflow_plus(unsigned long long, unsigned long long);
60 __CPROVER_bool __CPROVER_overflow_shl(unsigned long long, unsigned long long);
61 // expects one numeric argument
62 __CPROVER_bool __CPROVER_overflow_unary_minus(unsigned long long);
63 
64 // enumerations
65 // expects one enum-typed argument
66 __CPROVER_bool __CPROVER_enum_is_in_range(unsigned long long);
67 
68 // The following have an optional second parameter (the width), and are
69 // polymorphic in the first parameter: if the second argument is omitted, then
70 // the width of the subtype of the pointer-typed first argument is used.
71 __CPROVER_bool __CPROVER_r_ok(const void *, ...);
72 __CPROVER_bool __CPROVER_w_ok(const void *, ...);
73 __CPROVER_bool __CPROVER_rw_ok(const void *, ...);
74 
75 #include "../cprover_builtin_headers.h"
76 
77 #endif // CPROVER_ANSI_C_LIBRARY_CPROVER_H
void * __CPROVER_allocate(__CPROVER_size_t size, __CPROVER_bool zero)
__CPROVER_thread_local __CPROVER_size_t __CPROVER_max_malloc_size
int __CPROVER_malloc_failure_mode
int __CPROVER_malloc_failure_mode_return_null
typedef __typeof__(sizeof(int)) __CPROVER_size_t
__CPROVER_bool __CPROVER_overflow_mult(unsigned long long, unsigned long long)
__CPROVER_bool __CPROVER_w_ok(const void *,...)
void __CPROVER_deallocate(void *)
Definition: stdlib.c:670
const void * __CPROVER_deallocated
__CPROVER_bool __CPROVER_enum_is_in_range(unsigned long long)
__CPROVER_bool __CPROVER_overflow_shl(unsigned long long, unsigned long long)
__CPROVER_bool __CPROVER_equal(unsigned long long, unsigned long long)
const void * __CPROVER_memory_leak
__CPROVER_bool __CPROVER_malloc_may_fail
int __CPROVER_malloc_failure_mode_assert_then_assume
__CPROVER_bool __CPROVER_rw_ok(const void *,...)
__CPROVER_bool __CPROVER_overflow_minus(unsigned long long, unsigned long long)
__CPROVER_bool __CPROVER_overflow_plus(unsigned long long, unsigned long long)
__CPROVER_bool __CPROVER_r_ok(const void *,...)
__CPROVER_bool __CPROVER_overflow_unary_minus(unsigned long long)
signed long long __CPROVER_ssize_t
Definition: cprover.h:19
short next_unread
Definition: cprover.h:43
short next_avail
Definition: cprover.h:42
_Bool widowed
Definition: cprover.h:40
char data[4]
Definition: cprover.h:41