From c38dbf7975d0df4758b295b90a47c1dbaaeaa976 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 22 Feb 2022 06:51:52 -0800 Subject: 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. --- gc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gc.h') diff --git a/gc.h b/gc.h index 6103781a..a575ec88 100644 --- a/gc.h +++ b/gc.h @@ -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; } -- cgit v1.2.3