[PATCH] Complete __gnu_test::basic_string<>::compare support
Jonathan Wakely
jwakely@redhat.com
Wed Oct 12 11:20:24 GMT 2022
On Wed, 10 Aug 2022 at 19:31, François Dumont via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> 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 ?
OK. I like the change to how debug strings are tested, thanks.
More information about the Libstdc++
mailing list