mirror of git://gcc.gnu.org/git/gcc.git
PR71856 try to fix Parallel Mode assertions again
PR libstdc++/71856 * doc/xml/manual/using.xml: Document macro. * include/bits/c++config [_GLIBCXX_DEBUG || _GLIBCXX_PARALLEL] (__glibcxx_assert): Rename to __glibcxx_assert_impl. [_GLIBCXX_DEBUG] (__glibcxx_assert): Expand to __glibcxx_assert_impl. * include/parallel/base.h [_GLIBCXX_PARALLEL_ASSERTIONS] (_GLIBCXX_PARALLEL_ASSERT): Expand to __glibcxx_assert_impl. [!_GLIBCXX_PARALLEL_ASSERTIONS] (_GLIBCXX_PARALLEL_ASSERT): Define as empty. * testsuite/25_algorithms/headers/algorithm/ parallel_algorithm_assert2.cc: New test. From-SVN: r243434
This commit is contained in:
parent
66110738f0
commit
eae0b895e0
|
|
@ -1,3 +1,17 @@
|
||||||
|
2016-12-08 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/71856
|
||||||
|
* doc/xml/manual/using.xml: Document macro.
|
||||||
|
* include/bits/c++config [_GLIBCXX_DEBUG || _GLIBCXX_PARALLEL]
|
||||||
|
(__glibcxx_assert): Rename to __glibcxx_assert_impl.
|
||||||
|
[_GLIBCXX_DEBUG] (__glibcxx_assert): Expand to __glibcxx_assert_impl.
|
||||||
|
* include/parallel/base.h [_GLIBCXX_PARALLEL_ASSERTIONS]
|
||||||
|
(_GLIBCXX_PARALLEL_ASSERT): Expand to __glibcxx_assert_impl.
|
||||||
|
[!_GLIBCXX_PARALLEL_ASSERTIONS] (_GLIBCXX_PARALLEL_ASSERT): Define as
|
||||||
|
empty.
|
||||||
|
* testsuite/25_algorithms/headers/algorithm/
|
||||||
|
parallel_algorithm_assert2.cc: New test.
|
||||||
|
|
||||||
2016-12-08 Jakub Jelinek <jakub@redhat.com>
|
2016-12-08 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* testsuite/util/testsuite_new_operators.h: Include testsuite_hooks.h.
|
* testsuite/util/testsuite_new_operators.h: Include testsuite_hooks.h.
|
||||||
|
|
|
||||||
|
|
@ -948,6 +948,15 @@ g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe
|
||||||
mode</link>.
|
mode</link>.
|
||||||
</para>
|
</para>
|
||||||
</listitem></varlistentry>
|
</listitem></varlistentry>
|
||||||
|
<varlistentry><term><code>_GLIBCXX_PARALLEL_ASSERTIONS</code></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Undefined by default, but when any parallel mode header is included
|
||||||
|
this macro will be defined to a non-zero value if
|
||||||
|
<code>_GLIBCXX_ASSERTIONS</code> has a non-zero value, otherwise to zero.
|
||||||
|
When defined to a non-zero value, it enables extra error checking and
|
||||||
|
assertions in the parallel mode.
|
||||||
|
</para>
|
||||||
|
</listitem></varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><code>_GLIBCXX_PROFILE</code></term>
|
<varlistentry><term><code>_GLIBCXX_PROFILE</code></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
|
||||||
|
|
@ -434,9 +434,8 @@ namespace std
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Assert.
|
// Assert.
|
||||||
#if !defined(_GLIBCXX_ASSERTIONS) && !defined(_GLIBCXX_PARALLEL)
|
#if defined(_GLIBCXX_ASSERTIONS) \
|
||||||
# define __glibcxx_assert(_Condition)
|
|| defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PARALLEL_ASSERTIONS)
|
||||||
#else
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
// Avoid the use of assert, because we're trying to keep the <cassert>
|
// Avoid the use of assert, because we're trying to keep the <cassert>
|
||||||
|
|
@ -450,7 +449,7 @@ namespace std
|
||||||
__builtin_abort();
|
__builtin_abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define __glibcxx_assert(_Condition) \
|
#define __glibcxx_assert_impl(_Condition) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (! (_Condition)) \
|
if (! (_Condition)) \
|
||||||
|
|
@ -459,6 +458,12 @@ namespace std
|
||||||
} while (false)
|
} while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_GLIBCXX_ASSERTIONS)
|
||||||
|
# define __glibcxx_assert(_Condition) __glibcxx_assert_impl(_Condition)
|
||||||
|
#else
|
||||||
|
# define __glibcxx_assert(_Condition)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Macros for race detectors.
|
// Macros for race detectors.
|
||||||
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
|
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
|
||||||
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
|
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,11 @@ namespace __gnu_parallel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _GLIBCXX_PARALLEL_ASSERT(_Condition) __glibcxx_assert(_Condition)
|
#if _GLIBCXX_PARALLEL_ASSERTIONS && defined(__glibcxx_assert_impl)
|
||||||
|
#define _GLIBCXX_PARALLEL_ASSERT(_Condition) __glibcxx_assert_impl(_Condition)
|
||||||
|
#else
|
||||||
|
#define _GLIBCXX_PARALLEL_ASSERT(_Condition)
|
||||||
|
#endif
|
||||||
|
|
||||||
} //namespace __gnu_parallel
|
} //namespace __gnu_parallel
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
// { dg-require-parallel-mode "" }
|
||||||
|
// { dg-options "-fopenmp -D_GLIBCXX_PARALLEL" { target *-*-* } }
|
||||||
|
// { dg-do run }
|
||||||
|
|
||||||
|
// Copyright (C) 2016 Free Software Foundation, Inc.
|
||||||
|
//
|
||||||
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 3, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING3. If not see
|
||||||
|
// <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#undef _GLIBCXX_DEBUG
|
||||||
|
#undef _GLIBCXX_ASSERTIONS
|
||||||
|
#undef _GLIBCXX_PARALLEL_ASSERTIONS
|
||||||
|
#define _GLIBCXX_PARALLEL_ASSERTIONS 1
|
||||||
|
#include <parallel/algorithm>
|
||||||
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
test01()
|
||||||
|
{
|
||||||
|
// This should not be enabled without _GLIBCXX_ASSERTIONS:
|
||||||
|
__glibcxx_assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test02()
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
// This should be enabled by _GLIBCXX_PARALLEL_ASSERTIONS:
|
||||||
|
_GLIBCXX_PARALLEL_ASSERT(result = true);
|
||||||
|
VERIFY(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
test01();
|
||||||
|
test02();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue