diff mbox

Avoid #ifdef _GLIBCXX_DEBUG in regex_compiler.h

Message ID 20150907144522.GK2631@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Sept. 7, 2015, 2:45 p.m. UTC
This uses an NSDMI and the _GLIBCXX_DEBUG_ONLY macro to remove several
ugly #ifdef _GLIBCXX_DEBUG conditionals in <bits/regex_compiler.h>

Tested powerpc64le-linux, committed to trunk.
diff mbox

Patch

commit e53218fa5a7eedf76f409ab41f2e24776bb5195e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Sep 7 15:12:03 2015 +0100

    Avoid #ifdef _GLIBCXX_DEBUG in regex_compiler.h
    
    	* include/bits/regex_compiler.h (_BracketMatcher::_M_is_ready):
    	Initialize using NSDMI and set using _GLIBCXX_DEBUG_ONLY.

diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index 0cb0c04..07a9ed3 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -370,9 +370,6 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		      const _TraitsT& __traits)
       : _M_class_set(0), _M_translator(__traits), _M_traits(__traits),
       _M_is_non_matching(__is_non_matching)
-#ifdef _GLIBCXX_DEBUG
-      , _M_is_ready(false)
-#endif
       { }
 
       bool
@@ -386,9 +383,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _M_add_char(_CharT __c)
       {
 	_M_char_set.push_back(_M_translator._M_translate(__c));
-#ifdef _GLIBCXX_DEBUG
-	_M_is_ready = false;
-#endif
+	_GLIBCXX_DEBUG_ONLY(_M_is_ready = false);
       }
 
       _StringT
@@ -399,9 +394,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	if (__st.empty())
 	  __throw_regex_error(regex_constants::error_collate);
 	_M_char_set.push_back(_M_translator._M_translate(__st[0]));
-#ifdef _GLIBCXX_DEBUG
-	_M_is_ready = false;
-#endif
+	_GLIBCXX_DEBUG_ONLY(_M_is_ready = false);
 	return __st;
       }
 
@@ -415,9 +408,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	__st = _M_traits.transform_primary(__st.data(),
 					   __st.data() + __st.size());
 	_M_equiv_set.push_back(__st);
-#ifdef _GLIBCXX_DEBUG
-	_M_is_ready = false;
-#endif
+	_GLIBCXX_DEBUG_ONLY(_M_is_ready = false);
       }
 
       // __neg should be true for \D, \S and \W only.
@@ -433,9 +424,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  _M_class_set |= __mask;
 	else
 	  _M_neg_class_set.push_back(__mask);
-#ifdef _GLIBCXX_DEBUG
-	_M_is_ready = false;
-#endif
+	_GLIBCXX_DEBUG_ONLY(_M_is_ready = false);
       }
 
       void
@@ -445,9 +434,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  __throw_regex_error(regex_constants::error_range);
 	_M_range_set.push_back(make_pair(_M_translator._M_transform(__l),
 					 _M_translator._M_transform(__r)));
-#ifdef _GLIBCXX_DEBUG
-	_M_is_ready = false;
-#endif
+	_GLIBCXX_DEBUG_ONLY(_M_is_ready = false);
       }
 
       void
@@ -457,9 +444,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	auto __end = std::unique(_M_char_set.begin(), _M_char_set.end());
 	_M_char_set.erase(__end, _M_char_set.end());
 	_M_make_cache(_UseCache());
-#ifdef _GLIBCXX_DEBUG
-	_M_is_ready = true;
-#endif
+	_GLIBCXX_DEBUG_ONLY(_M_is_ready = true);
       }
 
     private:
@@ -507,7 +492,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       bool                                      _M_is_non_matching;
       _CacheT					_M_cache;
 #ifdef _GLIBCXX_DEBUG
-      bool                                      _M_is_ready;
+      bool                                      _M_is_ready = false;
 #endif
     };