Some tracepoint definitions have one or more arguments that don't have a
corresponding field to allow passing a value to a probe without
recording it in the trace buffer nor using it in the filter.
This results in tracepoint macros generating inline functions with unused
arguments which prevents us from turning on -Wunuse-parameter.
Add a new tracepoint field type name 'ctf_unused' to adress this and
properly handle unused values in the tracepoint macros.
[ Mathieu: ctf_unused() takes only the _src parameter, no "type",
because an unused "field" does not have any representation in the ring
buffer nor the filter. If this ends up limiting us in the future, I
accept all the blame. ]
Change-Id: I56d8024926340e9c965ca01fa24a0fff7b7c5baa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 files changed:
TP_ARGS(const char *, msg, unsigned int, len, void *, ip),
TP_FIELDS(
ctf_sequence_text(char, msg, msg, unsigned int, len)
TP_ARGS(const char *, msg, unsigned int, len, void *, ip),
TP_FIELDS(
ctf_sequence_text(char, msg, msg, unsigned int, len)
)
)
TRACEPOINT_LOGLEVEL(lttng_ust_tracef, event, TRACE_DEBUG)
)
)
TRACEPOINT_LOGLEVEL(lttng_ust_tracef, event, TRACE_DEBUG)
ctf_string(file, file)
ctf_string(func, func)
ctf_sequence_text(char, msg, msg, unsigned int, len)
ctf_string(file, file)
ctf_string(func, func)
ctf_sequence_text(char, msg, msg, unsigned int, len)
#define ctf_string_nowrite(_item, _src) \
_ctf_string(_item, _src, 1)
#define ctf_string_nowrite(_item, _src) \
_ctf_string(_item, _src, 1)
+#undef ctf_unused_nowrite
+#define ctf_unused_nowrite(_src) \
+ _ctf_unused(_src)
+
#undef ctf_enum_nowrite
#define ctf_enum_nowrite(_provider, _name, _type, _item, _src) \
_ctf_enum(_provider, _name, _type, _item, _src, 1)
#undef ctf_enum_nowrite
#define ctf_enum_nowrite(_provider, _name, _type, _item, _src) \
_ctf_enum(_provider, _name, _type, _item, _src, 1)
#undef _ctf_string
#define _ctf_string(_item, _src, _nowrite)
#undef _ctf_string
#define _ctf_string(_item, _src, _nowrite)
+#undef _ctf_unused
+#define _ctf_unused(_src)
+
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite)
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite)
#undef ctf_string
#define ctf_string(_item, _src)
#undef ctf_string
#define ctf_string(_item, _src)
+#undef ctf_unused
+#define ctf_unused(_src)
+
#undef ctf_enum
#define ctf_enum(_provider, _name, _type, _item, _src)
#undef ctf_enum
#define ctf_enum(_provider, _name, _type, _item, _src)
#undef ctf_string_nowrite
#define ctf_string_nowrite(_item, _src)
#undef ctf_string_nowrite
#define ctf_string_nowrite(_item, _src)
+#undef ctf_unused_nowrite
+#define ctf_unused_nowrite(_src)
+
#undef ctf_enum_nowrite
#define ctf_enum_nowrite(_provider, _name, _type, _item, _src)
#undef ctf_enum_nowrite
#define ctf_enum_nowrite(_provider, _name, _type, _item, _src)
#define ctf_string(_item, _src) \
_ctf_string(_item, _src, 0)
#define ctf_string(_item, _src) \
_ctf_string(_item, _src, 0)
+#undef ctf_unused
+#define ctf_unused(_src) \
+ _ctf_unused(_src)
+
#undef ctf_enum
#define ctf_enum(_provider, _name, _type, _item, _src) \
_ctf_enum(_provider, _name, _type, _item, _src, 0)
#undef ctf_enum
#define ctf_enum(_provider, _name, _type, _item, _src) \
_ctf_enum(_provider, _name, _type, _item, _src, 0)
+#undef _ctf_unused
+#define _ctf_unused(_src)
+
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
__LTTNG_COMPOUND_LITERAL(struct lttng_ust_event_field, { \
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
__LTTNG_COMPOUND_LITERAL(struct lttng_ust_event_field, { \
#undef _ctf_integer_ext
#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
#undef _ctf_integer_ext
#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
+ if (0) \
+ (void) (_src); /* Unused */ \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += sizeof(_type);
#undef _ctf_float
#define _ctf_float(_type, _item, _src, _nowrite) \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += sizeof(_type);
#undef _ctf_float
#define _ctf_float(_type, _item, _src, _nowrite) \
+ if (0) \
+ (void) (_src); /* Unused */ \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += sizeof(_type);
#undef _ctf_array_encoded
#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \
_nowrite, _elem_type_base) \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += sizeof(_type);
#undef _ctf_array_encoded
#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \
_nowrite, _elem_type_base) \
+ if (0) \
+ (void) (_src); /* Unused */ \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += sizeof(_type) * (_length);
#undef _ctf_sequence_encoded
#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
_src_length, _encoding, _nowrite, _elem_type_base) \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += sizeof(_type) * (_length);
#undef _ctf_sequence_encoded
#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
_src_length, _encoding, _nowrite, _elem_type_base) \
+ if (0) \
+ (void) (_src); /* Unused */ \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_length_type)); \
__event_len += sizeof(_length_type); \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_length_type)); \
__event_len += sizeof(_length_type); \
__event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
__event_len += __dynamic_len[__dynamic_len_idx++] = \
strlen((_src) ? (_src) : __LTTNG_UST_NULL_STRING) + 1;
__event_len += __dynamic_len[__dynamic_len_idx++] = \
strlen((_src) ? (_src) : __LTTNG_UST_NULL_STRING) + 1;
+#undef _ctf_unused
+#define _ctf_unused(_src) \
+ if (0) \
+ (void) (_src); /* Unused */
+
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
_ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
_ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \
lttng_ust_notrace; \
static inline \
size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \
lttng_ust_notrace; \
static inline \
-size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \
+size_t __event_get_size__##_provider##___##_name( \
+ size_t *__dynamic_len __attribute__((__unused__)), \
+ _TP_ARGS_DATA_PROTO(_args)) \
{ \
size_t __event_len = 0; \
{ \
size_t __event_len = 0; \
- unsigned int __dynamic_len_idx = 0; \
+ unsigned int __dynamic_len_idx __attribute__((__unused__)) = 0; \
- (void) __dynamic_len_idx; /* don't warn if unused */ \
+ (void) __tp_data; /* don't warn if unused */ \
+ \
_fields \
return __event_len; \
}
_fields \
return __event_len; \
}
__stack_data += sizeof(void *); \
}
__stack_data += sizeof(void *); \
}
+#undef _ctf_unused
+#define _ctf_unused(_src) \
+ if (0) \
+ (void) (_src);
+
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
_ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
_ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
void __event_prepare_interpreter_stack__##_provider##___##_name(char *__stack_data,\
_TP_ARGS_DATA_PROTO(_args)) \
{ \
void __event_prepare_interpreter_stack__##_provider##___##_name(char *__stack_data,\
_TP_ARGS_DATA_PROTO(_args)) \
{ \
+ if (0) { \
+ (void) __tp_data; /* don't warn if unused */ \
+ (void) __stack_data; /* don't warn if unused */ \
+ } \
+ \
#undef _ctf_integer_ext
#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
#undef _ctf_integer_ext
#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
+ if (0) \
+ (void) (_src); /* Unused */ \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_float
#define _ctf_float(_type, _item, _src, _nowrite) \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_float
#define _ctf_float(_type, _item, _src, _nowrite) \
+ if (0) \
+ (void) (_src); /* Unused */ \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_array_encoded
#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \
_encoding, _nowrite, _elem_type_base) \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_array_encoded
#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \
_encoding, _nowrite, _elem_type_base) \
+ if (0) \
+ (void) (_src); /* Unused */ \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_sequence_encoded
#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
_src_length, _encoding, _nowrite, _elem_type_base) \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_sequence_encoded
#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
_src_length, _encoding, _nowrite, _elem_type_base) \
+ if (0) \
+ (void) (_src); /* Unused */ \
+ if (0) \
+ (void) (_src_length); /* Unused */ \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_length_type)); \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_string
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_length_type)); \
__event_align = _tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
#undef _ctf_string
-#define _ctf_string(_item, _src, _nowrite)
+#define _ctf_string(_item, _src, _nowrite) \
+ if (0) \
+ (void) (_src); /* Unused */
+
+#undef _ctf_unused
+#define _ctf_unused(_src) \
+ if (0) \
+ (void) (_src); /* Unused */
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
__get_dynamic_len(dest)); \
}
__get_dynamic_len(dest)); \
}
+#undef _ctf_unused
+#define _ctf_unused(_src)
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
#undef _ctf_enum
#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
TRACEPOINT_EVENT(lttng_ust_cyg_profile_fast, func_exit,
TP_ARGS(void *, func_addr),
TRACEPOINT_EVENT(lttng_ust_cyg_profile_fast, func_exit,
TP_ARGS(void *, func_addr),
+ TP_FIELDS(
+ ctf_unused(func_addr)
+ )
)
TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_exit,
)
TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_exit,
int, flags, uint64_t, memsz, uint8_t, has_build_id,
uint8_t, has_debug_link),
TP_FIELDS(
int, flags, uint64_t, memsz, uint8_t, has_build_id,
uint8_t, has_debug_link),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_integer_hex(int, flags, flags)
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_integer_hex(int, flags, flags)
uint64_t, memsz, uint8_t, has_build_id,
uint8_t, has_debug_link),
TP_FIELDS(
uint64_t, memsz, uint8_t, has_build_id,
uint8_t, has_debug_link),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_integer(Lmid_t, nsid, nsid)
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_integer(Lmid_t, nsid, nsid)
size_t, build_id_len
),
TP_FIELDS(
size_t, build_id_len
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_sequence_hex(uint8_t, build_id, build_id,
size_t, build_id_len)
ctf_integer_hex(void *, baddr, baddr)
ctf_sequence_hex(uint8_t, build_id, build_id,
size_t, build_id_len)
uint32_t, crc
),
TP_FIELDS(
uint32_t, crc
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint32_t, crc, crc)
ctf_string(filename, filename)
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint32_t, crc, crc)
ctf_string(filename, filename)
TRACEPOINT_EVENT(lttng_ust_dl, dlclose,
TP_ARGS(void *, ip, void *, baddr),
TP_FIELDS(
TRACEPOINT_EVENT(lttng_ust_dl, dlclose,
TP_ARGS(void *, ip, void *, baddr),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
)
)
ctf_integer_hex(void *, baddr, baddr)
)
)
TP_FIELDS(
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
TP_FIELDS(
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
TP_ARGS(void *, ptr, void *, ip),
TP_FIELDS(
ctf_integer_hex(void *, ptr, ptr)
TP_ARGS(void *, ptr, void *, ip),
TP_FIELDS(
ctf_integer_hex(void *, ptr, ptr)
ctf_integer(size_t, nmemb, nmemb)
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
ctf_integer(size_t, nmemb, nmemb)
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
ctf_integer_hex(void *, in_ptr, in_ptr)
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
ctf_integer_hex(void *, in_ptr, in_ptr)
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
ctf_integer(size_t, alignment, alignment)
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
ctf_integer(size_t, alignment, alignment)
ctf_integer(size_t, size, size)
ctf_integer_hex(void *, ptr, ptr)
ctf_integer(size_t, alignment, alignment)
ctf_integer(size_t, size, size)
ctf_integer(int, result, result)
ctf_integer(size_t, alignment, alignment)
ctf_integer(size_t, size, size)
ctf_integer(int, result, result)
TP_ARGS(pthread_mutex_t *, mutex, void *, ip),
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
TP_ARGS(pthread_mutex_t *, mutex, void *, ip),
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
ctf_integer(int, status, status)
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
ctf_integer(int, status, status)
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
ctf_integer(int, status, status)
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
ctf_integer(int, status, status)
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
ctf_integer(int, status, status)
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
ctf_integer(int, status, status)
TRACEPOINT_EVENT(lttng_ust_statedump, start,
TP_ARGS(struct lttng_ust_session *, session),
TRACEPOINT_EVENT(lttng_ust_statedump, start,
TP_ARGS(struct lttng_ust_session *, session),
+ TP_FIELDS(
+ ctf_unused(session)
+ )
)
TRACEPOINT_EVENT(lttng_ust_statedump, bin_info,
)
TRACEPOINT_EVENT(lttng_ust_statedump, bin_info,
uint8_t, has_debug_link
),
TP_FIELDS(
uint8_t, has_debug_link
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_string(path, path)
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_string(path, path)
size_t, build_id_len
),
TP_FIELDS(
size_t, build_id_len
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_sequence_hex(uint8_t, build_id, build_id,
size_t, build_id_len)
ctf_integer_hex(void *, baddr, baddr)
ctf_sequence_hex(uint8_t, build_id, build_id,
size_t, build_id_len)
uint32_t, crc
),
TP_FIELDS(
uint32_t, crc
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint32_t, crc, crc)
ctf_string(filename, filename)
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint32_t, crc, crc)
ctf_string(filename, filename)
char *, name
),
TP_FIELDS(
char *, name
),
TP_FIELDS(
ctf_array_text(char, procname, name, LTTNG_UST_ABI_PROCNAME_LEN)
)
)
TRACEPOINT_EVENT(lttng_ust_statedump, end,
TP_ARGS(struct lttng_ust_session *, session),
ctf_array_text(char, procname, name, LTTNG_UST_ABI_PROCNAME_LEN)
)
)
TRACEPOINT_EVENT(lttng_ust_statedump, end,
TP_ARGS(struct lttng_ust_session *, session),
+ TP_FIELDS(
+ ctf_unused(session)
+ )
)
#endif /* _TRACEPOINT_LTTNG_UST_STATEDUMP_H */
)
#endif /* _TRACEPOINT_LTTNG_UST_STATEDUMP_H */
uint64_t, memsz, uint8_t, has_build_id,
uint8_t, has_debug_link),
TP_FIELDS(
uint64_t, memsz, uint8_t, has_build_id,
uint8_t, has_debug_link),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_string(path, path)
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_string(path, path)
size_t, build_id_len
),
TP_FIELDS(
size_t, build_id_len
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_sequence_hex(uint8_t, build_id, build_id,
size_t, build_id_len)
ctf_integer_hex(void *, baddr, baddr)
ctf_sequence_hex(uint8_t, build_id, build_id,
size_t, build_id_len)
uint32_t, crc
),
TP_FIELDS(
uint32_t, crc
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint32_t, crc, crc)
ctf_string(filename, filename)
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint32_t, crc, crc)
ctf_string(filename, filename)
TRACEPOINT_EVENT(lttng_ust_lib, unload,
TP_ARGS(void *, ip, void *, baddr),
TP_FIELDS(
TRACEPOINT_EVENT(lttng_ust_lib, unload,
TP_ARGS(void *, ip, void *, baddr),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
)
)
ctf_integer_hex(void *, baddr, baddr)
)
)