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

Fix warnings in public headers #569

Merged
merged 9 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'main'

env:
BUILDER_VERSION: v0.9.40
BUILDER_VERSION: v0.9.43
BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-c-io
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ file(GLOB IO_SRC
add_library(${PROJECT_NAME} ${LIBTYPE} ${IO_HEADERS} ${IO_SRC})
aws_set_common_properties(${PROJECT_NAME})
aws_prepare_symbol_visibility_args(${PROJECT_NAME} "AWS_IO")
aws_check_headers(${PROJECT_NAME} ${IO_HEADERS})
aws_check_headers(${PROJECT_NAME} ${AWS_IO_HEADERS})

aws_add_sanitizers(${PROJECT_NAME})

Expand Down
3 changes: 3 additions & 0 deletions include/aws/io/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <aws/common/statistics.h>
#include <aws/common/task_scheduler.h>

AWS_PUSH_SANE_WARNING_LEVEL

enum aws_channel_direction {
AWS_CHANNEL_DIR_READ,
AWS_CHANNEL_DIR_WRITE,
Expand Down Expand Up @@ -504,5 +506,6 @@ AWS_IO_API
int aws_channel_trigger_read(struct aws_channel *channel);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_CHANNEL_H */
3 changes: 3 additions & 0 deletions include/aws/io/channel_bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <aws/io/channel.h>
#include <aws/io/host_resolver.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_client_bootstrap;
struct aws_socket;
struct aws_socket_options;
Expand Down Expand Up @@ -305,5 +307,6 @@ AWS_IO_API void aws_server_bootstrap_destroy_socket_listener(
struct aws_socket *listener);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_CHANNEL_BOOTSTRAP_H */
3 changes: 3 additions & 0 deletions include/aws/io/event_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

enum aws_io_event_type {
AWS_IO_EVENT_TYPE_READABLE = 1,
AWS_IO_EVENT_TYPE_WRITABLE = 2,
Expand Down Expand Up @@ -470,5 +472,6 @@ AWS_IO_API
struct aws_event_loop *aws_event_loop_group_get_next_loop(struct aws_event_loop_group *el_group);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_EVENT_LOOP_H */
3 changes: 3 additions & 0 deletions include/aws/io/host_resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <aws/common/ref_count.h>
#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_event_loop_group;

enum aws_address_record_type {
Expand Down Expand Up @@ -272,5 +274,6 @@ AWS_IO_API size_t aws_host_resolver_get_host_address_count(
AWS_IO_API struct aws_host_resolution_config aws_host_resolver_init_default_resolution_config(void);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_HOST_RESOLVER_H */
3 changes: 3 additions & 0 deletions include/aws/io/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <aws/common/linked_list.h>
#include <aws/io/exports.h>

AWS_PUSH_SANE_WARNING_LEVEL

#define AWS_C_IO_PACKAGE_ID 1

struct aws_io_handle {
Expand Down Expand Up @@ -271,5 +273,6 @@ AWS_IO_API
void aws_io_fatal_assert_library_initialized(void);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_IO_H */
3 changes: 3 additions & 0 deletions include/aws/io/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <aws/common/logging.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_log_channel;
struct aws_log_formatter;
struct aws_log_writer;
Expand All @@ -32,5 +34,6 @@ enum aws_io_log_subject {
AWS_LS_IO_PKCS11,
AWS_IO_LS_LAST = AWS_LOG_SUBJECT_END_RANGE(AWS_C_IO_PACKAGE_ID)
};
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_LOGGING_H */
3 changes: 3 additions & 0 deletions include/aws/io/message_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <aws/common/array_list.h>
#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_memory_pool {
struct aws_allocator *alloc;
struct aws_array_list stack;
Expand Down Expand Up @@ -82,5 +84,6 @@ AWS_IO_API
void aws_message_pool_release(struct aws_message_pool *msg_pool, struct aws_io_message *message);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_MESSAGE_POOL_H */
3 changes: 3 additions & 0 deletions include/aws/io/pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <aws/common/byte_buf.h>
#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_event_loop;

struct aws_pipe_read_end {
Expand Down Expand Up @@ -144,5 +146,6 @@ int aws_pipe_get_unique_name(char *dst, size_t dst_size);
#endif

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_PIPE_H */
3 changes: 3 additions & 0 deletions include/aws/io/pkcs11.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_allocator;

/**
Expand Down Expand Up @@ -90,5 +92,6 @@ AWS_IO_API
void aws_pkcs11_lib_release(struct aws_pkcs11_lib *pkcs11_lib);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_PKCS11_H */
3 changes: 3 additions & 0 deletions include/aws/io/retry_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <aws/common/atomics.h>
#include <aws/common/byte_buf.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_retry_strategy;
struct aws_retry_token;
struct aws_event_loop_group;
Expand Down Expand Up @@ -232,5 +234,6 @@ AWS_IO_API struct aws_retry_strategy *aws_retry_strategy_new_standard(
const struct aws_standard_retry_options *config);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_CLIENT_RETRY_STRATEGY_H */
3 changes: 3 additions & 0 deletions include/aws/io/shared_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_byte_cursor;

/*
Expand Down Expand Up @@ -44,5 +46,6 @@ int aws_shared_library_find_function(
aws_generic_function *function_address);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_SHARED_LIBRARY_H */
3 changes: 3 additions & 0 deletions include/aws/io/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <aws/io/channel.h>
#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

enum aws_socket_domain {
AWS_SOCKET_IPV4,
AWS_SOCKET_IPV6,
Expand Down Expand Up @@ -301,5 +303,6 @@ AWS_IO_API int aws_socket_get_error(struct aws_socket *socket);
AWS_IO_API bool aws_socket_is_open(struct aws_socket *socket);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_SOCKET_H */
3 changes: 3 additions & 0 deletions include/aws/io/socket_channel_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_socket;
struct aws_channel_handler;
struct aws_channel_slot;
Expand All @@ -28,5 +30,6 @@ AWS_IO_API struct aws_channel_handler *aws_socket_handler_new(
AWS_IO_API const struct aws_socket *aws_socket_handler_get_socket(const struct aws_channel_handler *handler);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_SOCKET_CHANNEL_HANDLER_H */
3 changes: 3 additions & 0 deletions include/aws/io/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <aws/common/statistics.h>
#include <aws/io/tls_channel_handler.h>

AWS_PUSH_SANE_WARNING_LEVEL

enum aws_crt_io_statistics_category {
AWSCRT_STAT_CAT_SOCKET = AWS_CRT_STATISTICS_CATEGORY_BEGIN_RANGE(AWS_C_IO_PACKAGE_ID),
AWSCRT_STAT_CAT_TLS,
Expand Down Expand Up @@ -74,5 +76,6 @@ AWS_IO_API
void aws_crt_statistics_tls_reset(struct aws_crt_statistics_tls *stats);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_STATISTICS_H */
3 changes: 3 additions & 0 deletions include/aws/io/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <aws/common/ref_count.h>
#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_input_stream;
struct aws_byte_buf;

Expand Down Expand Up @@ -129,5 +131,6 @@ AWS_IO_API struct aws_input_stream *aws_input_stream_new_from_file(
AWS_IO_API struct aws_input_stream *aws_input_stream_new_from_open_file(struct aws_allocator *allocator, FILE *file);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_STREAM_H */
7 changes: 5 additions & 2 deletions include/aws/io/tls_channel_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include <aws/common/ref_count.h>
#include <aws/io/io.h>

AWS_PUSH_SANE_WARNING_LEVEL

#define AWS_TLS_NEGOTIATED_PROTOCOL_MESSAGE 0x01

struct aws_channel_slot;
struct aws_channel_handler;
struct aws_pkcs11_session;
Expand Down Expand Up @@ -254,8 +258,6 @@ struct aws_tls_negotiated_protocol_message {
struct aws_byte_buf protocol;
};

static const int AWS_TLS_NEGOTIATED_PROTOCOL_MESSAGE = 0x01;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, a static const int will always trigger a warning (C5264) in our header checker, indicating that it is unused. This is because it is only used in the .c files.


typedef struct aws_channel_handler *(
*aws_tls_on_protocol_negotiated)(struct aws_channel_slot *new_slot, struct aws_byte_buf *protocol, void *user_data);

Expand Down Expand Up @@ -914,5 +916,6 @@ AWS_IO_API
const char *aws_tls_key_operation_type_str(enum aws_tls_key_operation_type operation_type);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_IO_TLS_CHANNEL_HANDLER_H */