History

ftrace: don't convert function's local variable name in macro

"call" is an argument of macro, but it is also used as a local variable name of function in macro. We should keep this local variable name distinct from any CPP macro parameter name if both are in the same macro scope, although it hasn't caused any problem yet. [ Impact: robustify macro ]

Zhaolei committed 17 years ago

Commit f2aebae1 parent 5b6045a1 file · +10 −10Browse files

Showing the changes to include/trace (1 of 1 file). Show all

Unified · Split

include/trace/ftrace.h+10−10
@@ -397,19 +397,19 @@ static void ftrace_profile_##call(proto) \ · 396 unmodified lines
397 perf_tpcounter_event(event_##call.id); \397 perf_tpcounter_event(event_##call.id); \
398} \398} \
399 \399 \
400static int ftrace_profile_enable_##call(struct ftrace_event_call *call) \400static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \
401{ \401{ \
402 int ret = 0; \402 int ret = 0; \
403 \403 \
404 if (!atomic_inc_return(&call->profile_count)) \404 if (!atomic_inc_return(&event_call->profile_count)) \
405 ret = register_trace_##call(ftrace_profile_##call); \405 ret = register_trace_##call(ftrace_profile_##call); \
406 \406 \
407 return ret; \407 return ret; \
408} \408} \
409 \409 \
410static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \410static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
411{ \411{ \
412 if (atomic_add_negative(-1, &call->profile_count)) \412 if (atomic_add_negative(-1, &event_call->profile_count)) \
413 unregister_trace_##call(ftrace_profile_##call); \413 unregister_trace_##call(ftrace_profile_##call); \
414}414}
415 415
@@ -433,9 +433,9 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \ · 17 unmodified lines
433#define __array(type, item, len)433#define __array(type, item, len)
434 434
435#undef __string435#undef __string
436#define __string(item, src) \436#define __string(item, src) \
437 __str_offsets.item = __str_size + \437 __str_offsets.item = __str_size + \
438 offsetof(typeof(*entry), __str_data); \438 offsetof(typeof(*entry), __str_data); \
439 __str_size += strlen(src) + 1;439 __str_size += strlen(src) + 1;
440 440
441#undef __assign_str441#undef __assign_str
@@ -451,8 +451,8 @@ static struct ftrace_event_call event_##call; \ · 9 unmodified lines
451 \451 \
452static void ftrace_raw_event_##call(proto) \452static void ftrace_raw_event_##call(proto) \
453{ \453{ \
454 struct ftrace_str_offsets_##call __maybe_unused __str_offsets; \454 struct ftrace_str_offsets_##call __maybe_unused __str_offsets; \
455 struct ftrace_event_call *call = &event_##call; \455 struct ftrace_event_call *event_call = &event_##call; \
456 struct ring_buffer_event *event; \456 struct ring_buffer_event *event; \
457 struct ftrace_raw_##call *entry; \457 struct ftrace_raw_##call *entry; \
458 unsigned long irq_flags; \458 unsigned long irq_flags; \
@@ -473,7 +473,7 @@ static void ftrace_raw_event_##call(proto) \ · 14 unmodified lines
473 \473 \
474 assign; \474 assign; \
475 \475 \
476 if (!filter_current_check_discard(call, entry, event)) \476 if (!filter_current_check_discard(event_call, entry, event)) \
477 trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \477 trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \
478} \478} \
479 \479 \