Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CMake to 3.9 #686

Merged
merged 11 commits into from
Oct 23, 2024
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.9)
project(aws-c-io C)

if (POLICY CMP0069)
cmake_policy(SET CMP0069 NEW) # Enable LTO/IPO if available in the compiler, see AwsCFlags
endif()

if (DEFINED CMAKE_PREFIX_PATH)
file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
endif()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This library is licensed under the Apache 2.0 License.

### Building

CMake 3.1+ is required to build.
CMake 3.9+ is required to build.

`<install-path>` must be an absolute path in the following instructions.

Expand Down
67 changes: 13 additions & 54 deletions source/future.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ struct aws_future_impl {
};

static void s_future_impl_result_dtor(struct aws_future_impl *future, void *result_addr) {

/*
* On ARM machines, the compiler complains about the array bounds warning for aws_future_bool, even though
* aws_future_bool will never go into any destroy or release branch. Disable the warning since it's a false positive.
*/
#ifndef _MSC_VER
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Warray-bounds"
#endif
switch (future->type) {
case AWS_FUTURE_T_BY_VALUE_WITH_CLEAN_UP: {
future->result_dtor.clean_up(result_addr);
Expand All @@ -79,6 +88,9 @@ static void s_future_impl_result_dtor(struct aws_future_impl *future, void *resu
default:
break;
}
#ifndef _MSC_VER
# pragma GCC diagnostic pop
#endif
}

static void s_future_impl_destroy(void *user_data) {
Expand Down Expand Up @@ -472,60 +484,7 @@ bool aws_future_impl_wait(const struct aws_future_impl *future, uint64_t timeout
return is_done;
}

// AWS_FUTURE_T_BY_VALUE_IMPLEMENTATION(aws_future_bool, bool)
struct aws_future_bool *aws_future_bool_new(struct aws_allocator *alloc) {
return (struct aws_future_bool *)aws_future_impl_new_by_value(alloc, sizeof(_Bool));
}
void aws_future_bool_set_result(struct aws_future_bool *future, _Bool result) {
aws_future_impl_set_result_by_move((struct aws_future_impl *)future, &result);
}
_Bool aws_future_bool_get_result(const struct aws_future_bool *future) {
return *(_Bool *)aws_future_impl_get_result_address((const struct aws_future_impl *)future);
}
struct aws_future_bool *aws_future_bool_acquire(struct aws_future_bool *future) {
return (struct aws_future_bool *)aws_future_impl_acquire((struct aws_future_impl *)future);
}
struct aws_future_bool *aws_future_bool_release(struct aws_future_bool *future) {
return (struct aws_future_bool *)aws_future_impl_release((struct aws_future_impl *)future);
}
void aws_future_bool_set_error(struct aws_future_bool *future, int error_code) {
aws_future_impl_set_error((struct aws_future_impl *)future, error_code);
}
_Bool aws_future_bool_is_done(const struct aws_future_bool *future) {
return aws_future_impl_is_done((const struct aws_future_impl *)future);
}
int aws_future_bool_get_error(const struct aws_future_bool *future) {
return aws_future_impl_get_error((const struct aws_future_impl *)future);
}
void aws_future_bool_register_callback(
struct aws_future_bool *future,
aws_future_callback_fn *on_done,
void *user_data) {
aws_future_impl_register_callback((struct aws_future_impl *)future, on_done, user_data);
}
_Bool aws_future_bool_register_callback_if_not_done(
struct aws_future_bool *future,
aws_future_callback_fn *on_done,
void *user_data) {
return aws_future_impl_register_callback_if_not_done((struct aws_future_impl *)future, on_done, user_data);
}
void aws_future_bool_register_event_loop_callback(
struct aws_future_bool *future,
struct aws_event_loop *event_loop,
aws_future_callback_fn *on_done,
void *user_data) {
aws_future_impl_register_event_loop_callback((struct aws_future_impl *)future, event_loop, on_done, user_data);
}
void aws_future_bool_register_channel_callback(
struct aws_future_bool *future,
struct aws_channel *channel,
aws_future_callback_fn *on_done,
void *user_data) {
aws_future_impl_register_channel_callback((struct aws_future_impl *)future, channel, on_done, user_data);
}
_Bool aws_future_bool_wait(struct aws_future_bool *future, uint64_t timeout_ns) {
return aws_future_impl_wait((struct aws_future_impl *)future, timeout_ns);
}
AWS_FUTURE_T_BY_VALUE_IMPLEMENTATION(aws_future_bool, bool)

AWS_FUTURE_T_BY_VALUE_IMPLEMENTATION(aws_future_size, size_t)

Expand Down