From 8296ca3085c1fc0c86659000440357e1c02e9595 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Tue, 7 Sep 2021 13:44:56 +0200 Subject: Fixed a few difficult bugs. including VC compability. --- include/stc/ccommon.h | 2 +- include/stc/clist.h | 2 +- include/stc/template.h | 4 ++-- include/stc/test_new_map.c | 14 +++++++------- include/stc/test_new_vec.c | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index d1df91a3..bad9dc8c 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -53,7 +53,7 @@ /* Macro overloading feature support based on: https://rextester.com/ONP80107 */ #define c_MACRO_OVERLOAD(name, ...) \ - c_PASTE(name ## _, c_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__) + c_PASTE3(name, _, c_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__) #define c_CONCAT(a, b) a##b #define c_PASTE(a, b) c_CONCAT(a, b) #define c_CONCAT3(a, b, c) a##b##c diff --git a/include/stc/clist.h b/include/stc/clist.h index 43790aac..8bca82e2 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -78,7 +78,7 @@ _c_clist_complete_types(clist_VOID, dummy); #if !defined i_fwd cx_deftypes(_c_clist_types, Self, i_val); #endif -cx_deftypes(_c_clist_complete_types, Self); +cx_deftypes(_c_clist_complete_types, Self, dummy); typedef i_valraw cx_rawvalue_t; diff --git a/include/stc/template.h b/include/stc/template.h index cfa53a5c..f0aa5634 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -27,8 +27,8 @@ #define STC_TEMPLATE_H_INCLUDED #define cx_memb(name) c_PASTE(Self, name) #define Self c_PASTE3(i_module, _, i_tag) - // typedef container types defined in forward.h - #define cx_deftypes(macro, SELF, ...) macro(SELF, __VA_ARGS__) + // typedef container types defined in forward.h. VC requires c_EXPAND. + #define cx_deftypes(macro, SELF, ...) c_EXPAND(macro(SELF, __VA_ARGS__)) #define cx_value_t cx_memb(_value_t) #define cx_key_t cx_memb(_key_t) diff --git a/include/stc/test_new_map.c b/include/stc/test_new_map.c index b59bd145..3a40a501 100644 --- a/include/stc/test_new_map.c +++ b/include/stc/test_new_map.c @@ -1,5 +1,5 @@ -#include "cstr.h" -#include "forward.h" +#include +#include forward_cmap(pnt, struct Point, int); @@ -11,7 +11,7 @@ struct MyStruct { #define i_key int #define i_val int -#include "cmap.h" +#include struct Point { int x, y; } typedef Point; int point_compare(const Point* a, const Point* b) { @@ -22,14 +22,14 @@ int point_compare(const Point* a, const Point* b) { #define i_key Point #define i_val int #define i_cmp point_compare -#include "cmap.h" +#include #define i_key_str #define i_val_str -#include "cmap.h" +#include #define i_key_str -#include "cset.h" +#include int main() @@ -54,4 +54,4 @@ int main() cset_str sset = cset_str_init(); cset_str_emplace(&sset, "Hello, friend"); cset_str_del(&sset); - } \ No newline at end of file +} \ No newline at end of file diff --git a/include/stc/test_new_vec.c b/include/stc/test_new_vec.c index 3cc770da..88c71679 100644 --- a/include/stc/test_new_vec.c +++ b/include/stc/test_new_vec.c @@ -1,5 +1,5 @@ -#include "cstr.h" -#include "forward.h" +#include +#include forward_cvec(i32, int); forward_cvec(pnt, struct Point); @@ -12,7 +12,7 @@ struct MyStruct { #define f_tag i32 #define i_val int -#include "cvec.h" +#include struct Point { int x, y; } typedef Point; int point_compare(const Point* a, const Point* b) { @@ -22,13 +22,13 @@ int point_compare(const Point* a, const Point* b) { #define f_tag pnt #define i_val Point #define i_cmp point_compare -#include "cvec.h" +#include #define i_val float -#include "cvec.h" +#include #define i_val_str -#include "cvec.h" +#include int main() -- cgit v1.2.3