commit 065f93cebe1ab19cc333af3bde015d55b237bf45
parent 6cd25d711739ea44de770962fab99576d0eb69a0
Author: Robert Russell <robertrussell.72001@gmail.com>
Date: Tue, 26 Sep 2023 19:19:28 -0700
Make METHOD option mandatory or optional, as appropriate
Diffstat:
4 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/inc/dict/impl/macros.h b/inc/dict/impl/macros.h
@@ -2,6 +2,10 @@
#error "rcx/dict: DICT_NAME must be defined"
#endif
+#if (defined(DICT_DECLS) || defined(DICT_DEFS)) && !defined(DICT_METHOD)
+#error "rcx/dict: DICT_METHOD must be defined"
+#endif
+
#ifndef DICT_K
#error "rcx/dict: DICT_K must be defined"
#endif
@@ -25,7 +29,3 @@
#ifndef DICT_FREE
#define DICT_FREE free
#endif
-
-#ifndef DICT_METHOD
-#define DICT_METHOD(name) name
-#endif
diff --git a/inc/list/impl/macros.h b/inc/list/impl/macros.h
@@ -5,12 +5,12 @@
#define LIST_STATIC
#endif
-#ifndef LIST_T
-#error "rcx/list: LIST_T must be defined"
+#if (defined(LIST_DECLS) || defined(LIST_DEFS)) && !defined(LIST_METHOD)
+#error "rcx/list: LIST_METHOD must be defined"
#endif
-#ifndef LIST_METHOD
-#define LIST_METHOD(name) name
+#ifndef LIST_T
+#error "rcx/list: LIST_T must be defined"
#endif
#ifndef LIST_MIN_CAP
@@ -25,6 +25,7 @@
#define LIST_FREE free
#endif
+/* LIST_ASSERT is used for bounds checks. */
#ifndef LIST_ASSERT
#include "../../debug.h"
#define LIST_ASSERT ASSERT
diff --git a/inc/set/impl/macros.h b/inc/set/impl/macros.h
@@ -2,6 +2,10 @@
#error "rcx/set: SET_NAME must be defined"
#endif
+#if (defined(SET_DECLS) || defined(SET_DEFS)) && !defined(SET_METHOD)
+#error "rcx/set: SET_METHOD must be defined"
+#endif
+
#ifndef SET_T
#error "rcx/set: SET_T must be defined"
#endif
@@ -21,7 +25,3 @@
#ifndef SET_FREE
#define SET_FREE free
#endif
-
-#ifndef SET_METHOD
-#define SET_METHOD(name) name
-#endif
diff --git a/inc/table/impl/macros.h b/inc/table/impl/macros.h
@@ -5,6 +5,10 @@
#define TABLE_STATIC
#endif
+#if (defined(TABLE_DECLS) || defined(TABLE_DEFS)) && !defined(TABLE_METHOD)
+#error "rcx/table: TABLE_METHOD must be defined"
+#endif
+
#ifndef TABLE_KSIZE
#define TABLE_KSIZE r_spec_->ksize
#define TABLE_KSIZE_FIELD usize ksize;
@@ -62,10 +66,6 @@
#undef TABLE_USE_SPEC
#endif
-#ifndef TABLE_METHOD
-#define TABLE_METHOD(name) name
-#endif
-
/* PAGE_LEN_BITS should be chosen such that PAGE_LEN * KSIZE and
* PAGE_LEN * VSIZE are both divisible by alignof(K) and by alignof(V).
* The default basically guarantees this on 64 bit machines, but one might