From b66cbf1731486ab4dc7e0b2e1c3fa05cc5360c19 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 15 Oct 2021 15:55:28 -0400 Subject: [PATCH] Remove extern "C" from internal headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit All internal code is now compiled as C++, we can now remove all 'extern "C"' declarations from internal headers. This means files will see each other's declarations as C++, and we can now use things in headers. Remove the min/min_t/max/max_t macros from macros.h as well. Change-Id: I5a6b7ef60be5f46160c6d5ca39f082d2137d5a07 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- include/lttng/action/action-internal.h | 8 ------ include/lttng/action/list-internal.h | 8 ------ include/lttng/action/path-internal.h | 8 ------ include/lttng/action/rate-policy-internal.h | 8 ------ .../lttng/condition/buffer-usage-internal.h | 8 ------ include/lttng/condition/condition-internal.h | 8 ------ .../condition/event-rule-matches-internal.h | 8 ------ .../session-consumed-size-internal.h | 8 ------ .../condition/session-rotation-internal.h | 8 ------ include/lttng/domain-internal.h | 8 ------ include/lttng/error-query-internal.h | 8 ------ include/lttng/event-expr-internal.h | 8 ------ include/lttng/event-internal.h | 8 ------ .../lttng/event-rule/event-rule-internal.h | 8 ------ .../event-rule/kernel-syscall-internal.h | 8 ------ include/lttng/health-internal.h | 8 ------ include/lttng/kernel-probe-internal.h | 8 ------ include/lttng/location-internal.h | 8 ------ include/lttng/log-level-rule-internal.h | 8 ------ .../notification/notification-internal.h | 8 ------ include/lttng/session-descriptor-internal.h | 8 ------ include/lttng/trigger/trigger-internal.h | 8 ------ include/lttng/userspace-probe-internal.h | 8 ------ src/bin/lttng-sessiond/condition-internal.h | 8 ------ src/bin/lttng-sessiond/ust-ctl-internal.h | 8 ------ src/bin/lttng/loglevel.h | 8 ------ src/common/buffer-view.h | 8 ------ src/common/bytecode/bytecode.h | 8 ------ src/common/compat/directory-handle.h | 8 ------ src/common/compat/fcntl.h | 8 ------ src/common/compat/poll.h | 24 ----------------- src/common/config/ini.h | 8 ------ src/common/config/session-config.h | 8 ------ src/common/consumer/consumer-metadata-cache.h | 8 ------ src/common/consumer/consumer-stream.h | 8 ------ src/common/consumer/consumer-timer.h | 8 ------ src/common/consumer/consumer.h | 8 ------ src/common/consumer/metadata-bucket.h | 8 ------ src/common/context.h | 8 ------ src/common/credentials.h | 8 ------ src/common/daemonize.h | 8 ------ src/common/defaults.h | 8 ------ src/common/dynamic-array.h | 8 ------ src/common/dynamic-buffer.h | 8 ------ src/common/error.h | 8 ------ src/common/fd-handle.h | 8 ------ src/common/fd-tracker/fd-tracker.h | 8 ------ src/common/fd-tracker/utils.h | 8 ------ src/common/filter.h | 8 ------ src/common/filter/filter-ast.h | 8 ------ src/common/fs-handle.h | 8 ------ src/common/futex.h | 8 ------ src/common/hashtable/hashtable.h | 8 ------ src/common/hashtable/utils.h | 8 ------ src/common/index-allocator.h | 23 +++++++--------- src/common/index/index.h | 8 ------ src/common/kernel-consumer/kernel-consumer.h | 8 ------ src/common/kernel-ctl/kernel-ctl.h | 8 ------ src/common/macros.h | 26 ------------------ src/common/mi-lttng.h | 8 ------ src/common/payload-view.h | 27 +------------------ src/common/payload.h | 8 ------ src/common/pipe.h | 8 ------ src/common/readwrite.h | 8 ------ src/common/relayd/relayd.h | 8 ------ src/common/runas.h | 8 ------ src/common/sessiond-comm/inet.h | 8 ------ src/common/sessiond-comm/sessiond-comm.h | 8 ------ src/common/shm.h | 8 ------ src/common/spawn-viewer.h | 11 ++------ src/common/string-utils/string-utils.h | 8 ------ src/common/testpoint/testpoint.h | 8 ------ src/common/time.h | 8 ------ src/common/trace-chunk-registry.h | 8 ------ src/common/trace-chunk.h | 8 ------ src/common/tracker.h | 8 ------ src/common/unix.h | 8 ------ src/common/uri.h | 8 ------ src/common/ust-consumer/ust-consumer.h | 8 ------ src/common/utils.h | 8 ------ src/common/uuid.h | 8 ------ src/common/waiter.h | 8 ------ 82 files changed, 13 insertions(+), 714 deletions(-) diff --git a/include/lttng/action/action-internal.h b/include/lttng/action/action-internal.h index b55a6d59b..71270a835 100644 --- a/include/lttng/action/action-internal.h +++ b/include/lttng/action/action-internal.h @@ -19,10 +19,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_rate_policy; struct mi_writer; struct mi_lttng_error_query_callbacks; @@ -132,8 +128,4 @@ enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trig *error_query_callbacks, struct lttng_dynamic_array *action_path_indexes); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_ACTION_INTERNAL_H */ diff --git a/include/lttng/action/list-internal.h b/include/lttng/action/list-internal.h index 3d7a5ba60..231755fd6 100644 --- a/include/lttng/action/list-internal.h +++ b/include/lttng/action/list-internal.h @@ -12,10 +12,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_action; struct lttng_payload_view; struct mi_writer; @@ -43,8 +39,4 @@ enum lttng_error_code lttng_action_list_mi_serialize(const struct lttng_trigger *error_query_callbacks, struct lttng_dynamic_array *action_path_indexes); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_ACTION_LIST_INTERNAL_H */ diff --git a/include/lttng/action/path-internal.h b/include/lttng/action/path-internal.h index 361c348fe..8a255f0b7 100644 --- a/include/lttng/action/path-internal.h +++ b/include/lttng/action/path-internal.h @@ -15,10 +15,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_action_path { struct lttng_dynamic_array indexes; }; @@ -34,8 +30,4 @@ ssize_t lttng_action_path_create_from_payload( int lttng_action_path_serialize(const struct lttng_action_path *action_path, struct lttng_payload *payload); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_ACTION_PATH_INTERNAL_H */ diff --git a/include/lttng/action/rate-policy-internal.h b/include/lttng/action/rate-policy-internal.h index 708892cba..b24ed5238 100644 --- a/include/lttng/action/rate-policy-internal.h +++ b/include/lttng/action/rate-policy-internal.h @@ -15,10 +15,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - struct mi_writer; int lttng_rate_policy_serialize(struct lttng_rate_policy *rate_policy, @@ -43,8 +39,4 @@ enum lttng_error_code lttng_rate_policy_mi_serialize( const struct lttng_rate_policy *policy, struct mi_writer *writer); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_RATE_POLICY */ diff --git a/include/lttng/condition/buffer-usage-internal.h b/include/lttng/condition/buffer-usage-internal.h index 6ea19e065..1e6d5a509 100644 --- a/include/lttng/condition/buffer-usage-internal.h +++ b/include/lttng/condition/buffer-usage-internal.h @@ -15,10 +15,6 @@ #include "common/buffer-view.h" #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_condition_buffer_usage { struct lttng_condition parent; struct { @@ -81,8 +77,4 @@ ssize_t lttng_evaluation_buffer_usage_high_create_from_payload( struct lttng_payload_view *view, struct lttng_evaluation **evaluation); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H */ diff --git a/include/lttng/condition/condition-internal.h b/include/lttng/condition/condition-internal.h index a491d3fe3..5bafaf05b 100644 --- a/include/lttng/condition/condition-internal.h +++ b/include/lttng/condition/condition-internal.h @@ -19,10 +19,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - struct mi_writer; struct mi_lttng_error_query_callbacks; struct lttng_trigger; @@ -86,8 +82,4 @@ enum lttng_error_code lttng_condition_mi_serialize( const char *lttng_condition_type_str(enum lttng_condition_type type); -#if defined(__cplusplus) -} -#endif - #endif /* LTTNG_CONDITION_INTERNAL_H */ diff --git a/include/lttng/condition/event-rule-matches-internal.h b/include/lttng/condition/event-rule-matches-internal.h index 4aac9f991..ef39f4f04 100644 --- a/include/lttng/condition/event-rule-matches-internal.h +++ b/include/lttng/condition/event-rule-matches-internal.h @@ -16,10 +16,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_capture_descriptor { struct lttng_event_expr *event_expression; struct lttng_bytecode *bytecode; @@ -90,8 +86,4 @@ const struct lttng_bytecode * lttng_condition_event_rule_matches_get_capture_bytecode_at_index( const struct lttng_condition *condition, unsigned int index); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H */ diff --git a/include/lttng/condition/session-consumed-size-internal.h b/include/lttng/condition/session-consumed-size-internal.h index 07c5953e1..9340a5f23 100644 --- a/include/lttng/condition/session-consumed-size-internal.h +++ b/include/lttng/condition/session-consumed-size-internal.h @@ -14,10 +14,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_payload; struct lttng_payload_view; @@ -57,8 +53,4 @@ ssize_t lttng_evaluation_session_consumed_size_create_from_payload( struct lttng_payload_view *view, struct lttng_evaluation **evaluation); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_CONDITION_SESSION_CONSUMED_SIZE_INTERNAL_H */ diff --git a/include/lttng/condition/session-rotation-internal.h b/include/lttng/condition/session-rotation-internal.h index e5993e960..c723c6d6a 100644 --- a/include/lttng/condition/session-rotation-internal.h +++ b/include/lttng/condition/session-rotation-internal.h @@ -15,10 +15,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_condition_session_rotation { struct lttng_condition parent; char *session_name; @@ -65,8 +61,4 @@ ssize_t lttng_evaluation_session_rotation_completed_create_from_payload( struct lttng_payload_view *view, struct lttng_evaluation **evaluation); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_CONDITION_SESSION_ROTATION_INTERNAL_H */ diff --git a/include/lttng/domain-internal.h b/include/lttng/domain-internal.h index 13d4a6bc1..c34ba1930 100644 --- a/include/lttng/domain-internal.h +++ b/include/lttng/domain-internal.h @@ -11,14 +11,6 @@ #include "lttng/domain.h" #include "common/macros.h" -#ifdef __cplusplus -extern "C" { -#endif - const char *lttng_domain_type_str(enum lttng_domain_type domain_type); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_DOMAIN_INTERNAL_H */ diff --git a/include/lttng/error-query-internal.h b/include/lttng/error-query-internal.h index d3072f54b..07e2280d7 100644 --- a/include/lttng/error-query-internal.h +++ b/include/lttng/error-query-internal.h @@ -15,10 +15,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct mi_writer; enum lttng_error_query_target_type { @@ -82,8 +78,4 @@ enum lttng_error_code lttng_error_query_results_mi_serialize( const struct lttng_error_query_results *results, struct mi_writer *writer); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_ERROR_QUERY_INTERNAL_H */ diff --git a/include/lttng/event-expr-internal.h b/include/lttng/event-expr-internal.h index d40f2fa01..469fd17bb 100644 --- a/include/lttng/event-expr-internal.h +++ b/include/lttng/event-expr-internal.h @@ -11,10 +11,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_bytecode; struct mi_writer; @@ -68,8 +64,4 @@ enum lttng_error_code lttng_event_expr_mi_serialize( const struct lttng_event_expr *expression, struct mi_writer *writer); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_EVENT_EXPR_INTERNAL_H */ diff --git a/include/lttng/event-internal.h b/include/lttng/event-internal.h index 7370d0510..8d03fbdec 100644 --- a/include/lttng/event-internal.h +++ b/include/lttng/event-internal.h @@ -15,10 +15,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_userspace_probe_location; struct lttng_event_extended { @@ -39,8 +35,4 @@ struct lttng_event_extended { struct lttng_event *lttng_event_copy(const struct lttng_event *event); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_EVENT_INTERNAL_H */ diff --git a/include/lttng/event-rule/event-rule-internal.h b/include/lttng/event-rule/event-rule-internal.h index 98d1f449d..802674863 100644 --- a/include/lttng/event-rule/event-rule-internal.h +++ b/include/lttng/event-rule/event-rule-internal.h @@ -20,10 +20,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - struct lttng_payload; struct lttng_payload_view; struct mi_writer; @@ -157,8 +153,4 @@ bool lttng_event_rule_targets_agent_domain(const struct lttng_event_rule *rule); enum lttng_error_code lttng_event_rule_mi_serialize( const struct lttng_event_rule *rule, struct mi_writer *writer); -#if defined(__cplusplus) -} -#endif - #endif /* LTTNG_EVENT_RULE_INTERNAL_H */ diff --git a/include/lttng/event-rule/kernel-syscall-internal.h b/include/lttng/event-rule/kernel-syscall-internal.h index 3e5e0991d..301238153 100644 --- a/include/lttng/event-rule/kernel-syscall-internal.h +++ b/include/lttng/event-rule/kernel-syscall-internal.h @@ -13,10 +13,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - struct lttng_event_rule_kernel_syscall { struct lttng_event_rule parent; enum lttng_event_rule_kernel_syscall_emission_site emission_site; @@ -51,8 +47,4 @@ ssize_t lttng_event_rule_kernel_syscall_create_from_payload( const char *lttng_event_rule_kernel_syscall_emission_site_str( enum lttng_event_rule_kernel_syscall_emission_site emission_site); -#if defined(__cplusplus) -} -#endif - #endif /* LTTNG_EVENT_RULE_KERNEL_SYSCALL_INTERNAL_H */ diff --git a/include/lttng/health-internal.h b/include/lttng/health-internal.h index 875cc960b..ceda0a8dd 100644 --- a/include/lttng/health-internal.h +++ b/include/lttng/health-internal.h @@ -17,10 +17,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * These are the value added to the current state depending of the position in * the thread where is either waiting on a poll() or running in the code. @@ -120,8 +116,4 @@ int health_check_state(struct health_app *ha, int type); void health_register(struct health_app *ha, int type); void health_unregister(struct health_app *ha); -#ifdef __cplusplus -} -#endif - #endif /* HEALTH_INTERNAL_H */ diff --git a/include/lttng/kernel-probe-internal.h b/include/lttng/kernel-probe-internal.h index 87d0ab9aa..2d2ab8684 100644 --- a/include/lttng/kernel-probe-internal.h +++ b/include/lttng/kernel-probe-internal.h @@ -17,10 +17,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_payload; struct lttng_payload_view; struct lttng_dynamic_buffer; @@ -112,8 +108,4 @@ enum lttng_error_code lttng_kernel_probe_location_mi_serialize( const struct lttng_kernel_probe_location *location, struct mi_writer *writer); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */ diff --git a/include/lttng/location-internal.h b/include/lttng/location-internal.h index 9eafd471a..33498c90d 100644 --- a/include/lttng/location-internal.h +++ b/include/lttng/location-internal.h @@ -15,10 +15,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * The public API assumes that trace archive locations are always * provided as "constant". This means that the user of liblttng-ctl never @@ -101,8 +97,4 @@ void lttng_trace_archive_location_get( void lttng_trace_archive_location_put( struct lttng_trace_archive_location *location); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_LOCATION_INTERNAL_H */ diff --git a/include/lttng/log-level-rule-internal.h b/include/lttng/log-level-rule-internal.h index 26abaa862..ac0f74b71 100644 --- a/include/lttng/log-level-rule-internal.h +++ b/include/lttng/log-level-rule-internal.h @@ -19,10 +19,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct mi_writer; /* @@ -65,8 +61,4 @@ enum lttng_error_code lttng_log_level_rule_mi_serialize( const struct lttng_log_level_rule *rule, struct mi_writer *writer); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_LOG_LEVEL_RULE_INTERNAL_H */ diff --git a/include/lttng/notification/notification-internal.h b/include/lttng/notification/notification-internal.h index 1d337e07d..7e601b0c7 100644 --- a/include/lttng/notification/notification-internal.h +++ b/include/lttng/notification/notification-internal.h @@ -14,10 +14,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_payload; struct lttng_payload_view; @@ -44,8 +40,4 @@ ssize_t lttng_notification_create_from_payload( struct lttng_payload_view *view, struct lttng_notification **notification); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_NOTIFICATION_INTERNAL_H */ diff --git a/include/lttng/session-descriptor-internal.h b/include/lttng/session-descriptor-internal.h index 97628bb88..f438d4812 100644 --- a/include/lttng/session-descriptor-internal.h +++ b/include/lttng/session-descriptor-internal.h @@ -15,10 +15,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* Note that these enums are used as part of the lttnctl protocol. */ enum lttng_session_descriptor_type { LTTNG_SESSION_DESCRIPTOR_TYPE_UNKNOWN = -1, @@ -85,8 +81,4 @@ int lttng_session_descriptor_assign( struct lttng_session_descriptor *dst_descriptor, const struct lttng_session_descriptor *src_descriptor); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_SESSION_DESCRIPTOR_INTERNAL_H */ diff --git a/include/lttng/trigger/trigger-internal.h b/include/lttng/trigger/trigger-internal.h index 69226bce7..dab46ae07 100644 --- a/include/lttng/trigger/trigger-internal.h +++ b/include/lttng/trigger/trigger-internal.h @@ -19,10 +19,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - struct lttng_payload; struct lttng_payload_view; struct mi_writer; @@ -282,8 +278,4 @@ enum lttng_trigger_status lttng_trigger_add_action_error_query_results( enum lttng_trigger_status lttng_trigger_set_name( struct lttng_trigger *trigger, const char *name); -#if defined(__cplusplus) -} -#endif - #endif /* LTTNG_TRIGGER_INTERNAL_H */ diff --git a/include/lttng/userspace-probe-internal.h b/include/lttng/userspace-probe-internal.h index fe96a4ea3..5e960c106 100644 --- a/include/lttng/userspace-probe-internal.h +++ b/include/lttng/userspace-probe-internal.h @@ -14,10 +14,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_payload; struct lttng_payload_view; struct lttng_dynamic_buffer; @@ -163,8 +159,4 @@ enum lttng_error_code lttng_userspace_probe_location_mi_serialize( const struct lttng_userspace_probe_location *location, struct mi_writer *writer); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_USERSPACE_PROBE_INTERNAL_H */ diff --git a/src/bin/lttng-sessiond/condition-internal.h b/src/bin/lttng-sessiond/condition-internal.h index fa8f7be04..49a074952 100644 --- a/src/bin/lttng-sessiond/condition-internal.h +++ b/src/bin/lttng-sessiond/condition-internal.h @@ -10,10 +10,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /* * The lttng_condition hashing code is kept in this file (rather than * condition.c) since it makes use of GPLv2 code (hashtable utils), which we @@ -24,8 +20,4 @@ unsigned long lttng_condition_hash(const struct lttng_condition *condition); struct lttng_condition *lttng_condition_copy( const struct lttng_condition *condition); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_SESSIOND_CONDITION_INTERNAL_H */ diff --git a/src/bin/lttng-sessiond/ust-ctl-internal.h b/src/bin/lttng-sessiond/ust-ctl-internal.h index d85af2868..610aa7f36 100644 --- a/src/bin/lttng-sessiond/ust-ctl-internal.h +++ b/src/bin/lttng-sessiond/ust-ctl-internal.h @@ -14,10 +14,6 @@ #include "lttng-ust-abi.h" -#ifdef __cplusplus -extern "C" { -#endif - #ifndef LTTNG_UST_UUID_LEN #define LTTNG_UST_UUID_LEN 16 #endif @@ -659,8 +655,4 @@ int lttng_ust_ctl_counter_clear(struct lttng_ust_ctl_daemon_counter *counter, void lttng_ust_ctl_sigbus_handle(void *addr); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_UST_CTL_INTERNAL_H */ diff --git a/src/bin/lttng/loglevel.h b/src/bin/lttng/loglevel.h index 06dcbaa86..43ae8e448 100644 --- a/src/bin/lttng/loglevel.h +++ b/src/bin/lttng/loglevel.h @@ -11,10 +11,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - int loglevel_name_to_value(const char *name, enum lttng_loglevel *loglevel); bool loglevel_parse_range_string(const char *str, @@ -50,8 +46,4 @@ const char *loglevel_jul_value_to_name(int loglevel); const char *loglevel_python_value_to_name(int loglevel); -#ifdef __cplusplus -} -#endif - #endif /* _LTTNG_LOGLEVEL_UTILS_H */ diff --git a/src/common/buffer-view.h b/src/common/buffer-view.h index ecd764d7c..58f1ede2e 100644 --- a/src/common/buffer-view.h +++ b/src/common/buffer-view.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_dynamic_buffer; struct lttng_buffer_view { @@ -96,8 +92,4 @@ bool lttng_buffer_view_contains_string(const struct lttng_buffer_view *buf, const char *str, size_t len_with_null_terminator); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_BUFFER_VIEW_H */ diff --git a/src/common/bytecode/bytecode.h b/src/common/bytecode/bytecode.h index 54ed7363e..386f58241 100644 --- a/src/common/bytecode/bytecode.h +++ b/src/common/bytecode/bytecode.h @@ -13,10 +13,6 @@ #include "common/macros.h" #include "common/sessiond-comm/sessiond-comm.h" -#ifdef __cplusplus -extern "C" { -#endif - /* * offsets are absolute from start of bytecode. */ @@ -262,8 +258,4 @@ unsigned int bytecode_get_len(struct lttng_bytecode *bytecode) return bytecode->len; } -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_COMMON_BYTECODE_H */ diff --git a/src/common/compat/directory-handle.h b/src/common/compat/directory-handle.h index 9a1072019..6aa5c3d3e 100644 --- a/src/common/compat/directory-handle.h +++ b/src/common/compat/directory-handle.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - enum lttng_directory_handle_rmdir_recursive_flags { LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG = (1U << 0), LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG = (1U << 1), @@ -264,8 +260,4 @@ bool lttng_directory_handle_equals(const struct lttng_directory_handle *lhs, const struct lttng_directory_handle *rhs); -#ifdef __cplusplus -} -#endif - #endif /* _COMPAT_PATH_HANDLE_H */ diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h index 8bbdfe89c..b18e2f4e7 100644 --- a/src/common/compat/fcntl.h +++ b/src/common/compat/fcntl.h @@ -13,10 +13,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - #if (defined(__CYGWIN__)) typedef long long off64_t; #endif @@ -68,8 +64,4 @@ static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_ #error "Please add support for your OS." #endif /* __linux__ , __FreeBSD__, __CYGWIN__, __sun__, __APPLE__ */ -#ifdef __cplusplus -} -#endif - #endif /* _COMPAT_FCNTL_H */ diff --git a/src/common/compat/poll.h b/src/common/compat/poll.h index 75de9ba5f..e2a424abe 100644 --- a/src/common/compat/poll.h +++ b/src/common/compat/poll.h @@ -13,10 +13,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /* * Used by lttng_poll_clean to free the events structure in a lttng_poll_event. */ @@ -25,10 +21,6 @@ static inline void __lttng_poll_free(void *events) free(events); } -#ifdef __cplusplus -} -#endif - /* * epoll(7) implementation. */ @@ -38,10 +30,6 @@ static inline void __lttng_poll_free(void *events) #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* See man epoll(7) for this define path */ #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches" @@ -220,10 +208,6 @@ static inline void lttng_poll_clean(struct lttng_poll_event *events) __lttng_poll_free((void *) events->events); } -#ifdef __cplusplus -} -#endif - #else /* HAVE_EPOLL */ /* * Fallback on poll(2) API @@ -242,10 +226,6 @@ static inline void lttng_poll_clean(struct lttng_poll_event *events) #include #include -#ifdef __cplusplus -extern "C" { -#endif - enum { /* Polling variables compatibility for poll */ LPOLLIN = POLLIN, @@ -397,10 +377,6 @@ static inline void lttng_poll_clean(struct lttng_poll_event *events) } } -#ifdef __cplusplus -} -#endif - #endif /* HAVE_EPOLL */ #endif /* _LTT_POLL_H */ diff --git a/src/common/config/ini.h b/src/common/config/ini.h index 4522bd74e..34b3654ea 100644 --- a/src/common/config/ini.h +++ b/src/common/config/ini.h @@ -37,10 +37,6 @@ #define __INI_H__ /* Make this header file easier to include in C++ code */ -#ifdef __cplusplus -extern "C" { -#endif - #include typedef int (*ini_entry_handler)(void *, const char *, const char *, @@ -95,8 +91,4 @@ int ini_parse_file(FILE *file, ini_entry_handler handler, void *user); #define INI_MAX_LINE 200 #endif -#ifdef __cplusplus -} -#endif - #endif /* __INI_H__ */ diff --git a/src/common/config/session-config.h b/src/common/config/session-config.h index ff74eb099..a6955b0b9 100644 --- a/src/common/config/session-config.h +++ b/src/common/config/session-config.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct config_entry { /* section is NULL if the entry is not in a section */ const char *section; @@ -233,8 +229,4 @@ int config_load_session(const char *path, const char *session_name, int overwrite, unsigned int autoload, const struct config_load_session_override_attr *overrides); -#ifdef __cplusplus -} -#endif - #endif /* _CONFIG_H */ diff --git a/src/common/consumer/consumer-metadata-cache.h b/src/common/consumer/consumer-metadata-cache.h index 4f8bb763f..b8f4efadc 100644 --- a/src/common/consumer/consumer-metadata-cache.h +++ b/src/common/consumer/consumer-metadata-cache.h @@ -12,10 +12,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - enum consumer_metadata_cache_write_status { CONSUMER_METADATA_CACHE_WRITE_STATUS_ERROR = -1, /* @@ -63,8 +59,4 @@ void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel); int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel, uint64_t offset, int timer); -#ifdef __cplusplus -} -#endif - #endif /* CONSUMER_METADATA_CACHE_H */ diff --git a/src/common/consumer/consumer-stream.h b/src/common/consumer/consumer-stream.h index af0690a25..c9af63cd8 100644 --- a/src/common/consumer/consumer-stream.h +++ b/src/common/consumer/consumer-stream.h @@ -10,10 +10,6 @@ #include "consumer.h" -#ifdef __cplusplus -extern "C" { -#endif - enum consumer_stream_open_packet_status { CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED, CONSUMER_STREAM_OPEN_PACKET_STATUS_NO_SPACE, @@ -170,8 +166,4 @@ enum consumer_stream_open_packet_status consumer_stream_open_packet( int consumer_stream_flush_buffer(struct lttng_consumer_stream *stream, bool producer_active); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_CONSUMER_STREAM_H */ diff --git a/src/common/consumer/consumer-timer.h b/src/common/consumer/consumer-timer.h index 084eb017d..85751442f 100644 --- a/src/common/consumer/consumer-timer.h +++ b/src/common/consumer/consumer-timer.h @@ -14,10 +14,6 @@ #include "consumer.h" -#ifdef __cplusplus -extern "C" { -#endif - #define LTTNG_CONSUMER_SIG_SWITCH SIGRTMIN + 10 #define LTTNG_CONSUMER_SIG_TEARDOWN SIGRTMIN + 11 #define LTTNG_CONSUMER_SIG_LIVE SIGRTMIN + 12 @@ -57,8 +53,4 @@ int consumer_flush_ust_index(struct lttng_consumer_stream *stream); int consumer_timer_thread_get_channel_monitor_pipe(void); int consumer_timer_thread_set_channel_monitor_pipe(int fd); -#ifdef __cplusplus -} -#endif - #endif /* CONSUMER_TIMER_H */ diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index 582385c82..7f8d14704 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -29,10 +29,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_consumer_local_data; /* Commands for consumer */ @@ -1069,8 +1065,4 @@ enum lttcomm_return_code lttng_consumer_open_channel_packets( int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel); void lttng_consumer_sigbus_handle(void *addr); -#ifdef __cplusplus -} -#endif - #endif /* LIB_CONSUMER_H */ diff --git a/src/common/consumer/metadata-bucket.h b/src/common/consumer/metadata-bucket.h index 8868811ef..993d3f483 100644 --- a/src/common/consumer/metadata-bucket.h +++ b/src/common/consumer/metadata-bucket.h @@ -10,10 +10,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - struct metadata_bucket; typedef ssize_t (*metadata_bucket_flush_cb)( @@ -34,8 +30,4 @@ enum metadata_bucket_status metadata_bucket_fill(struct metadata_bucket *bucket, void metadata_bucket_reset(struct metadata_bucket *bucket); -#ifdef __cplusplus -} -#endif - #endif /* METADATA_BUCKET_H */ diff --git a/src/common/context.h b/src/common/context.h index b6755adda..f4abd8417 100644 --- a/src/common/context.h +++ b/src/common/context.h @@ -10,10 +10,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /* * Parse string as an application context of the form * "$app.provider_name:context_name" and return the provider name and context @@ -28,8 +24,4 @@ extern "C" { int parse_application_context(const char *str, char **provider_name, char **ctx_name); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_COMMON_CONTEXT_H */ diff --git a/src/common/credentials.h b/src/common/credentials.h index 21aa33416..b1576a757 100644 --- a/src/common/credentials.h +++ b/src/common/credentials.h @@ -14,10 +14,6 @@ #include "optional.h" -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_credentials { LTTNG_OPTIONAL(uid_t) uid; LTTNG_OPTIONAL(gid_t) gid; @@ -36,8 +32,4 @@ bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a, bool lttng_credentials_is_equal(const struct lttng_credentials *a, const struct lttng_credentials *b); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_CREDENTIALS_H */ diff --git a/src/common/daemonize.h b/src/common/daemonize.h index 8590779c2..2c88f06b7 100644 --- a/src/common/daemonize.h +++ b/src/common/daemonize.h @@ -12,10 +12,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * Daemonize this process by forking and making the parent wait for the child * to signal it indicating readiness. Once received, the parent successfully @@ -29,8 +25,4 @@ extern "C" { int lttng_daemonize(pid_t *child_ppid, int *completion_flag, int close_fds); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_DAEMONIZE_H */ diff --git a/src/common/defaults.h b/src/common/defaults.h index 95b1dc29b..39b77470d 100644 --- a/src/common/defaults.h +++ b/src/common/defaults.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* Default unix group name for tracing. */ #define DEFAULT_TRACING_GROUP "tracing" @@ -428,8 +424,4 @@ size_t default_get_ust_uid_channel_subbuf_size(void); */ pthread_attr_t *default_pthread_attr(void); -#ifdef __cplusplus -} -#endif - #endif /* _DEFAULTS_H */ diff --git a/src/common/dynamic-array.h b/src/common/dynamic-array.h index a37077404..8b08186dd 100644 --- a/src/common/dynamic-array.h +++ b/src/common/dynamic-array.h @@ -10,10 +10,6 @@ #include -#if defined(__cplusplus) -extern "C" { -#endif - typedef void (*lttng_dynamic_array_element_destructor)(void *element); typedef void (*lttng_dynamic_pointer_array_destructor)(void *ptr); @@ -181,8 +177,4 @@ void lttng_dynamic_pointer_array_reset( void lttng_dynamic_pointer_array_clear( struct lttng_dynamic_pointer_array *array); -#if defined(__cplusplus) -} -#endif - #endif /* LTTNG_DYNAMIC_ARRAY_H */ diff --git a/src/common/dynamic-buffer.h b/src/common/dynamic-buffer.h index d4813fa39..0e0dedc9b 100644 --- a/src/common/dynamic-buffer.h +++ b/src/common/dynamic-buffer.h @@ -12,10 +12,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_buffer_view; struct lttng_dynamic_buffer { @@ -96,8 +92,4 @@ void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer); size_t lttng_dynamic_buffer_get_capacity_left( struct lttng_dynamic_buffer *buffer); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_DYNAMIC_BUFFER_H */ diff --git a/src/common/error.h b/src/common/error.h index 8bb0de15c..a061f6680 100644 --- a/src/common/error.h +++ b/src/common/error.h @@ -25,10 +25,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - /* Avoid conflict with Solaris */ #if defined(ERR) && defined(__sun__) #undef ERR @@ -268,8 +264,4 @@ const char *log_add_time(void); /* Name must be a statically-allocated string. */ void logger_set_thread_name(const char *name, bool set_pthread_name); -#if defined(__cplusplus) -} -#endif - #endif /* _ERROR_H */ diff --git a/src/common/fd-handle.h b/src/common/fd-handle.h index 36a92473a..dab9e2bfa 100644 --- a/src/common/fd-handle.h +++ b/src/common/fd-handle.h @@ -10,10 +10,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /* * Wrapper around a file descriptor providing reference counting semantics. * @@ -48,8 +44,4 @@ int fd_handle_get_fd(struct fd_handle *handle); */ struct fd_handle *fd_handle_copy(const struct fd_handle *handle); -#ifdef __cplusplus -} -#endif - #endif /* FS_HANDLE_H */ diff --git a/src/common/fd-tracker/fd-tracker.h b/src/common/fd-tracker/fd-tracker.h index 5801622e2..5c9810749 100644 --- a/src/common/fd-tracker/fd-tracker.h +++ b/src/common/fd-tracker/fd-tracker.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct fs_handle; struct fd_tracker; @@ -142,8 +138,4 @@ int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker, */ void fd_tracker_log(struct fd_tracker *tracker); -#ifdef __cplusplus -} -#endif - #endif /* FD_TRACKER_H */ diff --git a/src/common/fd-tracker/utils.h b/src/common/fd-tracker/utils.h index ac614c7b1..829b56b6d 100644 --- a/src/common/fd-tracker/utils.h +++ b/src/common/fd-tracker/utils.h @@ -12,10 +12,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_poll_event; /* @@ -50,8 +46,4 @@ struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle( struct lttng_directory_handle *handle, const char *path); -#ifdef __cplusplus -} -#endif - #endif /* FD_TRACKER_UTILS_H */ diff --git a/src/common/filter.h b/src/common/filter.h index f5dcdf319..305434bf6 100644 --- a/src/common/filter.h +++ b/src/common/filter.h @@ -10,10 +10,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - struct bytecode_symbol_iterator; /* @@ -37,8 +33,4 @@ const char *bytecode_symbol_iterator_get_name( void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator *it); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_COMMON_FILTER_H */ diff --git a/src/common/filter/filter-ast.h b/src/common/filter/filter-ast.h index 5033b46ea..2b460b401 100644 --- a/src/common/filter/filter-ast.h +++ b/src/common/filter/filter-ast.h @@ -20,10 +20,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - #define printf_debug(fmt, args...) \ do { \ if (filter_parser_debug) \ @@ -194,8 +190,4 @@ int filter_visitor_ir_validate_string(struct filter_parser_ctx *ctx); int filter_visitor_ir_normalize_glob_patterns(struct filter_parser_ctx *ctx); int filter_visitor_ir_validate_globbing(struct filter_parser_ctx *ctx); -#if defined(__cplusplus) -} -#endif - #endif /* _FILTER_AST_H */ diff --git a/src/common/fs-handle.h b/src/common/fs-handle.h index afc5abc48..be6419c88 100644 --- a/src/common/fs-handle.h +++ b/src/common/fs-handle.h @@ -11,10 +11,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct fs_handle; /* @@ -67,8 +63,4 @@ int fs_handle_truncate(struct fs_handle *handle, off_t offset); off_t fs_handle_seek(struct fs_handle *handle, off_t offset, int whence); -#ifdef __cplusplus -} -#endif - #endif /* FS_HANDLE_H */ diff --git a/src/common/futex.h b/src/common/futex.h index 92a844674..602be3186 100644 --- a/src/common/futex.h +++ b/src/common/futex.h @@ -9,17 +9,9 @@ #ifndef _LTT_FUTEX_H #define _LTT_FUTEX_H -#ifdef __cplusplus -extern "C" { -#endif - void futex_wait_update(int32_t *futex, int active); void futex_nto1_prepare(int32_t *futex); void futex_nto1_wait(int32_t *futex); void futex_nto1_wake(int32_t *futex); -#ifdef __cplusplus -} -#endif - #endif /* _LTT_FUTEX_H */ diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h index e15019041..3a515fdbd 100644 --- a/src/common/hashtable/hashtable.h +++ b/src/common/hashtable/hashtable.h @@ -15,10 +15,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - LTTNG_EXPORT extern unsigned long lttng_ht_seed; typedef unsigned long (*hash_fct_type)(const void *_key, unsigned long seed); @@ -127,8 +123,4 @@ struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64( struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64( struct lttng_ht_iter *iter); -#ifdef __cplusplus -} -#endif - #endif /* _LTT_HT_H */ diff --git a/src/common/hashtable/utils.h b/src/common/hashtable/utils.h index 44f80ce4f..992643931 100644 --- a/src/common/hashtable/utils.h +++ b/src/common/hashtable/utils.h @@ -10,10 +10,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - unsigned long hash_key_ulong(const void *_key, unsigned long seed); unsigned long hash_key_u64(const void *_key, unsigned long seed); unsigned long hash_key_str(const void *key, unsigned long seed); @@ -23,8 +19,4 @@ int hash_match_key_u64(const void *key1, const void *key2); int hash_match_key_str(const void *key1, const void *key2); int hash_match_key_two_u64(const void *key1, const void *key2); -#ifdef __cplusplus -} -#endif - #endif /* _LTT_HT_UTILS_H */ diff --git a/src/common/index-allocator.h b/src/common/index-allocator.h index 93ab5ddd5..ee7c2ec75 100644 --- a/src/common/index-allocator.h +++ b/src/common/index-allocator.h @@ -11,10 +11,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_index_allocator; enum lttng_index_allocator_status { @@ -26,19 +22,22 @@ enum lttng_index_allocator_status { /* * Create an index allocator of `index_count` slots. */ -LTTNG_EXPORT struct lttng_index_allocator *lttng_index_allocator_create( +extern "C" LTTNG_EXPORT +struct lttng_index_allocator *lttng_index_allocator_create( uint64_t index_count); /* * Get the number of indexes currently in use. */ -LTTNG_EXPORT uint64_t lttng_index_allocator_get_index_count( +extern "C" LTTNG_EXPORT +uint64_t lttng_index_allocator_get_index_count( struct lttng_index_allocator *allocator); /* * Allocate (i.e. reserve) a slot. */ -LTTNG_EXPORT enum lttng_index_allocator_status lttng_index_allocator_alloc( +extern "C" LTTNG_EXPORT +enum lttng_index_allocator_status lttng_index_allocator_alloc( struct lttng_index_allocator *allocator, uint64_t *index); @@ -46,16 +45,14 @@ LTTNG_EXPORT enum lttng_index_allocator_status lttng_index_allocator_alloc( * Release a slot by index. The slot will be re-used by the index allocator * in future 'alloc' calls. */ -LTTNG_EXPORT enum lttng_index_allocator_status lttng_index_allocator_release( +extern "C" LTTNG_EXPORT +enum lttng_index_allocator_status lttng_index_allocator_release( struct lttng_index_allocator *allocator, uint64_t index); /* * Destroy an index allocator. */ -LTTNG_EXPORT void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator); - -#ifdef __cplusplus -} -#endif +extern "C" LTTNG_EXPORT +void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator); #endif /* _COMMON_INDEX_ALLOCATOR_H */ diff --git a/src/common/index/index.h b/src/common/index/index.h index c7bc65682..25ecc1975 100644 --- a/src/common/index/index.h +++ b/src/common/index/index.h @@ -17,10 +17,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_index_file { struct fs_handle *file; uint32_t major; @@ -56,8 +52,4 @@ int lttng_index_file_read(const struct lttng_index_file *index_file, void lttng_index_file_get(struct lttng_index_file *index_file); void lttng_index_file_put(struct lttng_index_file *index_file); -#ifdef __cplusplus -} -#endif - #endif /* _INDEX_H */ diff --git a/src/common/kernel-consumer/kernel-consumer.h b/src/common/kernel-consumer/kernel-consumer.h index 71a33b73f..004becb0f 100644 --- a/src/common/kernel-consumer/kernel-consumer.h +++ b/src/common/kernel-consumer/kernel-consumer.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - int lttng_kconsumer_take_snapshot(struct lttng_consumer_stream *stream); int lttng_kconsumer_sample_snapshot_positions( struct lttng_consumer_stream *stream); @@ -31,8 +27,4 @@ int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream); enum sync_metadata_status lttng_kconsumer_sync_metadata( struct lttng_consumer_stream *metadata); -#ifdef __cplusplus -} -#endif - #endif /* _LTTNG_KCONSUMER_H */ diff --git a/src/common/kernel-ctl/kernel-ctl.h b/src/common/kernel-ctl/kernel-ctl.h index c2fa6408b..e6805a983 100644 --- a/src/common/kernel-ctl/kernel-ctl.h +++ b/src/common/kernel-ctl/kernel-ctl.h @@ -16,10 +16,6 @@ #include #include /* for struct lttng_filter_bytecode */ -#ifdef __cplusplus -extern "C" { -#endif - int kernctl_create_session(int fd); int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops); int kernctl_create_channel(int fd, struct lttng_channel_attr *chops); @@ -129,8 +125,4 @@ int kernctl_get_current_timestamp(int fd, uint64_t *ts); int kernctl_get_sequence_number(int fd, uint64_t *seq); int kernctl_get_instance_id(int fd, uint64_t *seq); -#ifdef __cplusplus -} -#endif - #endif /* _LTTNG_KERNEL_CTL_H */ diff --git a/src/common/macros.h b/src/common/macros.h index 7530c912a..74f9096c7 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -57,32 +57,6 @@ void *zmalloc(size_t len) }) #endif - -/* - * The min and max macros are not needed in C++ (std::min and std::max are - * preferred) and they conflict with some C++ header file. Don't define them - * when compiling C++ source. - */ -#ifndef __cplusplus - -# ifndef max -# define max(a, b) ((a) > (b) ? (a) : (b)) -# endif - -# ifndef min -# define min(a, b) ((a) < (b) ? (a) : (b)) -# endif - -# ifndef max_t -# define max_t(type, a, b) max((type) a, (type) b) -# endif - -# ifndef min_t -# define min_t(type, a, b) min((type) a, (type) b) -# endif - -#endif - #ifndef LTTNG_PACKED #define LTTNG_PACKED __attribute__((__packed__)) #endif diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h index 74ae502f5..a9c59a62a 100644 --- a/src/common/mi-lttng.h +++ b/src/common/mi-lttng.h @@ -17,10 +17,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - /* Don't want to reference snapshot-internal.h here */ struct lttng_snapshot_output; @@ -1121,8 +1117,4 @@ int mi_lttng_rotate(struct mi_writer *writer, enum lttng_rotation_state rotation_state, const struct lttng_trace_archive_location *location); -#if defined(__cplusplus) -} -#endif - #endif /* _MI_LTTNG_H */ diff --git a/src/common/payload-view.h b/src/common/payload-view.h index af8519ab3..deaa9655c 100644 --- a/src/common/payload-view.h +++ b/src/common/payload-view.h @@ -11,10 +11,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_payload; struct fd_handle; @@ -51,24 +47,7 @@ struct lttng_payload_view { struct lttng_buffer_view buffer; /* private */ - /* - * 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; + const struct lttng_dynamic_pointer_array _fd_handles; struct { size_t *p_fd_handles_position; @@ -182,8 +161,4 @@ int lttng_payload_view_get_fd_handle_count( struct fd_handle *lttng_payload_view_pop_fd_handle( struct lttng_payload_view *payload_view); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_PAYLOAD_VIEW_H */ diff --git a/src/common/payload.h b/src/common/payload.h index e9bd8be9d..d6c0cc19e 100644 --- a/src/common/payload.h +++ b/src/common/payload.h @@ -12,10 +12,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * An lttng_payload encompasses the 'data' (bytes) and any passed file * descriptors as part of a message between liblttng-ctl and the session @@ -61,8 +57,4 @@ void lttng_payload_clear(struct lttng_payload *payload); int lttng_payload_push_fd_handle(struct lttng_payload *payload, struct fd_handle *fd_handle); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_PAYLOAD_H */ diff --git a/src/common/pipe.h b/src/common/pipe.h index b94d871e4..d9f43d66e 100644 --- a/src/common/pipe.h +++ b/src/common/pipe.h @@ -12,10 +12,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - enum lttng_pipe_state { LTTNG_PIPE_STATE_OPENED = 1, LTTNG_PIPE_STATE_CLOSED = 2, @@ -85,8 +81,4 @@ int lttng_pipe_release_readfd(struct lttng_pipe *pipe); /* Returns and releases the write end of the pipe. */ int lttng_pipe_release_writefd(struct lttng_pipe *pipe); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_PIPE_H */ diff --git a/src/common/readwrite.h b/src/common/readwrite.h index 9923e8128..ac3668a5a 100644 --- a/src/common/readwrite.h +++ b/src/common/readwrite.h @@ -11,10 +11,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * lttng_read and lttng_write take care of EINTR and partial read/write. * Upon success, they return the "count" received as parameter. @@ -26,8 +22,4 @@ extern "C" { ssize_t lttng_read(int fd, void *buf, size_t count); ssize_t lttng_write(int fd, const void *buf, size_t count); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_COMMON_READWRITE_H */ diff --git a/src/common/relayd/relayd.h b/src/common/relayd/relayd.h index 6053be796..1fbe22676 100644 --- a/src/common/relayd/relayd.h +++ b/src/common/relayd/relayd.h @@ -16,10 +16,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct relayd_stream_rotation_position { uint64_t stream_id; /* @@ -81,8 +77,4 @@ int relayd_get_configuration(struct lttcomm_relayd_sock *sock, uint64_t query_flags, uint64_t *result_flags); -#ifdef __cplusplus -} -#endif - #endif /* _RELAYD_H */ diff --git a/src/common/runas.h b/src/common/runas.h index ca084102e..406dfca22 100644 --- a/src/common/runas.h +++ b/src/common/runas.h @@ -16,10 +16,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * The run-as process is launched by forking without an exec*() call. This means * that any resource allocated before the run-as worker is launched should be @@ -65,8 +61,4 @@ int run_as_create_worker(const char *procname, post_fork_cleanup_cb clean_up_func, void *clean_up_user_data); void run_as_destroy_worker(void); -#ifdef __cplusplus -} -#endif - #endif /* _RUNAS_H */ diff --git a/src/common/sessiond-comm/inet.h b/src/common/sessiond-comm/inet.h index 9aec36cf1..fd7cffede 100644 --- a/src/common/sessiond-comm/inet.h +++ b/src/common/sessiond-comm/inet.h @@ -12,10 +12,6 @@ #include "sessiond-comm.h" -#ifdef __cplusplus -extern "C" { -#endif - /* See man tcp(7) for more detail about this value. */ #define LTTCOMM_INET_PROC_SYN_RETRIES_PATH "/proc/sys/net/ipv4/tcp_syn_retries" #define LTTCOMM_INET_PROC_FIN_TIMEOUT_PATH "/proc/sys/net/ipv4/tcp_fin_timeout" @@ -57,8 +53,4 @@ extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, /* Initialize inet communication layer. */ extern void lttcomm_inet_init(void); -#ifdef __cplusplus -} -#endif - #endif /* _LTTCOMM_INET_H */ diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h index b155fe4ad..d81e0b8cf 100644 --- a/src/common/sessiond-comm/sessiond-comm.h +++ b/src/common/sessiond-comm/sessiond-comm.h @@ -37,10 +37,6 @@ #include "inet6.h" #include -#ifdef __cplusplus -extern "C" { -#endif - /* Queue size of listen(2) */ #define LTTNG_SESSIOND_COMM_MAX_LISTEN 64 @@ -930,8 +926,4 @@ void lttcomm_init(void); /* Get network timeout, in milliseconds */ unsigned long lttcomm_get_network_timeout(void); -#ifdef __cplusplus -} -#endif - #endif /* _LTTNG_SESSIOND_COMM_H */ diff --git a/src/common/shm.h b/src/common/shm.h index 530507c35..d714506b8 100644 --- a/src/common/shm.h +++ b/src/common/shm.h @@ -9,16 +9,8 @@ #ifndef _LTT_SHM_H #define _LTT_SHM_H -#ifdef __cplusplus -extern "C" { -#endif - char *shm_ust_get_mmap(char *shm_path, int global); int shm_create_anonymous(const char *owner_name); -#ifdef __cplusplus -} -#endif - #endif /* _LTT_SHM_H */ diff --git a/src/common/spawn-viewer.h b/src/common/spawn-viewer.h index dc7b7bbcb..1221c5b08 100644 --- a/src/common/spawn-viewer.h +++ b/src/common/spawn-viewer.h @@ -11,10 +11,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - /* * Read the trace by `exec()ing` the provided viewer program if any. If * `opt_viewer` is NULL, try to read the trace with the default trace reader. @@ -25,10 +21,7 @@ extern "C" { * This symbol was mistakenly made public before the 2.12 release. It can't * be removed (but it can be stubbed-out if necessary). */ -LTTNG_EXPORT int spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode); - -#if defined(__cplusplus) -} -#endif +extern "C" LTTNG_EXPORT +int spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode); #endif /* ifndef LTTNG_SPAWN_VIEWER_H */ diff --git a/src/common/string-utils/string-utils.h b/src/common/string-utils/string-utils.h index fb795b9dd..1cf31e9d4 100644 --- a/src/common/string-utils/string-utils.h +++ b/src/common/string-utils/string-utils.h @@ -12,10 +12,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - void strutils_normalize_star_glob_pattern(char *pattern); bool strutils_is_star_glob_pattern(const char *pattern); @@ -31,8 +27,4 @@ void strutils_free_null_terminated_array_of_strings(char **array); size_t strutils_array_of_strings_len(char * const *array); -#if defined(__cplusplus) -} -#endif - #endif /* _STRING_UTILS_H */ diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h index b613b1749..33cb9aa34 100644 --- a/src/common/testpoint/testpoint.h +++ b/src/common/testpoint/testpoint.h @@ -14,10 +14,6 @@ #include /* for caa_likely/unlikely */ -#ifdef __cplusplus -extern "C" { -#endif - extern int lttng_testpoint_activated; void *lttng_testpoint_lookup(const char *name); @@ -63,8 +59,4 @@ void *lttng_testpoint_lookup(const char *name); #define TESTPOINT_DECL(name) \ _TESTPOINT_DECL(name) -#ifdef __cplusplus -} -#endif - #endif /* NTESTPOINT */ diff --git a/src/common/time.h b/src/common/time.h index dc3f76342..87adf17d7 100644 --- a/src/common/time.h +++ b/src/common/time.h @@ -13,10 +13,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - #define MSEC_PER_SEC 1000ULL #define NSEC_PER_SEC 1000000000ULL #define NSEC_PER_MSEC 1000000ULL @@ -66,8 +62,4 @@ int time_to_iso8601_str(time_t time, char *str, size_t len); int time_to_datetime_str(time_t time, char *str, size_t len); -#if defined(__cplusplus) -} -#endif - #endif /* LTTNG_TIME_H */ diff --git a/src/common/trace-chunk-registry.h b/src/common/trace-chunk-registry.h index f61e56080..0eee0c21c 100644 --- a/src/common/trace-chunk-registry.h +++ b/src/common/trace-chunk-registry.h @@ -14,10 +14,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_trace_chunk_registry; /* @@ -96,8 +92,4 @@ lttng_trace_chunk_registry_find_anonymous_chunk( unsigned int lttng_trace_chunk_registry_put_each_chunk( const struct lttng_trace_chunk_registry *registry); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_TRACE_CHUNK_REGISTRY_H */ diff --git a/src/common/trace-chunk.h b/src/common/trace-chunk.h index 9bb4f3708..4e4440b6a 100644 --- a/src/common/trace-chunk.h +++ b/src/common/trace-chunk.h @@ -16,10 +16,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * A trace chunk is a group of directories and files forming a (or a set of) * complete and independant trace(s). For instance, a trace archive chunk, @@ -186,8 +182,4 @@ bool lttng_trace_chunk_get(struct lttng_trace_chunk *chunk); void lttng_trace_chunk_put(struct lttng_trace_chunk *chunk); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_TRACE_CHUNK_H */ diff --git a/src/common/tracker.h b/src/common/tracker.h index e81ee309e..8b3794049 100644 --- a/src/common/tracker.h +++ b/src/common/tracker.h @@ -17,10 +17,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - struct process_attr_value { enum lttng_process_attr_value_type type; union value { @@ -80,8 +76,4 @@ enum lttng_error_code process_attr_value_from_comm( const struct lttng_buffer_view *value_view, struct process_attr_value **value); -#if defined(__cplusplus) -} -#endif - #endif /* LTTNG_COMMON_TRACKER_H */ diff --git a/src/common/unix.h b/src/common/unix.h index e5c7435e3..820dff0b5 100644 --- a/src/common/unix.h +++ b/src/common/unix.h @@ -16,10 +16,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - int lttcomm_create_unix_sock(const char *pathname); int lttcomm_create_anon_unix_socketpair(int *fds); int lttcomm_connect_unix_sock(const char *pathname); @@ -55,8 +51,4 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, int lttcomm_setsockopt_creds_unix_sock(int sock); -#ifdef __cplusplus -} -#endif - #endif /* _LTTCOMM_UNIX_H */ diff --git a/src/common/uri.h b/src/common/uri.h index 3a02dda5c..b0af03268 100644 --- a/src/common/uri.h +++ b/src/common/uri.h @@ -12,10 +12,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - /* Destination type of lttng URI */ enum lttng_dst_type { LTTNG_DST_IPV4 = 1, @@ -77,8 +73,4 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lttng_uri **uris); int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size); -#if defined(__cplusplus) -} -#endif - #endif /* _LTT_URI_H */ diff --git a/src/common/ust-consumer/ust-consumer.h b/src/common/ust-consumer/ust-consumer.h index 29ae853da..e2507a7f4 100644 --- a/src/common/ust-consumer/ust-consumer.h +++ b/src/common/ust-consumer/ust-consumer.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - #ifdef HAVE_LIBLTTNG_UST_CTL int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream); @@ -244,8 +240,4 @@ void lttng_ustconsumer_sigbus_handle(void *addr) } #endif /* HAVE_LIBLTTNG_UST_CTL */ -#ifdef __cplusplus -} -#endif - #endif /* _LTTNG_USTCONSUMER_H */ diff --git a/src/common/utils.h b/src/common/utils.h index 6e478b39e..a3250639b 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -17,10 +17,6 @@ #include -#if defined(__cplusplus) -extern "C" { -#endif - #define KIBI_LOG2 10 #define MEBI_LOG2 20 #define GIBI_LOG2 30 @@ -72,8 +68,4 @@ enum lttng_error_code utils_group_id_from_name( int utils_parse_unsigned_long_long(const char *str, unsigned long long *value); -#if defined(__cplusplus) -} -#endif - #endif /* _COMMON_UTILS_H */ diff --git a/src/common/uuid.h b/src/common/uuid.h index d95ea062e..0d3e79aee 100644 --- a/src/common/uuid.h +++ b/src/common/uuid.h @@ -13,10 +13,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* * Includes final \0. */ @@ -63,8 +59,4 @@ void lttng_uuid_copy(lttng_uuid dst, const lttng_uuid src); */ int lttng_uuid_generate(lttng_uuid uuid_out); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_UUID_H */ diff --git a/src/common/waiter.h b/src/common/waiter.h index 30b51ee80..ed870aeb0 100644 --- a/src/common/waiter.h +++ b/src/common/waiter.h @@ -17,10 +17,6 @@ #include #include "macros.h" -#ifdef __cplusplus -extern "C" { -#endif - struct lttng_waiter { struct cds_wfs_node wait_queue_node; int32_t state; @@ -37,8 +33,4 @@ void lttng_waiter_wait(struct lttng_waiter *waiter); */ void lttng_waiter_wake_up(struct lttng_waiter *waiter); -#ifdef __cplusplus -} -#endif - #endif /* LTTNG_WAITER_H */ -- 2.34.1