diff options
| -rw-r--r-- | include/stc/priv/template.h | 16 | ||||
| -rw-r--r-- | misc/examples/arc_containers.c | 2 | ||||
| -rw-r--r-- | misc/examples/arc_demo.c | 1 | ||||
| -rw-r--r-- | misc/examples/arcvec_erase.c | 2 | ||||
| -rw-r--r-- | misc/examples/new_sptr.c | 1 | ||||
| -rw-r--r-- | misc/examples/shape.c | 1 |
6 files changed, 14 insertions, 9 deletions
diff --git a/include/stc/priv/template.h b/include/stc/priv/template.h index 4667f885..de0c8f0d 100644 --- a/include/stc/priv/template.h +++ b/include/stc/priv/template.h @@ -54,7 +54,7 @@ #if !(defined i_key || defined i_key_str || defined i_key_ssv || \ defined i_keyclass || defined i_keyboxed) #if defined _i_ismap - #error "i_key* must be defined for maps." + #error "i_key* must be defined for maps" #endif #if defined i_val_str @@ -156,11 +156,11 @@ #endif #if !defined i_key - #error "no i_key or i_val defined" + #error "No i_key or i_val defined" #elif defined i_keyraw ^ defined i_keyto - #error "both i_***raw and i_***to must be defined, if any" + #error "Both i_xxxraw and i_xxxto must be defined, if any" #elif defined i_keyfrom && !defined i_keyraw - #error "i_***from defined without i_***raw" + #error "i_xxxfrom defined without i_xxxraw" #elif defined i_from || defined i_drop #error "i_from / i_drop not supported. Define i_keyfrom/i_valfrom and/or i_keydrop/i_valdrop instead" #endif @@ -168,8 +168,10 @@ #ifndef i_tag #define i_tag i_key #endif -#if c_option(c_no_clone) || (!defined i_keyclone && (defined i_keydrop || defined i_keyraw)) +#if c_option(c_no_clone) #define i_no_clone +#elif !(defined i_keyclone || defined i_no_clone) && (defined i_keydrop || defined i_keyraw) + #error i_xxxclone should be defined when i_xxxdrop or i_xxxraw is defined #endif #ifndef i_keyraw #define i_keyraw i_key @@ -244,8 +246,8 @@ #error "i_val* must be defined for maps" #endif -#if !defined i_valclone && (defined i_valdrop || defined i_valraw) - #define i_no_clone +#if !(defined i_valclone || defined i_no_clone) && (defined i_valdrop || defined i_valraw) + #error i_valclone should be defined when i_valdrop or i_valraw is defined #endif #ifndef i_valraw #define i_valraw i_val diff --git a/misc/examples/arc_containers.c b/misc/examples/arc_containers.c index 026f9eb5..bfe15150 100644 --- a/misc/examples/arc_containers.c +++ b/misc/examples/arc_containers.c @@ -12,7 +12,7 @@ #define i_val Map #define i_valdrop(p) (printf("drop Arc:\n"), Map_drop(p)) // no need for atomic ref. count in single thread: -#define i_opt c_no_atomic|c_no_lookup +#define i_opt c_no_atomic|c_no_lookup|c_no_clone #include <stc/carc.h> #define i_type Stack diff --git a/misc/examples/arc_demo.c b/misc/examples/arc_demo.c index f1cf3fda..564ebd6d 100644 --- a/misc/examples/arc_demo.c +++ b/misc/examples/arc_demo.c @@ -11,6 +11,7 @@ void int_drop(int* x) { #define i_type Arc // set type name to be defined (instead of 'carc_int') #define i_val int #define i_valdrop int_drop // optional, just to display the elements destroyed +#define i_no_clone // required because of valdrop #include <stc/carc.h> // Arc #define i_keyboxed Arc // note: use i_keyboxed instead of i_key for carc/cbox elements diff --git a/misc/examples/arcvec_erase.c b/misc/examples/arcvec_erase.c index eb54084a..8385ed65 100644 --- a/misc/examples/arcvec_erase.c +++ b/misc/examples/arcvec_erase.c @@ -5,7 +5,7 @@ void show_drop(int* x) { printf("drop: %d\n", *x); } #define i_type Arc #define i_val int #define i_valdrop show_drop -#define i_cmp c_default_cmp // enable object comparisons (default ptr compare) +#define i_no_clone // required because of valdrop #include <stc/carc.h> // Shared pointer to int #define i_type Vec diff --git a/misc/examples/new_sptr.c b/misc/examples/new_sptr.c index 90ce30b2..5441ae01 100644 --- a/misc/examples/new_sptr.c +++ b/misc/examples/new_sptr.c @@ -16,6 +16,7 @@ uint64_t Person_hash(const Person* p); #define i_type IPtr #define i_val int #define i_valdrop(x) printf("drop: %d\n", *x) +#define i_no_clone #include <stc/carc.h> #define i_type IPStack diff --git a/misc/examples/shape.c b/misc/examples/shape.c index 4f7903da..ed0c3fe1 100644 --- a/misc/examples/shape.c +++ b/misc/examples/shape.c @@ -127,6 +127,7 @@ static struct ShapeAPI Polygon_api = { #define i_type Shapes #define i_val Shape* #define i_valdrop(x) Shape_delete(*x) +#define i_no_clone #include <stc/cstack.h> void testShape(const Shape* shape) |
