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 | c38dbf7975d0df4758b295b90a47c1dbaaeaa976 (patch) | |
tree | e78af52c4971974ba157469e7d656e6f1ff71d94 | |
parent | de1cce6d446c38fde590cac2531560742d446043 (diff) | |
download | txr-c38dbf7975d0df4758b295b90a47c1dbaaeaa976.tar.gz txr-c38dbf7975d0df4758b295b90a47c1dbaaeaa976.tar.bz2 txr-c38dbf7975d0df4758b295b90a47c1dbaaeaa976.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; } |