Re: [PATCH v4 1/7] Add delta-islands.{c,h}
From: Christian Couder <hidden>
Date: 2018-08-16 06:02:09
On Mon, Aug 13, 2018 at 8:11 PM, Jeff King [off-list ref] wrote:
On Mon, Aug 13, 2018 at 01:17:18PM +0100, Ramsay Jones wrote:quoted
quoted
quoted
quoted
+struct island_bitmap { + uint32_t refcount; + uint32_t bits[];Use FLEX_ARRAY here? We are slowly moving toward requiring certain C99 features, but I can't remember a flex array weather-balloon patch.This was already discussed by Junio and Peff there: https://public-inbox.org/git/20180727130229.GB18599@sigill.intra.peff.net/That is a fine discussion, without a firm conclusion, but I don't think you can simply do nothing here: $ cat -n junk.c 1 #include <stdint.h> 2 3 struct island_bitmap { 4 uint32_t refcount; 5 uint32_t bits[]; 6 }; 7 $ gcc --std=c89 --pedantic -c junk.c junk.c:5:11: warning: ISO C90 does not support flexible array members [-Wpedantic] uint32_t bits[]; ^~~~ $ gcc --std=c99 --pedantic -c junk.cRight, whether we use the FLEX_ALLOC macros or not, this needs to be declared with FLEX_ARRAY, not an empty "[]".
Ok, it will use FLEX_ARRAY in the reroll I will send soon. Thanks Ramsay and Peff!