From 0cf83d9892c31e030044894225f5019cdef9db6b Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Mon, 8 Jan 2024 09:29:32 -0800 Subject: [PATCH 1/3] [libc] fix -Wmissing-braces Fixes the following errors observed on the aarch64 fullbuild: /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/HashTable/generic/bitmask_impl.inc:116:13: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] return {static_cast(mask_available().word ^ repeat_byte(0x80))}; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { } In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/search/hdestroy.cpp:10: /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/HashTable/table.h:336:41: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] iterator end() const { return {0, 0, {0}, *this}; } ^ {} Link: https://lab.llvm.org/buildbot/#/builders/223/builds/33868/steps/6/logs/stdio Link: https://github.com/llvm/llvm-project/pull/74506 --- libc/src/__support/HashTable/generic/bitmask_impl.inc | 2 +- libc/src/__support/HashTable/table.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/src/__support/HashTable/generic/bitmask_impl.inc b/libc/src/__support/HashTable/generic/bitmask_impl.inc index b825cb5fbc44a..d0cb342a60cd9 100644 --- a/libc/src/__support/HashTable/generic/bitmask_impl.inc +++ b/libc/src/__support/HashTable/generic/bitmask_impl.inc @@ -113,7 +113,7 @@ struct Group { } LIBC_INLINE IteratableBitMask occupied() const { - return {static_cast(mask_available().word ^ repeat_byte(0x80))}; + return {{static_cast(mask_available().word ^ repeat_byte(0x80))}}; } }; } // namespace internal diff --git a/libc/src/__support/HashTable/table.h b/libc/src/__support/HashTable/table.h index d70ca4d233805..9b2f3beea9965 100644 --- a/libc/src/__support/HashTable/table.h +++ b/libc/src/__support/HashTable/table.h @@ -333,7 +333,7 @@ struct HashTable { return {0, full_capacity() - available_slots, Group::load_aligned(&control(0)).occupied(), *this}; } - iterator end() const { return {0, 0, {0}, *this}; } + iterator end() const { return {0, 0, {{0}}, *this}; } LIBC_INLINE ENTRY *find(const char *key) { uint64_t primary = oneshot_hash(key); From a18bd3bd2b625c53c00e1d38e67e151ddeebc670 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Mon, 8 Jan 2024 09:50:53 -0800 Subject: [PATCH 2/3] name the field --- libc/src/__support/HashTable/table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/src/__support/HashTable/table.h b/libc/src/__support/HashTable/table.h index 9b2f3beea9965..288829b1cac97 100644 --- a/libc/src/__support/HashTable/table.h +++ b/libc/src/__support/HashTable/table.h @@ -333,7 +333,7 @@ struct HashTable { return {0, full_capacity() - available_slots, Group::load_aligned(&control(0)).occupied(), *this}; } - iterator end() const { return {0, 0, {{0}}, *this}; } + iterator end() const { return {0, 0, {BitMask{0}}, *this}; } LIBC_INLINE ENTRY *find(const char *key) { uint64_t primary = oneshot_hash(key); From 1de0c4ef51e4743379b6017ef8b0aae5c5a038e1 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Mon, 8 Jan 2024 09:51:07 -0800 Subject: [PATCH 3/3] git clang-format HEAD~2 --- libc/src/__support/HashTable/generic/bitmask_impl.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc/src/__support/HashTable/generic/bitmask_impl.inc b/libc/src/__support/HashTable/generic/bitmask_impl.inc index d0cb342a60cd9..56b540d568d00 100644 --- a/libc/src/__support/HashTable/generic/bitmask_impl.inc +++ b/libc/src/__support/HashTable/generic/bitmask_impl.inc @@ -113,7 +113,8 @@ struct Group { } LIBC_INLINE IteratableBitMask occupied() const { - return {{static_cast(mask_available().word ^ repeat_byte(0x80))}}; + return { + {static_cast(mask_available().word ^ repeat_byte(0x80))}}; } }; } // namespace internal