From: Mathieu Desnoyers Date: Fri, 16 Sep 2011 23:55:32 +0000 (-0400) Subject: Support c++ tracepoint instrumentation X-Git-Tag: v1.9.1~205 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1ea2c2dfbd051d7ab86a2161b48aa8e4a2f2b5e2;p=lttng-ust.git Support c++ tracepoint instrumentation Applications can be built with g++, but tracepoint probes need to be built with gcc. Signed-off-by: Mathieu Desnoyers --- diff --git a/include/ust/marker.h b/include/ust/marker.h index e8608a96..8cfdcbdb 100644 --- a/include/ust/marker.h +++ b/include/ust/marker.h @@ -31,6 +31,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct ust_marker; struct ust_marker_probe_array; @@ -218,4 +222,8 @@ void __MARKER_LIB_IS_DEPRECATED() */ #define MARK_NOARGS UST_MARKER_NOARGS +#ifdef __cplusplus +} +#endif + #endif /* _UST_MARKER_H */ diff --git a/include/ust/tracepoint.h b/include/ust/tracepoint.h index e7c6b198..c484353d 100644 --- a/include/ust/tracepoint.h +++ b/include/ust/tracepoint.h @@ -28,6 +28,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct tracepoint_probe { void *func; void *data; @@ -61,7 +65,7 @@ struct tracepoint { do { \ __tp_it_func = __tp_it_probe_ptr->func; \ __tp_cb_data = __tp_it_probe_ptr->data; \ - ((void(*)(proto))__tp_it_func)(args); \ + URCU_FORCE_CAST(void(*)(proto), __tp_it_func)(args); \ } while ((++__tp_it_probe_ptr)->func); \ } \ rcu_read_unlock(); \ @@ -413,4 +417,8 @@ static void __attribute__((destructor)) __tracepoints__destroy(void) #endif /* #ifndef TRACEPOINT_LOGLEVEL */ +#ifdef __cplusplus +} +#endif + #endif /* _UST_TRACEPOINT_H */ diff --git a/include/ust/ust.h b/include/ust/ust.h index 16cd475c..593598b4 100644 --- a/include/ust/ust.h +++ b/include/ust/ust.h @@ -20,6 +20,10 @@ #ifndef _UST_H #define _UST_H +#ifdef __cplusplus +extern "C" { +#endif + typedef struct ust_fork_info { sigset_t orig_sigs; } ust_fork_info_t; @@ -28,4 +32,8 @@ extern void ust_before_fork(ust_fork_info_t *fork_info); extern void ust_after_fork_parent(ust_fork_info_t *fork_info); extern void ust_after_fork_child(ust_fork_info_t *fork_info); +#ifdef __cplusplus +} +#endif + #endif /* _UST_H */ diff --git a/tests/hello/ust_tests_hello.h b/tests/hello/ust_tests_hello.h index 9f6ab9b8..9d78b5da 100644 --- a/tests/hello/ust_tests_hello.h +++ b/tests/hello/ust_tests_hello.h @@ -4,6 +4,10 @@ #if !defined(_TRACEPOINT_UST_TESTS_HELLO_H) || defined(TRACEPOINT_HEADER_MULTI_READ) #define _TRACEPOINT_UST_TESTS_HELLO_H +#ifdef __cplusplus +extern "C" { +#endif + /* * Copyright (C) 2011 Mathieu Desnoyers * @@ -60,3 +64,7 @@ TRACEPOINT_EVENT_NOARGS(ust_tests_hello_tptest_sighandler, /* This part must be outside protection */ #include + +#ifdef __cplusplus +} +#endif