From 55df72c3ab6567fd197e71064aeae803657796dd Mon Sep 17 00:00:00 2001 From: Georg Sauthoff Date: Fri, 23 Dec 2022 14:34:55 +0100 Subject: [PATCH] Replace zero-length arrays with flexible arrays NB: Flexible arrays are standardized since C99 whereas zero-length arrays are a GCC extension that yield undefined behaviour, in general. See also: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html --- libs/exanic/fifo_if.h | 4 ++-- libs/exanic/transceiver.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/exanic/fifo_if.h b/libs/exanic/fifo_if.h index ffbb9f7..7ffeeee 100644 --- a/libs/exanic/fifo_if.h +++ b/libs/exanic/fifo_if.h @@ -142,7 +142,7 @@ struct tx_chunk * \note The actual data to transmit may not begin at the beginning of the * payload due to padding. See \ref exanic_payload_padding_bytes. */ - char payload[0]; + char payload[]; }; /** @@ -172,7 +172,7 @@ struct tx_payload_metadata /** * TCP payload starts here */ - char payload[0]; + char payload[]; }; /** diff --git a/libs/exanic/transceiver.h b/libs/exanic/transceiver.h index 09481a9..2869ab6 100644 --- a/libs/exanic/transceiver.h +++ b/libs/exanic/transceiver.h @@ -31,7 +31,7 @@ typedef struct { double temp; /* degrees C */ unsigned num_lanes; - struct exanic_port_xcvr_diag lanes[0]; /* per lane diagnostics */ + struct exanic_port_xcvr_diag lanes[]; /* per lane diagnostics */ } exanic_xcvr_diag_info_t; /* port_number: ethernet interface number */