Skip to content

Commit

Permalink
Merge pull request #1374 from jpreiss/param_warning
Browse files Browse the repository at this point in the history
fix narrowing warning for param definitions
  • Loading branch information
ataffanel authored Jun 3, 2024
2 parents e6c4159 + 5d9493f commit 46c1387
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 46c1387

Please sign in to comment.