From faa6c0f00802fc861e7252404f65fb1e0617ca8e Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 21 Oct 2024 11:44:00 -0700 Subject: [PATCH] Support Swift CXX Interop (#1160) --- include/aws/common/array_list.h | 2 +- include/aws/common/atomics.h | 3 ++- include/aws/common/atomics.inl | 3 +-- include/aws/common/byte_order.h | 2 +- include/aws/common/clock.h | 3 ++- include/aws/common/encoding.h | 3 ++- include/aws/common/error.h | 3 +-- include/aws/common/linked_list.h | 2 +- include/aws/common/math.h | 2 +- include/aws/common/math.inl | 4 ++-- include/aws/common/ring_buffer.h | 3 ++- include/aws/common/string.h | 3 ++- include/aws/common/zero.h | 3 ++- 13 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/aws/common/array_list.h b/include/aws/common/array_list.h index 4ef924456..4cd05bb7d 100644 --- a/include/aws/common/array_list.h +++ b/include/aws/common/array_list.h @@ -231,11 +231,11 @@ void aws_array_list_swap(struct aws_array_list *AWS_RESTRICT list, size_t a, siz AWS_COMMON_API void aws_array_list_sort(struct aws_array_list *AWS_RESTRICT list, aws_array_list_comparator_fn *compare_fn); +AWS_EXTERN_C_END #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_ARRAY_LIST_H */ diff --git a/include/aws/common/atomics.h b/include/aws/common/atomics.h index 7f5445334..a4fa72e38 100644 --- a/include/aws/common/atomics.h +++ b/include/aws/common/atomics.h @@ -318,11 +318,12 @@ size_t aws_atomic_fetch_xor(volatile struct aws_atomic_var *var, size_t n); AWS_STATIC_IMPL void aws_atomic_thread_fence(enum aws_memory_order order); +AWS_EXTERN_C_END + #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif diff --git a/include/aws/common/atomics.inl b/include/aws/common/atomics.inl index 3763fb4d5..306504fb1 100644 --- a/include/aws/common/atomics.inl +++ b/include/aws/common/atomics.inl @@ -127,6 +127,7 @@ AWS_STATIC_IMPL size_t aws_atomic_fetch_xor(volatile struct aws_atomic_var *var, size_t n) { return aws_atomic_fetch_xor_explicit(var, n, aws_memory_order_seq_cst); } +AWS_EXTERN_C_END /* Include the backend implementation now, because we'll use its typedefs and #defines below */ #if defined(__GNUC__) || defined(__clang__) @@ -143,6 +144,4 @@ size_t aws_atomic_fetch_xor(volatile struct aws_atomic_var *var, size_t n) { #include -AWS_EXTERN_C_END - #endif /* AWS_COMMON_ATOMICS_INL */ diff --git a/include/aws/common/byte_order.h b/include/aws/common/byte_order.h index b42f7a666..c2bd0d1b5 100644 --- a/include/aws/common/byte_order.h +++ b/include/aws/common/byte_order.h @@ -66,11 +66,11 @@ AWS_STATIC_IMPL uint16_t aws_hton16(uint16_t x); */ AWS_STATIC_IMPL uint16_t aws_ntoh16(uint16_t x); +AWS_EXTERN_C_END #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_BYTE_ORDER_H */ diff --git a/include/aws/common/clock.h b/include/aws/common/clock.h index f1ca14877..d385cb46b 100644 --- a/include/aws/common/clock.h +++ b/include/aws/common/clock.h @@ -54,11 +54,12 @@ int aws_high_res_clock_get_ticks(uint64_t *timestamp); AWS_COMMON_API int aws_sys_clock_get_ticks(uint64_t *timestamp); +AWS_EXTERN_C_END + #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_CLOCK_H */ diff --git a/include/aws/common/encoding.h b/include/aws/common/encoding.h index b5f4d88e3..89e4df2e6 100644 --- a/include/aws/common/encoding.h +++ b/include/aws/common/encoding.h @@ -224,11 +224,12 @@ AWS_COMMON_API int aws_utf8_decoder_update(struct aws_utf8_decoder *decoder, str */ AWS_COMMON_API int aws_utf8_decoder_finalize(struct aws_utf8_decoder *decoder); +AWS_EXTERN_C_END + #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_ENCODING_H */ diff --git a/include/aws/common/error.h b/include/aws/common/error.h index a798b6677..b8ecdc88b 100644 --- a/include/aws/common/error.h +++ b/include/aws/common/error.h @@ -149,12 +149,11 @@ int aws_translate_and_raise_io_error_or(int error_no, int fallback_aws_error_cod AWS_COMMON_API int aws_translate_and_raise_io_error(int error_no); +AWS_EXTERN_C_END #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END - enum aws_common_error { AWS_ERROR_SUCCESS = AWS_ERROR_ENUM_BEGIN_RANGE(AWS_C_COMMON_PACKAGE_ID), AWS_ERROR_OOM, diff --git a/include/aws/common/linked_list.h b/include/aws/common/linked_list.h index cb0ce655c..bd2e5d891 100644 --- a/include/aws/common/linked_list.h +++ b/include/aws/common/linked_list.h @@ -186,11 +186,11 @@ AWS_STATIC_IMPL void aws_linked_list_move_all_front( * Returns true if the node is currently in a list, false otherwise. */ AWS_STATIC_IMPL bool aws_linked_list_node_is_in_list(struct aws_linked_list_node *node); +AWS_EXTERN_C_END #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_LINKED_LIST_H */ diff --git a/include/aws/common/math.h b/include/aws/common/math.h index 7d0f97b61..8a8a00118 100644 --- a/include/aws/common/math.h +++ b/include/aws/common/math.h @@ -200,11 +200,11 @@ AWS_STATIC_IMPL float aws_max_float(float a, float b); AWS_STATIC_IMPL double aws_min_double(double a, double b); AWS_STATIC_IMPL double aws_max_double(double a, double b); +AWS_EXTERN_C_END #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_MATH_H */ diff --git a/include/aws/common/math.inl b/include/aws/common/math.inl index ad3590623..002ff8178 100644 --- a/include/aws/common/math.inl +++ b/include/aws/common/math.inl @@ -13,8 +13,6 @@ #include #include -AWS_EXTERN_C_BEGIN - #if defined(AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS) && (defined(__clang__) || !defined(__cplusplus)) /* * GCC and clang have these super convenient overflow checking builtins... @@ -48,6 +46,8 @@ AWS_EXTERN_C_BEGIN # include #endif +AWS_EXTERN_C_BEGIN + #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable : 4127) /*Disable "conditional expression is constant" */ diff --git a/include/aws/common/ring_buffer.h b/include/aws/common/ring_buffer.h index 24cddd09f..e798d5d1d 100644 --- a/include/aws/common/ring_buffer.h +++ b/include/aws/common/ring_buffer.h @@ -93,11 +93,12 @@ AWS_COMMON_API bool aws_ring_buffer_buf_belongs_to_pool( const struct aws_ring_buffer *ring_buffer, const struct aws_byte_buf *buf); +AWS_EXTERN_C_END + #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_RING_BUFFER_H */ diff --git a/include/aws/common/string.h b/include/aws/common/string.h index da4482abf..37ec2f99e 100644 --- a/include/aws/common/string.h +++ b/include/aws/common/string.h @@ -373,11 +373,12 @@ bool aws_c_string_is_valid(const char *str); AWS_STATIC_IMPL bool aws_char_is_space(uint8_t c); +AWS_EXTERN_C_END + #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_STRING_H */ diff --git a/include/aws/common/zero.h b/include/aws/common/zero.h index e83cf454b..f04f5a84d 100644 --- a/include/aws/common/zero.h +++ b/include/aws/common/zero.h @@ -56,11 +56,12 @@ bool aws_is_mem_zeroed(const void *buf, size_t bufsize); AWS_COMMON_API void aws_secure_zero(void *pBuf, size_t bufsize); +AWS_EXTERN_C_END + #ifndef AWS_NO_STATIC_IMPL # include #endif /* AWS_NO_STATIC_IMPL */ -AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL #endif /* AWS_COMMON_ZERO_H */