aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2021-10-14 13:45:48 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2021-10-21 10:53:20 +0300
commit75c6565ec8f75d690495bf4631cda3da92c02b6a (patch)
treed7974a7e09dc623bbbf4d29c5189d3ff73d51112
parent30ad629ac02a497a1cf6508ea90f4e6dd200b89b (diff)
linux-gen: fix invalid use of structure with flexible array member errors
Fix "invalid use of structure with flexible array member" errors when building with 'pedantic' option. Internal queue_num_tbl_t struct was not used, so it has been removed. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
-rw-r--r--platform/linux-generic/include/odp_event_vector_internal.h3
-rw-r--r--platform/linux-generic/include/odp_packet_internal.h3
-rw-r--r--platform/linux-generic/include/odp_pool_internal.h3
-rw-r--r--platform/linux-generic/include/odp_timer_internal.h3
-rw-r--r--platform/linux-generic/odp_ipsec_events.c3
-rw-r--r--platform/linux-generic/odp_pkt_queue.c13
-rw-r--r--platform/linux-generic/odp_schedule_basic.c7
-rw-r--r--platform/linux-generic/odp_schedule_sp.c7
-rw-r--r--platform/linux-generic/odp_sorted_list.c3
-rw-r--r--platform/linux-generic/odp_stash.c3
-rw-r--r--platform/linux-generic/odp_timer_wheel.c6
11 files changed, 43 insertions, 11 deletions
diff --git a/platform/linux-generic/include/odp_event_vector_internal.h b/platform/linux-generic/include/odp_event_vector_internal.h
index 9fc9fea04..2d51801df 100644
--- a/platform/linux-generic/include/odp_event_vector_internal.h
+++ b/platform/linux-generic/include/odp_event_vector_internal.h
@@ -17,6 +17,8 @@
#include <odp/api/packet.h>
#include <odp_buffer_internal.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
/**
* Internal event vector header
*/
@@ -31,6 +33,7 @@ typedef struct {
odp_packet_t packet[];
} odp_event_vector_hdr_t;
+#pragma GCC diagnostic pop
/**
* Return the vector header
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index df28be39d..62f8aea25 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -73,6 +73,8 @@ typedef struct {
ODP_STATIC_ASSERT(PKT_MAX_SEGS < UINT16_MAX, "PACKET_MAX_SEGS_ERROR");
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
/**
* Internal Packet header
*
@@ -151,6 +153,7 @@ typedef struct odp_packet_hdr_t {
uint8_t data[];
} odp_packet_hdr_t;
+#pragma GCC diagnostic pop
/* Packet header size is critical for performance. Ensure that it does not accidentally
* grow over 256 bytes when cache line size is 64 bytes (or less). With larger cache line sizes,
diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index 4d03e4b9e..001bdfc37 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -35,6 +35,8 @@ typedef struct ODP_ALIGNED_CACHE pool_cache_t {
} pool_cache_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
/* Buffer header ring */
typedef struct ODP_ALIGNED_CACHE {
/* Ring header */
@@ -47,6 +49,7 @@ typedef struct ODP_ALIGNED_CACHE {
odp_buffer_hdr_t *buf_hdr_by_index[];
} pool_ring_t;
+#pragma GCC diagnostic pop
/* Callback function for pool destroy */
typedef void (*pool_destroy_cb_fn)(void *pool);
diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h
index 23fd54bf9..435fa8b70 100644
--- a/platform/linux-generic/include/odp_timer_internal.h
+++ b/platform/linux-generic/include/odp_timer_internal.h
@@ -20,6 +20,8 @@
#include <odp/api/timer.h>
#include <odp_global_data.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
/**
* Internal Timeout header
*/
@@ -37,6 +39,7 @@ typedef struct {
odp_timer_t timer;
} odp_timeout_hdr_t;
+#pragma GCC diagnostic pop
/* A larger decrement value should be used after receiving events compared to
* an 'empty' call. */
diff --git a/platform/linux-generic/odp_ipsec_events.c b/platform/linux-generic/odp_ipsec_events.c
index bb786614a..a199ffdf3 100644
--- a/platform/linux-generic/odp_ipsec_events.c
+++ b/platform/linux-generic/odp_ipsec_events.c
@@ -18,12 +18,15 @@
#include <odp/api/plat/event_inlines.h>
#include <odp/api/plat/queue_inlines.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
typedef struct {
/* common buffer header */
odp_buffer_hdr_t buf_hdr;
odp_ipsec_status_t status;
} ipsec_status_hdr_t;
+#pragma GCC diagnostic pop
static odp_pool_t ipsec_status_pool = ODP_POOL_INVALID;
diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c
index 556e034f8..ad70f0e0a 100644
--- a/platform/linux-generic/odp_pkt_queue.c
+++ b/platform/linux-generic/odp_pkt_queue.c
@@ -26,19 +26,12 @@ typedef struct ODP_ALIGNED_CACHE {
odp_packet_t pkts[NUM_PKTS];
} queue_blk_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
typedef struct ODP_ALIGNED_CACHE {
queue_blk_t blks[0];
} queue_blks_t;
-
-/* The queue_num_tbl is used to map from a queue_num to a queue_num_desc.
- * The reason is based on the assumption that usually only a small fraction
- * of the max_num_queues will have more than 1 pkt associated with it. This
- * way the active queue_desc's can be dynamically allocated and freed according
- * to the actual usage pattern.
- */
-typedef struct {
- uint32_t queue_num_to_blk_idx[0];
-} queue_num_tbl_t;
+#pragma GCC diagnostic pop
typedef struct {
uint32_t num_blks;
diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c
index 781623f84..f86914722 100644
--- a/platform/linux-generic/odp_schedule_basic.c
+++ b/platform/linux-generic/odp_schedule_basic.c
@@ -195,6 +195,8 @@ typedef struct ODP_ALIGNED_CACHE {
} sched_local_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
/* Priority queue */
typedef struct ODP_ALIGNED_CACHE {
/* Ring header */
@@ -204,6 +206,7 @@ typedef struct ODP_ALIGNED_CACHE {
uint32_t queue_index[MAX_RING_SIZE]; /* overlaps with ring.data[] */
} prio_queue_t;
+#pragma GCC diagnostic pop
/* Order context of a queue */
typedef struct ODP_ALIGNED_CACHE {
@@ -247,8 +250,10 @@ typedef struct {
} queue[CONFIG_MAX_SCHED_QUEUES];
/* Scheduler priority queues */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
prio_queue_t prio_q[NUM_SCHED_GRPS][NUM_PRIO][MAX_SPREAD];
-
+#pragma GCC diagnostic pop
uint32_t prio_q_count[NUM_SCHED_GRPS][NUM_PRIO][MAX_SPREAD];
odp_thrmask_t mask_all;
diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c
index 44c634e1c..470075cea 100644
--- a/platform/linux-generic/odp_schedule_sp.c
+++ b/platform/linux-generic/odp_schedule_sp.c
@@ -81,6 +81,8 @@ typedef struct ODP_ALIGNED_CACHE sched_cmd_t {
sizeof(struct sched_cmd_s)];
} sched_cmd_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
typedef struct ODP_ALIGNED_CACHE {
/* Ring header */
ring_u32_t ring;
@@ -89,6 +91,7 @@ typedef struct ODP_ALIGNED_CACHE {
uint32_t ring_idx[RING_SIZE]; /* overlaps with ring.data[] */
} prio_queue_t;
+#pragma GCC diagnostic pop
typedef struct thr_group_t {
/* A generation counter for fast comparison if groups have changed */
@@ -123,7 +126,11 @@ typedef struct ODP_ALIGNED_CACHE sched_group_t {
typedef struct {
sched_cmd_t queue_cmd[NUM_QUEUE];
sched_cmd_t pktio_cmd[NUM_PKTIO];
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
prio_queue_t prio_queue[NUM_GROUP][NUM_PRIO];
+#pragma GCC diagnostic pop
sched_group_t sched_group;
odp_shm_t shm;
/* Scheduler interface config options (not used in fast path) */
diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c
index 042818c83..8f998238d 100644
--- a/platform/linux-generic/odp_sorted_list.c
+++ b/platform/linux-generic/odp_sorted_list.c
@@ -28,9 +28,12 @@ typedef struct {
uint32_t pad;
} sorted_list_desc_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
typedef struct {
sorted_list_desc_t descs[0];
} sorted_list_descs_t;
+#pragma GCC diagnostic pop
typedef struct {
uint64_t total_inserts;
diff --git a/platform/linux-generic/odp_stash.c b/platform/linux-generic/odp_stash.c
index eba351c5e..038d5514d 100644
--- a/platform/linux-generic/odp_stash.c
+++ b/platform/linux-generic/odp_stash.c
@@ -22,6 +22,8 @@
#define MAX_RING_SIZE (1024 * 1024)
#define MIN_RING_SIZE 64
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
typedef struct stash_t {
char name[ODP_STASH_NAME_LEN];
odp_shm_t shm;
@@ -43,6 +45,7 @@ typedef struct stash_t {
};
} stash_t;
+#pragma GCC diagnostic pop
typedef struct stash_global_t {
odp_ticketlock_t lock;
diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c
index 24ef9cdf7..c50d3a13d 100644
--- a/platform/linux-generic/odp_timer_wheel.c
+++ b/platform/linux-generic/odp_timer_wheel.c
@@ -94,9 +94,12 @@ typedef union {
timer_blk_t *timer_blk_list;
} current_timer_slot_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
typedef struct {
current_timer_slot_t slots[0];
} current_wheel_t;
+#pragma GCC diagnostic pop
typedef struct {
uint32_t count;
@@ -130,9 +133,12 @@ typedef union { /* Each general_timer_slot is 16 bytes long. */
list_entry_t list_entry;
} general_timer_slot_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
typedef struct {
general_timer_slot_t slots[0];
} general_wheel_t;
+#pragma GCC diagnostic pop
typedef struct {
/* Note that rev stands for revolution - one complete sweep through