Skip to content

Commit

Permalink
[C] Use C++ compliant flexible array member.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeb01 committed Jun 18, 2024
1 parent dd23b20 commit a6962a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ add_definitions(-DAERON_VERSION_GITSHA="${AERON_VERSION_GITSHA}")

# all UNIX-based platform compiler flags
if (UNIX)
add_compile_options(-Wall -Wpedantic -Wextra -Wno-unused-parameter -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer)
add_compile_options(-Wall -Wpedantic -Wextra -Wno-unused-parameter -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fstrict-flex-arrays=1)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "11.0")
add_compile_options(-Wno-error=maybe-uninitialized)
Expand Down
2 changes: 1 addition & 1 deletion aeron-driver/src/main/c/aeron_driver_conductor_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void aeron_driver_conductor_proxy_on_publication_error(
int32_t error_length,
const uint8_t *error_text)
{
uint8_t buffer[sizeof(aeron_command_publication_error_t) + AERON_ERROR_MAX_MESSAGE_LENGTH + 1];
uint8_t buffer[offsetof(aeron_command_publication_error_t, error_text[AERON_ERROR_MAX_MESSAGE_LENGTH + 1])];
aeron_command_publication_error_t *error = (aeron_command_publication_error_t *)buffer;
error_length = error_length <= AERON_ERROR_MAX_MESSAGE_LENGTH ? error_length : AERON_ERROR_MAX_MESSAGE_LENGTH;

Expand Down
2 changes: 1 addition & 1 deletion aeron-driver/src/main/c/aeron_driver_conductor_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct aeron_command_publication_error_stct
int64_t registration_id;
int32_t error_code;
int32_t error_length;
uint8_t error_text[];
uint8_t error_text[1];
};
typedef struct aeron_command_publication_error_stct aeron_command_publication_error_t;

Expand Down

0 comments on commit a6962a8

Please sign in to comment.