diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-02-22 06:51:52 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-02-22 06:51:52 -0800 |
commit | 86d0f204b530d48fbc2728e3cc25ed9125b0a496 (patch) | |
tree | e78af52c4971974ba157469e7d656e6f1ff71d94 | |
parent | 03c30c68162589c6042952c0b5d2a68ec1c6275c (diff) | |
download | txr-86d0f204b530d48fbc2728e3cc25ed9125b0a496.tar.gz txr-86d0f204b530d48fbc2728e3cc25ed9125b0a496.tar.bz2 txr-86d0f204b530d48fbc2728e3cc25ed9125b0a496.zip |
gc: c++ fix in type_t conversion.
* gc.c (sweep_one): The recent fix to address the clang
diagnostic from -fsanitize=implicit-conversion broke C++
compatibility, due to enums being type safe. We revert the
expression to the original, before that fix, and address the
clang diagnostic differently.
* gc.h (REACHABLE, FREE): Add a U suffix to the constants to
make them unsigned. The implicit conversion issue in the
expression convert(type_t, block->t.type & ~REACHABLE)
is that ~REACHABLE is -257, and is being converted to
unsigned.
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | gc.h | 4 |
2 files changed, 3 insertions, 3 deletions
@@ -606,7 +606,7 @@ static int sweep_one(obj_t *block) #if CONFIG_GEN_GC block->t.gen = 1; #endif - block->t.type &= convert(type_t, ~REACHABLE); + block->t.type = convert(type_t, block->t.type & ~REACHABLE); return 0; } @@ -66,8 +66,8 @@ extern val break_obj; #endif #define gc_hint(var) gc_hint_func(&var) -#define REACHABLE 0x100 -#define FREE 0x200 +#define REACHABLE 0x100U +#define FREE 0x200U INLINE val zap(volatile val *loc) { val ret = *loc; *loc = nil; return ret; } |