Skip to content

Commit

Permalink
Support Swift CXX Interop (#1160)
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 authored Oct 21, 2024
1 parent f58e807 commit faa6c0f
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion include/aws/common/array_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/array_list.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_ARRAY_LIST_H */
3 changes: 2 additions & 1 deletion include/aws/common/atomics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/atomics.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif
3 changes: 1 addition & 2 deletions include/aws/common/atomics.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -143,6 +144,4 @@ size_t aws_atomic_fetch_xor(volatile struct aws_atomic_var *var, size_t n) {

#include <aws/common/atomics_fallback.inl>

AWS_EXTERN_C_END

#endif /* AWS_COMMON_ATOMICS_INL */
2 changes: 1 addition & 1 deletion include/aws/common/byte_order.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/byte_order.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_BYTE_ORDER_H */
3 changes: 2 additions & 1 deletion include/aws/common/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/clock.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_CLOCK_H */
3 changes: 2 additions & 1 deletion include/aws/common/encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/encoding.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_ENCODING_H */
3 changes: 1 addition & 2 deletions include/aws/common/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/error.inl>
#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,
Expand Down
2 changes: 1 addition & 1 deletion include/aws/common/linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/linked_list.inl>
#endif /* AWS_NO_STATIC_IMPL */
AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_LINKED_LIST_H */
2 changes: 1 addition & 1 deletion include/aws/common/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/math.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_MATH_H */
4 changes: 2 additions & 2 deletions include/aws/common/math.inl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <limits.h>
#include <stdlib.h>

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...
Expand Down Expand Up @@ -48,6 +46,8 @@ AWS_EXTERN_C_BEGIN
# include <aws/common/math.gcc_builtin.inl>
#endif

AWS_EXTERN_C_BEGIN

#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4127) /*Disable "conditional expression is constant" */
Expand Down
3 changes: 2 additions & 1 deletion include/aws/common/ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/ring_buffer.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_RING_BUFFER_H */
3 changes: 2 additions & 1 deletion include/aws/common/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/string.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_STRING_H */
3 changes: 2 additions & 1 deletion include/aws/common/zero.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <aws/common/zero.inl>
#endif /* AWS_NO_STATIC_IMPL */

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_ZERO_H */

0 comments on commit faa6c0f

Please sign in to comment.