From: Artem Starshov <artemreyt@tarantool.org> To: Alexander Turenko <alexander.turenko@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v2 2/2] bitset: replace zero-length array with flexible-array member Date: Fri, 27 Nov 2020 15:43:10 +0300 [thread overview] Message-ID: <6011a5182431783749d8f15604710d7d8111b602.1606479683.git.artemreyt@tarantool.org> (raw) In-Reply-To: <cover.1606479683.git.artemreyt@tarantool.org> Zero-lenght arrays are GNU C extension. There's ISO C99 flexible array member, which is preffered mechanism to declare variable-length types. Flexible array member allows us to avoid applying sizeof operator cause it's incomplete type, so it will be an error at compile time. There're any moments else why it's better way to implement such structures via FAM: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html In this issue it fixed gcc 10 warning: "warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]" Closes #4966 Closes #5564 --- src/lib/bitset/bitset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/bitset/bitset.h b/src/lib/bitset/bitset.h index e2ae4f5f6..775de5c07 100644 --- a/src/lib/bitset/bitset.h +++ b/src/lib/bitset/bitset.h @@ -69,7 +69,7 @@ struct tt_bitset_page { size_t first_pos; rb_node(struct tt_bitset_page) node; size_t cardinality; - uint8_t data[0]; + uint8_t data[]; }; typedef rb_tree(struct tt_bitset_page) tt_bitset_pages_t; -- 2.28.0
next prev parent reply other threads:[~2020-11-27 12:43 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-27 12:43 [Tarantool-patches] [PATCH v2 0/2] GCC 10 fix warnings Artem Starshov 2020-11-27 12:43 ` [Tarantool-patches] [PATCH v2 1/2] sql: fix build with GCC 10 Artem Starshov 2020-12-09 8:43 ` Leonid Vasiliev 2020-12-09 9:04 ` Artem 2020-12-09 10:07 ` Leonid Vasiliev 2020-11-27 12:43 ` Artem Starshov [this message] 2020-11-30 12:47 ` [Tarantool-patches] [PATCH v2 2/2] bitset: replace zero-length array with flexible-array member Aleksandr Lyapunov 2020-12-09 8:11 ` Leonid Vasiliev 2020-12-01 14:16 ` [Tarantool-patches] [PATCH v2 0/2] GCC 10 fix warnings Alexander V. Tikhonov 2020-12-02 0:27 ` Alexander V. Tikhonov 2020-12-16 11:47 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=6011a5182431783749d8f15604710d7d8111b602.1606479683.git.artemreyt@tarantool.org \ --to=artemreyt@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 2/2] bitset: replace zero-length array with flexible-array member' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox