Skip to content

Commit abb43f6

Browse files
compudjrostedt
authored andcommitted
tracing: Fix anonymous unions in struct ftrace_event_call
gcc <= 4.5.x has significant limitations with respect to initialization of anonymous unions within structures. They need to be surrounded by brackets, _and_ they need to be initialized in the same order in which they appear in the structure declaration. Link: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676 Link: http://lkml.kernel.org/r/1397077568-3156-1-git-send-email-mathieu.desnoyers@efficios.com Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent b725dfe commit abb43f6

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

‎include/linux/syscalls.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
119119
static struct syscall_metadata __syscall_meta_##sname; \
120120
static struct ftrace_event_call __used \
121121
event_enter_##sname = { \
122-
.name = "sys_enter"#sname, \
123122
.class = &event_class_syscall_enter, \
123+
{ \
124+
.name = "sys_enter"#sname, \
125+
}, \
124126
.event.funcs = &enter_syscall_print_funcs, \
125127
.data = (void *)&__syscall_meta_##sname,\
126128
.flags = TRACE_EVENT_FL_CAP_ANY, \
@@ -133,8 +135,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
133135
static struct syscall_metadata __syscall_meta_##sname; \
134136
static struct ftrace_event_call __used \
135137
event_exit_##sname = { \
136-
.name = "sys_exit"#sname, \
137138
.class = &event_class_syscall_exit, \
139+
{ \
140+
.name = "sys_exit"#sname, \
141+
}, \
138142
.event.funcs = &exit_syscall_print_funcs, \
139143
.data = (void *)&__syscall_meta_##sname,\
140144
.flags = TRACE_EVENT_FL_CAP_ANY, \

‎include/trace/ftrace.h‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,10 @@ static inline notrace int ftrace_get_offsets_##call( \
470470
* };
471471
*
472472
* static struct ftrace_event_call event_<call> = {
473-
* .tp = &__tracepoint_<call>,
474473
* .class = event_class_<template>,
474+
* {
475+
* .tp = &__tracepoint_<call>,
476+
* },
475477
* .event = &ftrace_event_type_<call>,
476478
* .print_fmt = print_fmt_<call>,
477479
* .flags = TRACE_EVENT_FL_TRACEPOINT,
@@ -606,8 +608,10 @@ static struct ftrace_event_class __used __refdata event_class_##call = { \
606608
#define DEFINE_EVENT(template, call, proto, args) \
607609
\
608610
static struct ftrace_event_call __used event_##call = { \
609-
.tp = &__tracepoint_##call, \
610611
.class = &event_class_##template, \
612+
{ \
613+
.tp = &__tracepoint_##call, \
614+
}, \
611615
.event.funcs = &ftrace_event_type_funcs_##template, \
612616
.print_fmt = print_fmt_##template, \
613617
.flags = TRACE_EVENT_FL_TRACEPOINT, \
@@ -621,8 +625,10 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
621625
static const char print_fmt_##call[] = print; \
622626
\
623627
static struct ftrace_event_call __used event_##call = { \
624-
.tp = &__tracepoint_##call, \
625628
.class = &event_class_##template, \
629+
{ \
630+
.tp = &__tracepoint_##call, \
631+
}, \
626632
.event.funcs = &ftrace_event_type_funcs_##call, \
627633
.print_fmt = print_fmt_##call, \
628634
.flags = TRACE_EVENT_FL_TRACEPOINT, \

‎kernel/trace/trace_export.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,11 @@ struct ftrace_event_class __refdata event_class_ftrace_##call = { \
173173
}; \
174174
\
175175
struct ftrace_event_call __used event_##call = { \
176-
.name = #call, \
177-
.event.type = etype, \
178176
.class = &event_class_ftrace_##call, \
177+
{ \
178+
.name = #call, \
179+
}, \
180+
.event.type = etype, \
179181
.print_fmt = print, \
180182
.flags = TRACE_EVENT_FL_IGNORE_ENABLE | TRACE_EVENT_FL_USE_CALL_FILTER, \
181183
}; \

0 commit comments

Comments
 (0)