diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/fwd/ast.h | 8 | ||||
| -rw-r--r-- | include/fwd/coverage.h | 21 | ||||
| -rw-r--r-- | include/fwd/tracker.h | 7 |
3 files changed, 36 insertions, 0 deletions
diff --git a/include/fwd/ast.h b/include/fwd/ast.h index 8af444c..9b474c9 100644 --- a/include/fwd/ast.h +++ b/include/fwd/ast.h @@ -9,6 +9,8 @@ #include <assert.h> #include <stdbool.h> +#include <fwd/coverage.h> + /** * @file ast.h * @@ -665,6 +667,12 @@ struct ast *clone_ast_list(struct ast *l); struct type *clone_type(struct type *type); struct type *clone_type_list(struct type *types); +#define clone_astc(...) cover_ptr(clone_ast, __VA_ARGS__) +#define clone_ast_listc(...) cover_ptr(clone_ast_list, __VA_ARGS__) + +#define clone_typec(...) cover_ptr(clone_type, __VA_ARGS__) +#define clone_type_listc(...) cover_ptr(clone_type_list, __VA_ARGS__) + void ast_dump_list(int depth, struct ast *root); void ast_dump(int depth, struct ast *node); void ast_append(struct ast **list, struct ast *elem); diff --git a/include/fwd/coverage.h b/include/fwd/coverage.h new file mode 100644 index 0000000..3ec0b64 --- /dev/null +++ b/include/fwd/coverage.h @@ -0,0 +1,21 @@ +#ifndef FWD_COVERAGE_H +#define FWD_COVERAGE_H + +#include <stdlib.h> + +#ifdef COVERAGE +#include <covsrv/covsrv.h> +# define cover_ptr(name, ...) ({covsrv_die() ? NULL : name (__VA_ARGS__);}) +#else +# define cover_ptr(name, ...) name (__VA_ARGS__) +#endif + +#define mallocc(...) cover_ptr(malloc, __VA_ARGS__) +#define callocc(...) cover_ptr(calloc, __VA_ARGS__) +#define reallocc(...) cover_ptr(realloc, __VA_ARGS__) + +#define strdupc(...) cover_ptr(strdup, __VA_ARGS__) +#define strndupc(...) cover_ptr(strndup, __VA_ARGS__) + + +#endif /* FWD_COVERAGE_H */ diff --git a/include/fwd/tracker.h b/include/fwd/tracker.h new file mode 100644 index 0000000..94c657e --- /dev/null +++ b/include/fwd/tracker.h @@ -0,0 +1,7 @@ +#ifndef FWD_TRACKER_H +#define FWD_TRACKER_H + +void *track_ptr(void *p); +void free_tracked_ptrs(); + +#endif /* FWD_TRACKER_H */ |
