Skip to content

Commit 84ca3de

Browse files
pks-tgitster
authored andcommitted
reftable/stack: fix compiler warning due to missing braces
While perfectly legal, older compiler toolchains complain when zero-initializing structs that contain nested structs with `{0}`: /home/libgit2/source/deps/reftable/stack.c:862:35: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] struct reftable_addition empty = REFTABLE_ADDITION_INIT; ^~~~~~~~~~~~~~~~~~~~~~ /home/libgit2/source/deps/reftable/stack.c:707:33: note: expanded from macro 'REFTABLE_ADDITION_INIT' #define REFTABLE_ADDITION_INIT {0} ^ Silence this warning by using `{{0}}` instead. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c64225 commit 84ca3de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

reftable/stack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ struct reftable_addition {
704704
uint64_t next_update_index;
705705
};
706706

707-
#define REFTABLE_ADDITION_INIT {0}
707+
#define REFTABLE_ADDITION_INIT {{0}}
708708

709709
static int reftable_stack_init_addition(struct reftable_addition *add,
710710
struct reftable_stack *st,

0 commit comments

Comments
 (0)