memif: fix gcc-10 build error on arm platform 66/32366/4
authorTianyu Li <tianyu.li@arm.com>
Tue, 18 May 2021 14:19:26 +0000 (22:19 +0800)
committerDamjan Marion <dmarion@me.com>
Fri, 21 May 2021 06:23:20 +0000 (06:23 +0000)
In function ‘memcpy’,
 inlined from ‘memif_device_input_zc_inline’
 at src/plugins/memif/node.c:850:7,
 string_fortified.h:34:10: error:
   writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
 34 |   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
    |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/plugins/memif/node.c: In function ‘memif_input_node_fn_neoversen1’:
src/plugins/memif/memif.h:175:16: note:
  at offset 0 to object ‘desc’ with size 0 declared here
  175 |   memif_desc_t desc[0];
      |                ^~~~

Using C99 way empty brackets for flexible array members

Type: fix
Signed-off-by: Tianyu Li <tianyu.li@arm.com>
Change-Id: I7a6ad89f95e1b5e3f9aac36546a2559dbda9bd6c

src/plugins/memif/memif.h

index 8539c98..1c92d26 100644 (file)
@@ -172,7 +172,7 @@ typedef struct
     MEMIF_CACHELINE_ALIGN_MARK (cacheline1);
   volatile uint16_t tail;
     MEMIF_CACHELINE_ALIGN_MARK (cacheline2);
-  memif_desc_t desc[0];
+    memif_desc_t desc[];
 } memif_ring_t;
 
 #endif /* _MEMIF_H_ */