Rename public structure to avoid collisions
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 13 Aug 2014 23:10:41 +0000 (19:10 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Sep 2014 15:56:50 +0000 (11:56 -0400)
Since nobody raised any concern about this, I submit the patch for
merging. You can find the original discussion here:

  http://lists.lttng.org/pipermail/lttng-dev/2014-July/023364.html

(the rest of the message is identical to the RFC post)

When trying to use lttng-ust with a program that defines its own struct
tracepoint, a name collision arises and compilation fails (see example
lower).

I suggest the following renames (the problem only showed up with struct
tracepoint in my case, but let's be proactive):

 * struct tracepoint -> struct lttng_ust_tracepoint
 * struct tracepoint_probe -> struct lttng_ust_tracepoint_probe
 * struct tracepoint_dlopen -> struct lttng_ust_tracepoint_dlopen

Strictly speaking, those names are part of the public API of LTTng, so I
understand that it would be a felony to rename it, since it breaks the
holy API. However, those structures are only used through some macros,
and I am not aware of any sensible use case where a user of lttng-ust
would directly reference those structures. Therefore, it should not break
any existing code. If you do have such a use case, where it would break
your code, please jump in the discussion.

This should not break any application instrumented and built before the
change. Tested by building "hello" before and tracing it after the
change.

Here is an example of error due to the name collision. This is when
building gdb, which I try to instrument with lttng-ust.

In file included from /usr/local/include/lttng/tracepoint.h:28:0,
                 from ust_tracepoints.h:15,
                 from inf-ptrace.c:38:
/usr/local/include/lttng/tracepoint-types.h:32:8: error: redefinition of
‘struct tracepoint’
 struct tracepoint {
        ^
In file included from inferior.h:37:0,
                 from inf-ptrace.c:22:
breakpoint.h:817:8: note: originally defined here
 struct tracepoint
        ^
Makefile:1088: recipe for target 'inf-ptrace.o' failed
make: *** [inf-ptrace.o] Error 1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

No differences found
This page took 0.024908 seconds and 4 git commands to generate.