summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0007344)
A noargs probe could have event fields. noargs just means that the probe
does not receive any argument as parameter. However, it could very well
serialize data into fields (global variables, constants, etc).
It just happens that LTTng does not serialize any data in noargs events
at the moment, but this may very well change.
The if (0) with (void) variable access strategy to stop compiler from
complaining from unused variables does not seem to work as expected with
gcc 4.9.1. Use "unused" attribute instead.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \
{ \
size_t __event_len = 0; \
static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \
{ \
size_t __event_len = 0; \
- unsigned int __dynamic_len_idx = 0; \
+ unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
+ \
+ _tstruct \
+ return __event_len; \
+}
+
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
+static inline size_t __event_get_size__##_name(size_t *__dynamic_len) \
+{ \
+ size_t __event_len = 0; \
+ unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
- if (0) \
- (void) __dynamic_len_idx; /* don't warn if unused */ \
_tstruct \
return __event_len; \
}
_tstruct \
return __event_len; \
}
return __event_align; \
}
return __event_align; \
}
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
+static inline size_t __event_get_align__##_name(void) \
+{ \
+ size_t __event_align = 1; \
+ _tstruct \
+ return __event_align; \
+}
+
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args
-#undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
struct __event_typemap__##_name { \
_tstruct \
};
struct __event_typemap__##_name { \
_tstruct \
};
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+ DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print)
+
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
struct lttng_channel *__chan = __event->chan; \
struct lib_ring_buffer_ctx __ctx; \
size_t __event_len, __event_align; \
struct lttng_channel *__chan = __event->chan; \
struct lib_ring_buffer_ctx __ctx; \
size_t __event_len, __event_align; \
- size_t __dynamic_len_idx = 0; \
- size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)]; \
- struct __event_typemap__##_name __typemap; \
+ size_t __dynamic_len_idx __attribute__((unused)) = 0; \
+ size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \
+ struct __event_typemap__##_name __typemap __attribute__((unused)); \
- if (0) { \
- (void) __dynamic_len_idx; /* don't warn if unused */ \
- (void) __typemap; /* don't warn if unused */ \
- } \
if (!_TP_SESSION_CHECK(session, __chan->session)) \
return; \
if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
if (!_TP_SESSION_CHECK(session, __chan->session)) \
return; \
if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
struct lttng_channel *__chan = __event->chan; \
struct lib_ring_buffer_ctx __ctx; \
size_t __event_len, __event_align; \
struct lttng_channel *__chan = __event->chan; \
struct lib_ring_buffer_ctx __ctx; \
size_t __event_len, __event_align; \
+ size_t __dynamic_len_idx __attribute__((unused)) = 0; \
+ size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \
+ struct __event_typemap__##_name __typemap __attribute__((unused)); \
int __ret; \
\
if (!_TP_SESSION_CHECK(session, __chan->session)) \
int __ret; \
\
if (!_TP_SESSION_CHECK(session, __chan->session)) \
return; \
if (unlikely(!ACCESS_ONCE(__event->enabled))) \
return; \
return; \
if (unlikely(!ACCESS_ONCE(__event->enabled))) \
return; \
- __event_len = 0; \
- __event_align = 1; \
+ __event_len = __event_get_size__##_name(__dynamic_len); \
+ __event_align = __event_get_align__##_name(); \
lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
__event_align, -1); \
__ret = __chan->ops->event_reserve(&__ctx, __event->id); \
lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
__event_align, -1); \
__ret = __chan->ops->event_reserve(&__ctx, __event->id); \