libstdc++: Fix some Parallel Mode testsuite failures

Some of these are due to no longer using #pragma GCC system_header in
libstdc++ headers, some have been failing for longer and weren't
noticed.

libstdc++-v3/ChangeLog:

	* include/parallel/algobase.h (search): Use sequential algorithm
	for constant evaluation.
	* include/parallel/algorithmfwd.h (search): Add
	_GLIBCXX20_CONSTEXPR.
	* include/parallel/multiway_merge.h: Remove stray semi-colon.
	* include/parallel/multiseq_selection.h: Add diagnostic pragmas
	for -Wlong-long warning.
	* include/parallel/quicksort.h: Likewise.
	* include/parallel/random_number.h: Likewise.
	* include/parallel/settings.h: Likewise.
	* include/parallel/workstealing.h: Replace ++ and -- on volatile
	variables.
	* testsuite/17_intro/names.cc: Skip names defined by
	<tr1/random>.
	* testsuite/20_util/pair/dangling_ref.cc: Skip test if Parallel
	Mode is enabled.
	* testsuite/20_util/tuple/dangling_ref.cc: Likewise.
This commit is contained in:
Jonathan Wakely 2024-10-03 18:52:12 +01:00 committed by Jonathan Wakely
parent 7766a2c1eb
commit e120521893
No known key found for this signature in database
11 changed files with 32 additions and 7 deletions

View file

@ -515,11 +515,17 @@ namespace __parallel
// Public interface
template<typename _FIterator1, typename _FIterator2,
typename _BinaryPredicate>
_GLIBCXX20_CONSTEXPR
inline _FIterator1
search(_FIterator1 __begin1, _FIterator1 __end1,
_FIterator2 __begin2, _FIterator2 __end2,
_BinaryPredicate __pred)
{
#if __cplusplus > 201703L
if (std::is_constant_evaluated())
return _GLIBCXX_STD_A::search(__begin1, __end1, __begin2, __end2,
std::move(__pred));
#endif
return __search_switch(__begin1, __end1, __begin2, __end2, __pred,
std::__iterator_category(__begin1),
std::__iterator_category(__begin2));

View file

@ -353,6 +353,7 @@ namespace __parallel
__gnu_parallel::sequential_tag);
template<typename _FIter1, typename _FIter2, typename _BiPredicate>
_GLIBCXX20_CONSTEXPR
_FIter1
search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate);

View file

@ -189,9 +189,12 @@ namespace __gnu_parallel
__r = __rd_log2(__nmax) + 1;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlong-long" // LL literal
// Pad all lists to this length, at least as long as any ns[__i],
// equality iff __nmax = 2^__k - 1.
__l = (1ULL << __r) - 1;
#pragma GCC diagnostic pop
for (_SeqNumber __i = 0; __i < __m; __i++)
{

View file

@ -2067,6 +2067,6 @@ namespace __gnu_parallel
(__seqs_begin, __seqs_end, __target, __length, __comp,
exact_tag(__tag.__get_num_threads()));
}
}; // namespace __gnu_parallel
} // namespace __gnu_parallel
#endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H */

View file

@ -66,12 +66,15 @@ namespace __gnu_parallel
_ValueType* __samples = static_cast<_ValueType*>
(::operator new(__num_samples * sizeof(_ValueType)));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlong-long" // LL literal
for (_DifferenceType __s = 0; __s < __num_samples; ++__s)
{
const unsigned long long __index = static_cast<unsigned long long>
(__s) * __n / __num_samples;
::new(&(__samples[__s])) _ValueType(__begin[__index]);
}
#pragma GCC diagnostic pop
__gnu_sequential::sort(__samples, __samples + __num_samples, __comp);

View file

@ -38,6 +38,9 @@
namespace __gnu_parallel
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlong-long" // LL literal
/** @brief Random number generator, based on the Mersenne twister. */
class _RandomNumber
{
@ -120,6 +123,8 @@ namespace __gnu_parallel
}
};
#pragma GCC diagnostic pop
} // namespace __gnu_parallel
#endif /* _GLIBCXX_PARALLEL_RANDOM_NUMBER_H */

View file

@ -84,6 +84,9 @@
#include <parallel/types.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlong-long" // LL literal
/**
* @brief Determine at compile(?)-time if the parallel variant of an
* algorithm should be called.
@ -339,4 +342,6 @@ namespace __gnu_parallel
};
}
#pragma GCC diagnostic pop
#endif /* _GLIBCXX_PARALLEL_SETTINGS_H */

View file

@ -191,8 +191,8 @@ namespace __gnu_parallel
// Cannot use volatile variable directly.
_DifferenceType __my_first = __my_job._M_first;
__result = __f(__op, __begin + __my_first);
++__my_job._M_first;
--__my_job._M_load;
__my_job._M_first += 1;
__my_job._M_load -= 1;
}
_RAIter __current;

View file

@ -84,15 +84,17 @@
#define n (
#endif
#define o (
#if __cplusplus >= 201103L
#if __cplusplus >= 201103L || defined(_GLIBCXX_PARALLEL)
// <random> defines member functions called p()
// (and <tr1/random> defines them too, which is included by Parallel Mode).
#else
#define p (
#endif
#define q (
#define r (
#if __cplusplus >= 201103L
#if __cplusplus >= 201103L || defined(_GLIBCXX_PARALLEL)
// <random> defines member functions called s() and t()
// (and <tr1/random> defines them too, which is included by Parallel Mode).
// <chrono> and <string> define operator ""s in C++14
#else
#define s (

View file

@ -1,7 +1,7 @@
// { dg-do compile { target c++11 } }
// { dg-options "-Wno-unused-variable" }
// { dg-additional-options "-D_GLIBCXX_DEBUG" { target c++17_down } }
// { dg-skip-if "cannot mix with DEBUG" { *-*-* } { "-D_GLIBCXX_PARALLEL" } }
#include <utility>
#if __cplusplus >= 202002L

View file

@ -1,7 +1,7 @@
// { dg-do compile { target c++11 } }
// { dg-options "-Wno-unused-variable" }
// { dg-additional-options "-D_GLIBCXX_DEBUG" { target c++17_down } }
// { dg-skip-if "cannot mix with DEBUG" { *-*-* } { "-D_GLIBCXX_PARALLEL" } }
#include <tuple>
#include <utility>