[libc-commits] [libc] [libc] fix more -Wmissing-brace (PR #77382)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Jan 8 13:53:32 PST 2024


https://github.com/nickdesaulniers created https://github.com/llvm/llvm-project/pull/77382

Similar to #77345, the buildbots are observing similar warnings for the sse2
implementation.

    llvm-project/libc/src/__support/HashTable/sse2/bitmask_impl.inc:36:13:
    error: suggest braces around initialization of subobject
    [-Werror,-Wmissing-braces]
    return {bitmask};
            ^~~~~~~
            {      }
    llvm-project/libc/src/__support/HashTable/sse2/bitmask_impl.inc:45:13:
    error: suggest braces around initialization of subobject
    [-Werror,-Wmissing-braces]
    return {static_cast<uint16_t>(~mask_available().word)};
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            {                                            }

Link: https://lab.llvm.org/buildbot/#/builders/163/builds/49350/steps/8/logs/stdio
Link: https://github.com/llvm/llvm-project/pull/74506


>From 8b968598940e19558c5675108b8a8bcb233b290f Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Mon, 8 Jan 2024 13:51:19 -0800
Subject: [PATCH] [libc] fix more -Wmissing-brace

Similar to #77345, the buildbots are observing similar warnings for the sse2
implementation.

    llvm-project/libc/src/__support/HashTable/sse2/bitmask_impl.inc:36:13:
    error: suggest braces around initialization of subobject
    [-Werror,-Wmissing-braces]
    return {bitmask};
            ^~~~~~~
            {      }
    llvm-project/libc/src/__support/HashTable/sse2/bitmask_impl.inc:45:13:
    error: suggest braces around initialization of subobject
    [-Werror,-Wmissing-braces]
    return {static_cast<uint16_t>(~mask_available().word)};
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            {                                            }

Link: https://lab.llvm.org/buildbot/#/builders/163/builds/49350/steps/8/logs/stdio
Link: https://github.com/llvm/llvm-project/pull/74506
---
 libc/src/__support/HashTable/sse2/bitmask_impl.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/src/__support/HashTable/sse2/bitmask_impl.inc b/libc/src/__support/HashTable/sse2/bitmask_impl.inc
index d65240901ed406..e778c19f284a8a 100644
--- a/libc/src/__support/HashTable/sse2/bitmask_impl.inc
+++ b/libc/src/__support/HashTable/sse2/bitmask_impl.inc
@@ -33,7 +33,7 @@ struct Group {
   LIBC_INLINE IteratableBitMask match_byte(uint8_t byte) const {
     auto cmp = _mm_cmpeq_epi8(data, _mm_set1_epi8(byte));
     auto bitmask = static_cast<uint16_t>(_mm_movemask_epi8(cmp));
-    return {bitmask};
+    return {{bitmask}};
   }
 
   LIBC_INLINE BitMask mask_available() const {
@@ -42,7 +42,7 @@ struct Group {
   }
 
   LIBC_INLINE IteratableBitMask occupied() const {
-    return {static_cast<uint16_t>(~mask_available().word)};
+    return {{static_cast<uint16_t>(~mask_available().word)}};
   }
 };
 } // namespace internal



More information about the libc-commits mailing list