TRACE_* macros and #ifdef guards

From: John Sheu
Date: Fri May 11 2012 - 16:26:21 EST


I've been poking at the linux kernel events tracing, am seeing some
inconsistencies in the usage of the TRACE_* macros.

For example, samples/trace_events/trace-events.sample.h has the entire
block below outside #ifdef guards:


#undef TRACE_INCLUDE_PATH
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_PATH .
/*
* TRACE_INCLUDE_FILE is not needed if the filename and TRACE_SYSTEM are equal
*/
#define TRACE_INCLUDE_FILE trace-events-sample
#include <trace/define_trace.h>


This is the case for most usages of trace events. Some drivers (e.g.
drm), though, have part of the block inside the #ifdef guard:


#undef TRACE_SYSTEM
#define TRACE_SYSTEM drm
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
#define TRACE_INCLUDE_FILE drm_trace
<snip>
#endif /* _DRM_TRACE_H_ */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#include <trace/define_trace.h>


Can I assume that using the TRACE_* macros inside the #ifdef guards is
incorrect (e.g. in drm), and should be corrected?

Thanks,
-John Sheu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/