[PATCH] Complete __gnu_test::basic_string<>::compare support
François Dumont
frs.dumont@gmail.com
Wed Aug 10 18:31:17 GMT 2022
Here is another patch to complete __gnu_debug::basic_string<> Standard
conformity. This one is adding the missing compare overloads.
I also would like to propose to change how __gnu_debug::basic_string<>
is tested. I considered activating <bits/basic_string.h> checks when
_GLIBCXX_ASSERTIONS is defined but it turns out that to do so this
light-debug mode should then also consider _GLIBCXX_DEBUG_PEDANTIC. I
prefer to avoid this.
So I restored previous behavior. I'm now checking for the
_GLIBCXX_TEST_DEBUG_STRING macro to force usage of <debug/string>. This
way I am testing it using:
make check-debug CXXFLAGS=-D_GLIBCXX_TEST_DEBUG_STRING
libstdc++: Add __gnu_debug::basic_string<>::compare overloads
Rather than adding those implementations we are ading a:
using _Base::compare;
so that any compare method not implemented at __gnu_debug::basic_string
level are injected from the base class.
Also review how __gnu_debug::basic_string is tested. Now require to
define
_GLIBCXX_TEST_DEBUG_STRING when running 'make check-debug'.
libstdc++-v3/ChangeLog
* include/debug/string: Add using _Base::compare.
(__gnu_debug::basic_string<>::compare(const
basic_string<>&)): Remove.
(__gnu_debug::basic_string<>::compare(size_type, size_type,
const basic_string<>&)):
Remove.
(__gnu_debug::basic_string<>::compare(size_type, size_type,
const basic_string<>&,
size_type, size_type)): Remove.
* testsuite/util/testsuite_string.h
[_GLIBCXX_TEST_DEBUG_STRING]: Include <debug/string>.
*
testsuite/21_strings/basic_string/operations/compare/char/1.cc: Include
testsuite_string.h
and use __gnu_test::string.
*
testsuite/21_strings/basic_string/operations/compare/char/13650.cc:
Likewise.
*
testsuite/21_strings/basic_string/operations/compare/char/2.cc: Likewise.
*
testsuite/21_strings/basic_string/operations/rfind/char/1.cc: Likewise.
*
testsuite/21_strings/basic_string/operations/rfind/char/2.cc: Likewise.
*
testsuite/21_strings/basic_string/operations/rfind/char/3.cc: Likewise.
*
testsuite/21_strings/basic_string/operations/compare/wchar_t/1.cc:
Include testsuite_string.h
and use __gnu_test::wstring.
*
testsuite/21_strings/basic_string/operations/compare/wchar_t/13650.cc:
Likewise.
*
testsuite/21_strings/basic_string/operations/compare/wchar_t/2.cc: Likewise.
Tested under Linux x86_64.
Ok to commit ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_string.patch
Type: text/x-patch
Size: 11190 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20220810/4d4b0215/attachment.bin>
More information about the Libstdc++
mailing list