From 5d9493f1b63fdd55b7ab8494d558f74708d16375 Mon Sep 17 00:00:00 2001 From: jpreiss Date: Sat, 4 May 2024 13:36:29 -0700 Subject: [PATCH] silence clang narrowing warning for bindings --- src/modules/interface/param.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/interface/param.h b/src/modules/interface/param.h index ed18ee09e7..270a05ed7a 100644 --- a/src/modules/interface/param.h +++ b/src/modules/interface/param.h @@ -107,12 +107,14 @@ typedef float * (*paramGetterFloat)(void); /* Macros */ #define PARAM_ADD_FULL(TYPE, NAME, ADDRESS, CALLBACK, DEFAULT_GETTER) \ - { .type = ((TYPE) <= 0xFF) ? (TYPE) : (((TYPE) | PARAM_EXTENDED) & 0xFF), \ + { .type = ((TYPE) <= 0xFF) ? ((TYPE) & 0xFF) : (((TYPE) | PARAM_EXTENDED) & 0xFF), \ .extended_type = (((TYPE) & 0xFF00) >> 8), \ .name = #NAME, \ .address = (void*)(ADDRESS), \ .callback = (void *)CALLBACK, \ .getter = (void *)DEFAULT_GETTER, }, +// Storing (TYPE) & 0xFF instead of just (TYPE) in the first branch is a no-op, +// but it prevents noisy spurious warnings when compiling bindings with Clang. #define PARAM_ADD(TYPE, NAME, ADDRESS) \ PARAM_ADD_FULL(TYPE, NAME, ADDRESS, 0, 0)