[lttng-dev] [PATCH] tracef: add extern "C" wrapper

Gerlando Falauto gerlando.falauto at keymile.com
Tue May 13 09:52:47 EDT 2014


Hi,

On 05/13/2014 03:41 PM, Mathieu Desnoyers wrote:
> Sorry, I missed your patch and already committed a different
> fix. Please let me know if my fix has any issue.
>
> We usually encompass the entire header file (except #include)
> with extern C by the way.

Yes, I figured encompassing the #include would not be a good idea, 
that's why I changed it afterwards. But the first fix was working for me 
just as well.
The rest of the file is just a #define so it doesn't really make any 
difference.

It's all up to you I believe.

Thank you,
Gerlando

>
> Thanks,
>
> Mathieu
>
> ----- Original Message -----
>> From: "Gerlando Falauto" <gerlando.falauto at keymile.com>
>> To: lttng-dev at lists.lttng.org
>> Cc: "Gerlando Falauto" <gerlando.falauto at keymile.com>
>> Sent: Tuesday, May 13, 2014 5:33:46 AM
>> Subject: [lttng-dev] [PATCH] tracef: add extern "C" wrapper
>>
>> Add an extern "C" wrapper so that tracef.h can be included
>> (and the tracef() function can be used) from C++ files, too.
>>
>> Signed-off-by: Gerlando Falauto <gerlando.falauto at keymile.com>
>> ---
>>   include/lttng/tracef.h | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/include/lttng/tracef.h b/include/lttng/tracef.h
>> index 16a984b..45d0587 100644
>> --- a/include/lttng/tracef.h
>> +++ b/include/lttng/tracef.h
>> @@ -25,9 +25,17 @@
>>
>>   #include <lttng/lttng-ust-tracef.h>
>>
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>>   extern
>>   void _lttng_ust_tracef(const char *fmt, ...);
>>
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>>   #define tracef(fmt, ...)						\
>>   	do {								\
>>   		STAP_PROBEV(tracepoint_lttng_ust_tracef, event, ## __VA_ARGS__); \
>> --
>> 1.8.0.1
>>
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>>
>




More information about the lttng-dev mailing list