bin: compile lttng-sessiond as C++
[lttng-tools.git] / src / common / payload-view.h
index 57a8342d70578c7be479c3bacfc6035a203937d9..af8519ab32641aaab739fa66985179ee025b47ba 100644 (file)
 #include <common/buffer-view.h>
 #include <common/dynamic-array.h>
 
 #include <common/buffer-view.h>
 #include <common/dynamic-array.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct lttng_payload;
 struct fd_handle;
 
 struct lttng_payload;
 struct fd_handle;
 
@@ -46,7 +50,26 @@ struct fd_handle;
 struct lttng_payload_view {
        struct lttng_buffer_view buffer;
        /* private */
 struct lttng_payload_view {
        struct lttng_buffer_view buffer;
        /* private */
-       const struct lttng_dynamic_pointer_array _fd_handles;
+
+       /*
+        * Avoid a -Wreturn-type-c-linkage warning with clang.
+        * gcc is more permissive with regards to this warning, but
+        * clang is right that a structure containing a _const_ structure is not
+        * a trivial type in the eyes of the C++ standard, theoritically affecting its
+        * compatibility with C from an ABI standpoint:
+        *   A trivial class is a class that is trivially copyable and has one or
+        *   more default constructors, all of which are either trivial or deleted and
+        *   at least one of which is not deleted.
+        *
+        * A const member implicitly deletes lttng_payload_view's constructor,
+        * making it non-trivial. This is not a problem for the moment as we are
+        * transitioning all code to C++11.
+        */
+#if !defined(__cplusplus)
+       const
+#endif
+       struct lttng_dynamic_pointer_array _fd_handles;
+
        struct {
                size_t *p_fd_handles_position;
                size_t fd_handles_position;
        struct {
                size_t *p_fd_handles_position;
                size_t fd_handles_position;
@@ -159,4 +182,8 @@ int lttng_payload_view_get_fd_handle_count(
 struct fd_handle *lttng_payload_view_pop_fd_handle(
                struct lttng_payload_view *payload_view);
 
 struct fd_handle *lttng_payload_view_pop_fd_handle(
                struct lttng_payload_view *payload_view);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LTTNG_PAYLOAD_VIEW_H */
 #endif /* LTTNG_PAYLOAD_VIEW_H */
This page took 0.023675 seconds and 4 git commands to generate.