klee: Start preparing for klee tests

First stage: something compiling without klee, but with a buch of dirty
hacks - done.
Second stage: something running under klee, able to emit useful results,
but still using dirty hacks - done.

Third stage: make CMake care about clang argumnets - not done, may be
omitted if proves to be too hard. Not that klee can be run on CI in any
case.
This commit is contained in:
ZyX
2017-09-11 01:27:46 +03:00
parent 430e516d3a
commit 7c97f78393
9 changed files with 601 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
#ifndef NVIM_LIB_RINGBUF_H
#define NVIM_LIB_RINGBUF_H
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include <stdint.h>
@@ -73,6 +74,32 @@ typedef struct { \
RBType *buf_end; \
} TypeName##RingBuffer;
/// Dummy item free macros, for use in RINGBUF_INIT
///
/// This macros actually does nothing.
///
/// @param[in] item Item to be freed.
#define RINGBUF_DUMMY_FREE(item)
/// Static ring buffer
///
/// @warning Ring buffers created with this macros must neither be freed nor
/// deallocated.
///
/// @param scope Ring buffer scope.
/// @param TypeName Ring buffer type name.
/// @param RBType Type of the single ring buffer element.
/// @param varname Variable name.
/// @param rbsize Ring buffer size.
#define RINGBUF_STATIC(scope, TypeName, RBType, varname, rbsize) \
static RBType _##varname##_buf[rbsize]; \
scope TypeName##RingBuffer varname = { \
.buf = _##varname##_buf, \
.next = _##varname##_buf, \
.first = NULL, \
.buf_end = _##varname##_buf + rbsize - 1, \
};
/// Initialize a new ring buffer
///
/// @param TypeName Ring buffer type name. Actual type name will be