public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthias Kretz <mkretz@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-10078] libstdc++: Silence irrelevant warnings in <experimental/simd>
Date: Mon, 22 Apr 2024 18:56:48 +0000 (GMT)	[thread overview]
Message-ID: <20240422185648.4355B3858CDA@sourceware.org> (raw)

https://gcc.gnu.org/g:e7a3ad29c9c832b6ae999cbfb0af89e121959030

commit r14-10078-ge7a3ad29c9c832b6ae999cbfb0af89e121959030
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Wed Apr 17 10:35:47 2024 +0200

    libstdc++: Silence irrelevant warnings in <experimental/simd>
    
    Avoid
    -Wnarrowing in C code;
    -Wtautological-compare in unconditional static_assert (necessary for
    faking a dependency on a template parameter)
    
    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
    
    libstdc++-v3/ChangeLog:
    
            * include/experimental/bits/simd.h: Ignore -Wnarrowing for
            arm_neon.h.
            (__int_for_sizeof): Replace tautological compare with checking
            for invalid template parameter value.
            * include/experimental/bits/simd_builtin.h (__extract_part):
            Remove tautological compare by combining two static_assert.

Diff:
---
 libstdc++-v3/include/experimental/bits/simd.h         | 8 +++++++-
 libstdc++-v3/include/experimental/bits/simd_builtin.h | 3 +--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
index 03c2e17a326..6ef9c955cfa 100644
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -44,7 +44,12 @@
 #if _GLIBCXX_SIMD_X86INTRIN
 #include <x86intrin.h>
 #elif _GLIBCXX_SIMD_HAVE_NEON
+#pragma GCC diagnostic push
+// narrowing conversion of '__a' from 'uint64_t' {aka 'long long unsigned int'} to
+//   'int64x1_t' {aka 'long long int'} [-Wnarrowing]
+#pragma GCC diagnostic ignored "-Wnarrowing"
 #include <arm_neon.h>
+#pragma GCC diagnostic pop
 #endif
 #if _GLIBCXX_SIMD_HAVE_SVE
 #include <arm_sve.h>
@@ -598,6 +603,7 @@ template <size_t _Bytes>
   constexpr auto
   __int_for_sizeof()
   {
+    static_assert(_Bytes > 0);
     if constexpr (_Bytes == sizeof(int))
       return int();
   #ifdef __clang__
@@ -663,7 +669,7 @@ template <size_t _Bytes>
 	return _Ip{};
       }
     else
-      static_assert(_Bytes != _Bytes, "this should be unreachable");
+      static_assert(_Bytes == 0, "this should be unreachable");
   }
 #pragma GCC diagnostic pop
 
diff --git a/libstdc++-v3/include/experimental/bits/simd_builtin.h b/libstdc++-v3/include/experimental/bits/simd_builtin.h
index af0c4886108..49c7c7e1c70 100644
--- a/libstdc++-v3/include/experimental/bits/simd_builtin.h
+++ b/libstdc++-v3/include/experimental/bits/simd_builtin.h
@@ -278,8 +278,7 @@ template <int _Index, int _Total, int _Combine = 1, size_t _Np>
   __extract_part(const _SimdWrapper<bool, _Np> __x)
   {
     static_assert(_Combine == 1, "_Combine != 1 not implemented");
-    static_assert(__have_avx512f && _Np == _Np);
-    static_assert(_Total >= 2 && _Index + _Combine <= _Total && _Index >= 0);
+    static_assert(__have_avx512f && _Total >= 2 && _Index + _Combine <= _Total && _Index >= 0);
     return __x._M_data >> (_Index * _Np / _Total);
   }

                 reply	other threads:[~2024-04-22 18:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240422185648.4355B3858CDA@sourceware.org \
    --to=mkretz@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).