eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.65k stars 384 forks source link

Fix warnings with `-Wcast-align=strict` #1778

Open FerdinandSpitzschnueffler opened 1 year ago

FerdinandSpitzschnueffler commented 1 year ago

Brief feature description

When compiling with gcc and -Wcast-align=strict there are some warnings in the C binding and in the iceperf example. These should be fixed.

Detailed information

For the warnings in the C binding @elBoberido proposes to replace

/// @brief handle of the chunk header
typedef struct
{
    // could be empty but then we get `struct has no members` warning
    uint8_t do_not_touch_me[1];
} iox_chunk_header_t;

with

/// @brief handle of the chunk header
typedef struct iox_chunk_header_opaque_t iox_chunk_header_t;

Additionally, see the following comments: https://github.com/eclipse-iceoryx/iceoryx/pull/1774#discussion_r1015440294 https://github.com/eclipse-iceoryx/iceoryx/pull/1774#discussion_r1015530501

elBoberido commented 1 year ago

@FerdinandSpitzschnueffler the issue is uds.cpp and mq.cpp are related to using char* instead of void*. With that change, the problem is also solved there but we need to use cxx::alignedAlloc/cxx::alignedFree instead of new.

It also seems that some of the tests cause issues. My initial assessment does not hold.