Add ctf_enum_auto() for autoincrementing enumeration values
[lttng-ust.git] / include / lttng / ust-tracepoint-event.h
index d9801a8f6416e4f031755d2f8aa348ee3b318a4e..0b4e5a262b537ea7de75b4502a83c7480a5c9d27 100644 (file)
@@ -132,14 +132,14 @@ static const char                                                 \
 #define ctf_enum_value(_string, _value)                                        \
        {                                                               \
                .start = {                                              \
-                       .signedness = lttng_is_signed_type(__typeof__(_value)), \
                        .value = lttng_is_signed_type(__typeof__(_value)) ? \
                                (long long) (_value) : (_value),        \
+                       .signedness = lttng_is_signed_type(__typeof__(_value)), \
                },                                                      \
                .end = {                                                \
-                       .signedness = lttng_is_signed_type(__typeof__(_value)), \
                        .value = lttng_is_signed_type(__typeof__(_value)) ? \
                                (long long) (_value) : (_value),        \
+                       .signedness = lttng_is_signed_type(__typeof__(_value)), \
                },                                                      \
                .string = (_string),                                    \
        },
@@ -149,18 +149,38 @@ static const char                                                 \
 #define ctf_enum_range(_string, _range_start, _range_end)              \
        {                                                               \
                .start = {                                              \
-                       .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
                        .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
                                (long long) (_range_start) : (_range_start), \
+                       .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
                },                                                      \
                .end = {                                                \
-                       .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
                        .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
                                (long long) (_range_end) : (_range_end), \
+                       .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
                },                                                      \
                .string = (_string),                                    \
        },
 
+/* Enumeration entry (automatic value; follows the rules of CTF) */
+#undef ctf_enum_auto
+#define ctf_enum_auto(_string)                                 \
+       {                                                               \
+               .start = {                                              \
+                       .value = -1ULL,                                 \
+                       .signedness = 0,                                \
+               },                                                      \
+               .end = {                                                \
+                       .value = -1ULL,                                 \
+                       .signedness = 0,                                \
+               },                                                      \
+               .string = (_string),                                    \
+               .u = {                                                  \
+                       .extra = {                                      \
+                               .options = LTTNG_ENUM_ENTRY_OPTION_IS_AUTO, \
+                       },                                              \
+               },                                                      \
+       },
+
 #undef TP_ENUM_VALUES
 #define TP_ENUM_VALUES(...)                                            \
        __VA_ARGS__
This page took 0.024225 seconds and 4 git commands to generate.