diff --git a/libstdc++-v3/include/debug/assertions.h b/libstdc++-v3/include/debug/assertions.h index 57c0ab2c3cf..fcc910c7396 100644 --- a/libstdc++-v3/include/debug/assertions.h +++ b/libstdc++-v3/include/debug/assertions.h @@ -43,6 +43,8 @@ # define __glibcxx_requires_non_empty_range(_First,_Last) # define __glibcxx_requires_nonempty() # define __glibcxx_requires_subscript(_N) +# define __glibcxx_requires_string(_String) +# define __glibcxx_requires_string_len(_String,_Len) #else // Verify that [_First, _Last) forms a non-empty iterator range. @@ -53,6 +55,22 @@ // Verify that the container is nonempty # define __glibcxx_requires_nonempty() \ __glibcxx_assert(!this->empty()) +# ifdef _GLIBCXX_DEBUG_PEDANTIC +# if __cplusplus < 201103L +# define __glibcxx_requires_string(_String) \ + __glibcxx_assert(_String != 0) +# define __glibcxx_requires_string_len(_String,_Len) \ + __glibcxx_assert(_String != 0 || _Len == 0) +# else +# define __glibcxx_requires_string(_String) \ + __glibcxx_assert(_String != nullptr) +# define __glibcxx_requires_string_len(_String,_Len) \ + __glibcxx_assert(_String != nullptr || _Len == 0) +# endif // C++11 +# else +# define __glibcxx_requires_string(_String) +# define __glibcxx_requires_string_len(_String,_Len) +# endif // _GLIBCXX_DEBUG_PEDANTIC #endif #ifdef _GLIBCXX_DEBUG diff --git a/libstdc++-v3/include/debug/debug.h b/libstdc++-v3/include/debug/debug.h index f4233760426..5593b4fe92c 100644 --- a/libstdc++-v3/include/debug/debug.h +++ b/libstdc++-v3/include/debug/debug.h @@ -78,8 +78,6 @@ namespace __gnu_debug # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) # define __glibcxx_requires_heap(_First,_Last) # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) -# define __glibcxx_requires_string(_String) -# define __glibcxx_requires_string_len(_String,_Len) # define __glibcxx_requires_irreflexive(_First,_Last) # define __glibcxx_requires_irreflexive2(_First,_Last) # define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) @@ -118,17 +116,6 @@ namespace __gnu_debug __glibcxx_check_heap(_First,_Last) # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \ __glibcxx_check_heap_pred(_First,_Last,_Pred) -# if __cplusplus < 201103L -# define __glibcxx_requires_string(_String) \ - _GLIBCXX_DEBUG_PEDASSERT(_String != 0) -# define __glibcxx_requires_string_len(_String,_Len) \ - _GLIBCXX_DEBUG_PEDASSERT(_String != 0 || _Len == 0) -# else -# define __glibcxx_requires_string(_String) \ - _GLIBCXX_DEBUG_PEDASSERT(_String != nullptr) -# define __glibcxx_requires_string_len(_String,_Len) \ - _GLIBCXX_DEBUG_PEDASSERT(_String != nullptr || _Len == 0) -# endif # define __glibcxx_requires_irreflexive(_First,_Last) \ __glibcxx_check_irreflexive(_First,_Last) # define __glibcxx_requires_irreflexive2(_First,_Last) \ diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/char_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/char_neg.cc index 7a7b8dd077d..6080ddc0555 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/char_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/char_neg.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // . // -// { dg-options "-std=gnu++2a -O0" } +// { dg-options "-std=gnu++2a -D_GLIBCXX_ASSERTIONS" } // { dg-do run { target c++2a xfail *-*-* } } #define _GLIBCXX_DEBUG_PEDANTIC diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/wchar_t_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/wchar_t_neg.cc index a6881bf406b..61d43558a74 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/wchar_t_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/ends_with/wchar_t_neg.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // . // -// { dg-options "-std=gnu++2a -O0" } +// { dg-options "-std=gnu++2a -D_GLIBCXX_ASSERTIONS" } // { dg-do run { target c++2a xfail *-*-* } } #define _GLIBCXX_DEBUG_PEDANTIC diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/char_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/char_neg.cc index f357aef2289..e1cc8bad525 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/char_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/char_neg.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // . // -// { dg-options "-std=gnu++2a -O0" } +// { dg-options "-std=gnu++2a -D_GLIBCXX_ASSERTIONS" } // { dg-do run { target c++2a xfail *-*-* } } #define _GLIBCXX_DEBUG_PEDANTIC diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/wchar_t_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/wchar_t_neg.cc index 90065a459b6..8fc39bbd63c 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/wchar_t_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/wchar_t_neg.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // . // -// { dg-options "-std=gnu++2a -O0" } +// { dg-options "-std=gnu++2a -D_GLIBCXX_ASSERTIONS" } // { dg-do run { target c++2a xfail *-*-* } } #define _GLIBCXX_DEBUG_PEDANTIC