Re: [PATCH] Documentation/trace: Correcting and extendingtracepoint documentation

From: Steven Rostedt
Date: Mon Sep 02 2013 - 13:33:52 EST


On Mon, 2 Sep 2013 18:02:47 +0100
Zoltan Kiss <zoltan.kiss@xxxxxxxxxx> wrote:


> > Why? (Both why do you need to #include a header outside a multiple
> > inclusion guard, and why is the additional header needed at all in
> > _every_ subsystem trace header?)
> I see only one inclusion guard here, the one above. define_trace.h
> should take effect at only one place, where CREATE_TRACE_POINTS is
> defined, to create the tracepoints exactly once. However I don't see as
> well why it should be outside protection. Maybe because the intentional
> header reinclusion in it?

Because if it was inside the protection you can miss the
CREATE_TRACE_POINTS define. These headers can be included by other
headers (although they probably shouldn't be). But that's the point of
the protection isn't it? In case multiple headers include the file?

Anyway, lets say the header was include earlier, thus you can have this:


#include <trace/foo.h> // include by another header

#define CREATE_TRACE_POINTS

#include <trace/foo.h>


Now if the include of define_trace.h was inside the protection, it will
not get included again, and no trace points would be created.

-- Steve
--
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/