X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=include%2Flttng%2Fust-utils.h;h=d2747d4a6a388b6ac312f4e7b2528048e4de9209;hb=10937ee5c85456292ce4e8d67c9ac7bc37caf974;hp=23d1a07c01081aa55e7279c86d6915b495c271f2;hpb=eae3c72949135b48639440468dc78ea1d5e937e9;p=lttng-ust.git diff --git a/include/lttng/ust-utils.h b/include/lttng/ust-utils.h index 23d1a07c..d2747d4a 100644 --- a/include/lttng/ust-utils.h +++ b/include/lttng/ust-utils.h @@ -28,7 +28,11 @@ * * Returns true if the type of @type is signed. */ -#define lttng_ust_is_signed_type(type) ((type) -1 < (type) 1) +#if defined(__cplusplus) +#define lttng_ust_is_signed_type(type) (std::is_signed::value) +#else +#define lttng_ust_is_signed_type(type) ((type) -1 < (type) 1) +#endif /** @@ -42,6 +46,7 @@ #define lttng_ust_is_integer_type(type) \ (__builtin_types_compatible_p(type, _Bool) || \ __builtin_types_compatible_p(type, char) || \ + __builtin_types_compatible_p(type, signed char) || \ __builtin_types_compatible_p(type, unsigned char) || \ __builtin_types_compatible_p(type, short) || \ __builtin_types_compatible_p(type, unsigned short) || \ @@ -54,15 +59,15 @@ #endif /** - * lttng_ust_ctf_array_element_type_is_supported - + * lttng_ust_field_array_element_type_is_supported - * - * Adds a compilation assertion that CTF arrays and sequences declared by the + * Adds a compilation assertion that array and sequence fields declared by the * user are of an integral type. */ -#define lttng_ust_ctf_array_element_type_is_supported(type, item) \ - lttng_static_assert(lttng_ust_is_integer_type(type), \ - "Non-integer type `" #item "` not supported as element of CTF_ARRAY or CTF_SEQUENCE", \ - Non_integer_type__##item##__not_supported_as_element_of_CTF_ARRAY_or_CTF_SEQUENCE); +#define lttng_ust_field_array_element_type_is_supported(type, item) \ + lttng_ust_static_assert(lttng_ust_is_integer_type(type), \ + "Non-integer type `" #item "` not supported as element of LTTNG_UST_FIELD_ARRAY or LTTNG_UST_FIELD_SEQUENCE", \ + Non_integer_type__##item##__not_supported_as_element_of_LTTNG_UST_FIELD_ARRAY_or_LTTNG_UST_FIELD_SEQUENCE) /**