Skip to content

Commit 898fecd

Browse files
karkhazdanielsn
authored andcommitted
Temporarily disable the __CPROVER_{r,w}_ok macros
This is while we work to resolve an issue with CBMC, described at diffblue/cbmc#5194
1 parent a798f57 commit 898fecd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

include/aws/common/assert.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ AWS_EXTERN_C_END
9696
# define AWS_POSTCONDITION1(cond) __CPROVER_assert((cond), # cond " check failed")
9797
# define AWS_FATAL_POSTCONDITION2(cond, explanation) __CPROVER_assert((cond), (explanation))
9898
# define AWS_FATAL_POSTCONDITION1(cond) __CPROVER_assert((cond), # cond " check failed")
99-
# define AWS_MEM_IS_READABLE(base, len) __CPROVER_r_ok((base), (len))
100-
# define AWS_MEM_IS_WRITABLE(base, len) __CPROVER_w_ok((base), (len))
10199
#else
102100
# define AWS_PRECONDITION2(cond, expl) AWS_ASSERT(cond)
103101
# define AWS_PRECONDITION1(cond) AWS_ASSERT(cond)
@@ -107,12 +105,17 @@ AWS_EXTERN_C_END
107105
# define AWS_POSTCONDITION1(cond) AWS_ASSERT(cond)
108106
# define AWS_FATAL_POSTCONDITION2(cond, expl) AWS_FATAL_ASSERT(cond)
109107
# define AWS_FATAL_POSTCONDITION1(cond) AWS_FATAL_ASSERT(cond)
108+
#endif /* CBMC */
110109

111110
/* the C runtime does not give a way to check these properties,
112-
* but we can at least check that the pointer is valid */
113-
# define AWS_MEM_IS_READABLE(base, len) (((len) == 0) || (base))
114-
# define AWS_MEM_IS_WRITABLE(base, len) (((len) == 0) || (base))
115-
#endif /* CBMC */
111+
* but we can at least check that the pointer is valid.
112+
* these macros are intended to be used with CBMC proofs, but will not use CBMC
113+
* intrinsics until https://github.com/diffblue/cbmc/issues/5194 is fixed.*/
114+
#define AWS_MEM_IS_READABLE(base, len) (((len) == 0) || (base))
115+
#define AWS_MEM_IS_WRITABLE(base, len) (((len) == 0) || (base))
116+
117+
#define __CPROVER_r_ok(base, len) (AWS_MEM_IS_READABLE(base, len))
118+
#define __CPROVER_w_ok(base, len) (AWS_MEM_IS_WRITEABLE(base, len))
116119

117120
#define AWS_RETURN_ERROR_IF_IMPL(type, cond, err, explanation) \
118121
do { \

0 commit comments

Comments
 (0)