X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fbitfield.h;h=9386fade1b760645cb431326f0fd7e13327cd7f0;hb=f6d8019ea6fbda4df5d746fd20fa5d596e7b0556;hp=5ed629381ac6ff9508b4e432d8d784660a776d9b;hpb=04682184d7f67b02f73aa8f2581cfa2a67a81f74;p=lttng-ust.git diff --git a/include/lttng/bitfield.h b/include/lttng/bitfield.h index 5ed62938..9386fade 100644 --- a/include/lttng/bitfield.h +++ b/include/lttng/bitfield.h @@ -70,8 +70,12 @@ * Produce a build-time error if the condition `cond` is non-zero. * Evaluates as a size_t expression. */ +#ifdef __cplusplus +#define _BT_BUILD_ASSERT(cond) ([]{static_assert((cond), "");}, 0) +#else #define _BT_BUILD_ASSERT(cond) \ sizeof(struct { int f:(2 * !!(cond) - 1); }) +#endif /* * Cast value `v` to an unsigned integer of the same size as `v`. @@ -377,7 +381,7 @@ do { \ do { \ __typeof__(*(vptr)) *_vptr = (vptr); \ __typeof__(*_vptr) _v; \ - type *_ptr = (void *) (ptr); \ + type *_ptr = (type *) (ptr); \ unsigned long _start = (start), _length = (length); \ type _mask, _cmask; \ unsigned long _ts = sizeof(type) * CHAR_BIT; /* type size */ \