From 1aba159f8fae5660922dcba6becaee7100a90a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20H=C3=B6hne?= Date: Sun, 29 Jun 2025 02:52:53 +0200 Subject: [PATCH] fix: More C++ support. --- include/set.h | 11 +++++++---- src/list.c | 3 ++- src/utils.c | 2 +- testtest.cpp | 12 ++++++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 testtest.cpp diff --git a/include/set.h b/include/set.h index a66ee13..1a1b69f 100644 --- a/include/set.h +++ b/include/set.h @@ -1,5 +1,6 @@ - +#ifndef __cplusplus #define _GNU_SOURCE +#endif #include #include @@ -7,14 +8,16 @@ #include #include +#ifdef __cplusplus +#include + +#endif + #include "utils.h" #ifndef INCLUDE_SET_H #define INCLUDE_SET_H -#define SET_MAX_ERROR_MSG_SIZE 256 -#define SET_MAX_NAME_SIZE 64 - /** * Meta data for one test function. * diff --git a/src/list.c b/src/list.c index 08c383f..c17c700 100644 --- a/src/list.c +++ b/src/list.c @@ -25,7 +25,8 @@ void set_ll_free_all(struct SETBlockMeta *head) struct SETBlockMeta *set_ll_free_one(struct SETBlockMeta *head, void *address) { - struct SETBlockMeta *meta = address - (sizeof(struct SETBlockMeta)); + struct SETBlockMeta *meta = + (struct SETBlockMeta *)address - (sizeof(struct SETBlockMeta)); if (meta->prev == NULL) { diff --git a/src/utils.c b/src/utils.c index 5c58394..4f88b84 100644 --- a/src/utils.c +++ b/src/utils.c @@ -48,7 +48,7 @@ int create_shared_suit_space(size_t size) void *set_malloc(size_t n) { void *blocks = malloc(n + sizeof(struct SETBlockMeta)); - struct SETBlockMeta *meta = blocks; + struct SETBlockMeta *meta = (struct SETBlockMeta *)blocks; meta->next = NULL; meta->prev = NULL; diff --git a/testtest.cpp b/testtest.cpp new file mode 100644 index 0000000..f3006d0 --- /dev/null +++ b/testtest.cpp @@ -0,0 +1,12 @@ +#include "set.h" +#include "set_asserts.h" + +NO_SETUP; + +NO_TEAR_DOWN; + +TEST(Basic) { ASSERT_EQ(1, 1); } + +SUIT(Basic) { ADD_TEST(Basic); } + +BUNDLE() { ADD_SUIT(Basic); }