public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org, Matthias Kretz <kretz@kde.org>
Subject: [PATCH] libstdc++: Don't use reserved identifiers in simd headers
Date: Mon, 01 Feb 2021 13:21:33 +0100	[thread overview]
Message-ID: <ydda6so567m.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

Two simd tests FAIL on Solaris, both SPARC and x86:

FAIL: experimental/simd/standard_abi_usable.cc -msse2 -O2 -Wno-psabi (test for excess errors)
FAIL: experimental/simd/standard_abi_usable_2.cc -msse2 -O2 -Wno-psabi (test for excess errors)

This happens because the simd headers use identifiers documented in the
libstdc++ manual as reserved by system headers.

Fixed as follows, tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
and x86_64-pc-linux-gnu.

Ok for master?

As an aside, the use of vim: markers initially confused the hell out of
me.  As an Emacs user, I rarely use vi for much more than a pager, but
when I wanted to check the lines mentioned in the g++ errors, I had no
idea what was going on or how to disable the folding enabled there:

// vim: foldmethod=marker sw=2 noet ts=8 sts=2 tw=80

I can't help but feel that this is just a personal preference and
doesn't belong into the upstream code.

For avoidance of doubt, I'd consider equivalent Emacs local variables
equally inappropriate.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2021-02-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libstdc++-v3:
	* include/experimental/bits/simd.h: Replace reserved _X, _B by
	_Xp, _Bp.
	* include/experimental/bits/simd_builtin.h: Likewise.
	* include/experimental/bits/simd_x86.h: Likewise.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libstdc++-simd-badnames.patch --]
[-- Type: text/x-patch, Size: 2690 bytes --]

# HG changeset patch
# Parent  585afa0bd4a3567358ed9efd210d1a1dab740005
libstdc++: Don't use reserved identifiers in simd headers

diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -201,8 +201,8 @@ template <size_t _Np>
   inline constexpr overaligned_tag<_Np> overaligned = {};
 
 // }}}
-template <size_t _X>
-  using _SizeConstant = integral_constant<size_t, _X>;
+template <size_t _Xp>
+  using _SizeConstant = integral_constant<size_t, _Xp>;
 
 // unrolled/pack execution helpers
 // __execute_n_times{{{
@@ -4060,11 +4060,11 @@ template <template <int> class _A0, temp
 	      return typename __decay_abi<_A0<_Bytes>>::type{};
 	    else
 	      {
-		using _B =
+		using _Bp =
 		  typename __find_next_valid_abi<_A0, _Bytes, _Tp>::type;
-		if constexpr (_B::template _S_is_valid_v<
-				_Tp> && _B::template _S_size<_Tp> <= _Np)
-		  return _B{};
+		if constexpr (_Bp::template _S_is_valid_v<
+				_Tp> && _Bp::template _S_size<_Tp> <= _Np)
+		  return _Bp{};
 		else
 		  return
 		    typename _AbiList<_Rest...>::template _BestAbi<_Tp, _Np>{};
diff --git a/libstdc++-v3/include/experimental/bits/simd_builtin.h b/libstdc++-v3/include/experimental/bits/simd_builtin.h
--- a/libstdc++-v3/include/experimental/bits/simd_builtin.h
+++ b/libstdc++-v3/include/experimental/bits/simd_builtin.h
@@ -894,12 +894,12 @@ template <typename _Tp, typename _Mp, ty
     class _SimdCastType2
     {
       using _Ap = __intrinsic_type_t<_Tp, _Np>;
-      using _B = __vector_type_t<_Tp, _Np>;
+      using _Bp = __vector_type_t<_Tp, _Np>;
       _SimdMember _M_data;
 
     public:
       _SimdCastType2(_Ap __a) : _M_data(__vector_bitcast<_Tp>(__a)) {}
-      _SimdCastType2(_B __b) : _M_data(__b) {}
+      _SimdCastType2(_Bp __b) : _M_data(__b) {}
       operator _SimdMember() const { return _M_data; }
     };
 
diff --git a/libstdc++-v3/include/experimental/bits/simd_x86.h b/libstdc++-v3/include/experimental/bits/simd_x86.h
--- a/libstdc++-v3/include/experimental/bits/simd_x86.h
+++ b/libstdc++-v3/include/experimental/bits/simd_x86.h
@@ -55,10 +55,10 @@ template <typename _TV,
 
 // }}}
 // __interleave128_lo {{{
-template <typename _Ap, typename _B, typename _Tp = common_type_t<_Ap, _B>,
+template <typename _Ap, typename _Bp, typename _Tp = common_type_t<_Ap, _Bp>,
 	  typename _Trait = _VectorTraits<_Tp>>
   _GLIBCXX_SIMD_INTRINSIC constexpr _Tp
-  __interleave128_lo(const _Ap& __av, const _B& __bv)
+  __interleave128_lo(const _Ap& __av, const _Bp& __bv)
   {
     const _Tp __a(__av);
     const _Tp __b(__bv);

             reply	other threads:[~2021-02-01 12:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 12:21 Rainer Orth [this message]
2021-02-01 13:07 ` Matthias Kretz
2021-02-08 22:27 ` Jonathan Wakely

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=ydda6so567m.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kretz@kde.org \
    --cc=libstdc++@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).