Skip to content

Commit

Permalink
silence clang narrowing warning for bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
jpreiss committed May 4, 2024
1 parent d9ee34a commit 5d9493f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/interface/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5d9493f

Please sign in to comment.