Add -D_GLIBCXX_ASSERTIONS to DEBUG_FLAGS

Message ID 20180801195324.GA25780@redhat.com
State New
Headers show
Series
  • Add -D_GLIBCXX_ASSERTIONS to DEBUG_FLAGS
Related show

Commit Message

Jonathan Wakely Aug. 1, 2018, 7:53 p.m.
Enable assertions in the extra debug library built when
--enable-libstdcxx-debug is used. Replace some Debug Mode assertions
in src/c++11/futex.cc with __glibcxx_assert, because the library will
never be built with Debug Mode.

	* configure: Regenerate.
	* configure.ac: Add -D_GLIBCXX_ASSERTIONS to default DEBUG_FLAGS.
	* src/c++11/futex.cc: Use __glibcxx_assert instead of
	_GLIBCXX_DEBUG_ASSERT.

Tested powerpc64le-linux, committed to trunk.
commit 1af9b89d2b7c7feefae208ad4ebbb4cafe9f3ce4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Aug 1 18:28:06 2018 +0100

    Add -D_GLIBCXX_ASSERTIONS to DEBUG_FLAGS
    
    Enable assertions in the extra debug library built when
    --enable-libstdcxx-debug is used. Replace some Debug Mode assertions
    in src/c++11/futex.cc with __glibcxx_assert, because the library will
    never be built with Debug Mode.
    
            * configure: Regenerate.
            * configure.ac: Add -D_GLIBCXX_ASSERTIONS to default DEBUG_FLAGS.
            * src/c++11/futex.cc: Use __glibcxx_assert instead of
            _GLIBCXX_DEBUG_ASSERT.

Patch

diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 1e0a33fb3ea..332af3706d3 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -168,7 +168,7 @@  GLIBCXX_ENABLE_LONG_LONG([yes])
 GLIBCXX_ENABLE_WCHAR_T([yes])
 GLIBCXX_ENABLE_C99([yes])
 GLIBCXX_ENABLE_CONCEPT_CHECKS([no])
-GLIBCXX_ENABLE_DEBUG_FLAGS(["-gdwarf-4 -g3 -O0"])
+GLIBCXX_ENABLE_DEBUG_FLAGS(["-gdwarf-4 -g3 -O0 -D_GLIBCXX_ASSERTIONS"])
 GLIBCXX_ENABLE_DEBUG([no])
 GLIBCXX_ENABLE_PARALLEL([yes])
 GLIBCXX_ENABLE_CXX_FLAGS
diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index 278a5a80902..a5a8ec68c53 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -53,7 +53,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	// here on errors is abort.
 	int ret __attribute__((unused));
 	ret = syscall (SYS_futex, __addr, futex_wait_op, __val, nullptr);
-	_GLIBCXX_DEBUG_ASSERT(ret == 0 || errno == EINTR || errno == EAGAIN);
+	__glibcxx_assert(ret == 0 || errno == EINTR || errno == EAGAIN);
 	return true;
       }
     else
@@ -75,8 +75,8 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 	if (syscall (SYS_futex, __addr, futex_wait_op, __val, &rt) == -1)
 	  {
-	    _GLIBCXX_DEBUG_ASSERT(errno == EINTR || errno == EAGAIN
-				  || errno == ETIMEDOUT);
+	    __glibcxx_assert(errno == EINTR || errno == EAGAIN
+			     || errno == ETIMEDOUT);
 	    if (errno == ETIMEDOUT)
 	      return false;
 	  }