__glibcxx_check_heap(_First,_Last)
# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
__glibcxx_check_heap_pred(_First,_Last,_Pred)
-# define __glibcxx_requires_string(_String) \
+# if __cplusplus < 201103L
+# define __glibcxx_requires_string(_String) \
_GLIBCXX_DEBUG_PEDASSERT(_String != 0)
-# define __glibcxx_requires_string_len(_String,_Len) \
+# 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) \
#endif
#ifdef _GLIBCXX_DEBUG_PEDANTIC
-# define __glibcxx_check_string(_String) \
+# if __cplusplus < 201103L
+# define __glibcxx_check_string(_String) \
_GLIBCXX_DEBUG_VERIFY_STR_COND_AT(_String != 0, \
__FILE__, __LINE__, \
__PRETTY_FUNCTION__);
-# define __glibcxx_check_string_len(_String,_Len) \
+# define __glibcxx_check_string_len(_String,_Len) \
_GLIBCXX_DEBUG_VERIFY_STR_COND_AT(_String != 0 || _Len == 0, \
__FILE__, __LINE__, \
__PRETTY_FUNCTION__);
+# else
+# define __glibcxx_check_string(_String) \
+ _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(_String != nullptr, \
+ __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__);
+# define __glibcxx_check_string_len(_String,_Len) \
+ _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(_String != nullptr || _Len == 0, \
+ __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__);
+# endif
#else
# define __glibcxx_check_string(_String)
# define __glibcxx_check_string_len(_String,_Len)
const char* __function __attribute__((__unused__)))
{
#ifdef _GLIBCXX_DEBUG_PEDANTIC
+# if __cplusplus < 201103L
_GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0 || __n == 0,
__file, __line, __function);
+# else
+ _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != nullptr || __n == 0,
+ __file, __line, __function);
+# endif
#endif
return __s;
}
const char* __function __attribute__((__unused__)))
{
#ifdef _GLIBCXX_DEBUG_PEDANTIC
+# if __cplusplus < 201103L
_GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0,
__file, __line, __function);
+# else
+ _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != nullptr,
+ __file, __line, __function);
+# endif
#endif
return __s;
}
// basic_string ends_with
-#include <string>
+#include <testsuite_string.h>
#include <testsuite_hooks.h>
void
const char cstr_suf2[] = ".rgb";
const std::string_view sv_suf2(".rgb");
- const std::string s_test("slugs/slimy.jpg");
+ const __gnu_test::string s_test("slugs/slimy.jpg");
const auto cstr_in_slugs = s_test.ends_with(cstr_suf);
VERIFY( cstr_in_slugs );
// { dg-options "-std=gnu++20 -Wnonnull -O0 -Wno-unused-result" }
// { dg-do compile { target c++20 } }
-#include <string>
+#include <testsuite_string.h>
void
-test01(const std::string& s)
+test01(const __gnu_test::string& s)
{
s.ends_with((const char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
s.ends_with((char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
// basic_string ends_with
-#include <string>
+#include <testsuite_string.h>
#include <testsuite_hooks.h>
void
const wchar_t cstr_suf2[] = L".rgb";
const std::wstring_view sv_suf2(L".rgb");
- const std::wstring s_test(L"slugs/slimy.jpg");
+ const __gnu_test::wstring s_test(L"slugs/slimy.jpg");
const auto cstr_in_slugs = s_test.ends_with(cstr_suf);
VERIFY( cstr_in_slugs );
// basic_string begins_with
-#include <string>
+#include <testsuite_string.h>
#include <testsuite_hooks.h>
void
const char cstr_dir2[] = "worms/";
const std::string_view sv_dir2("worms/");
- const std::string s_test("slugs/slimy.jpg");
+ const __gnu_test::string s_test("slugs/slimy.jpg");
const auto cstr_in_slugs = s_test.starts_with(cstr_dir);
VERIFY( cstr_in_slugs );
// { dg-options "-std=gnu++20 -Wnonnull -O0 -Wno-unused-result" }
// { dg-do compile { target c++20 } }
-#include <string>
+#include <testsuite_string.h>
void
-test01(const std::string& s)
+test01(const __gnu_test::string& s)
{
s.starts_with((const char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
s.starts_with((char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
// basic_string begins_with
-#include <string>
+#include <testsuite_string.h>
#include <testsuite_hooks.h>
void
const wchar_t cstr_dir2[] = L"worms/";
const std::wstring_view sv_dir2(L"worms/");
- const std::wstring s_test(L"slugs/slimy.jpg");
+ const __gnu_test::wstring s_test(L"slugs/slimy.jpg");
const auto cstr_in_slugs = s_test.starts_with(cstr_dir);
VERIFY( cstr_in_slugs );