From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Complete __gnu_debug::basic_string Standard conformity
Date: Tue, 19 Jul 2022 11:42:44 +0100 [thread overview]
Message-ID: <CACb0b4kw8byrYXe05tfN7PtG6PNZmGLW+4k7Gvv4AYF_cS0Z=A@mail.gmail.com> (raw)
In-Reply-To: <b5274b4a-5612-66eb-496b-3f966ac6c6b0@gmail.com>
On Sun, 10 Jul 2022 at 14:57, François Dumont via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Here is a first patch to complete __gnu_debug::basic_string Standard
> conformity.
>
> I prefer to submit this before checking for more missing stuff to check
> that my proposal of having a testsuite_string.h header is ok.
I think this change means some testcases will never test std::string
with _GLIBCXX_DEBUG defined, because if that is defined they test
__gnu_debug::string instead. That means assertions in
std::basic_string like this one will not get tested:
template<typename _CharT, typename _Traits, typename _Alloc>
_GLIBCXX_STRING_CONSTEXPR
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
find(const _CharT* __s, size_type __pos, size_type __n) const
_GLIBCXX_NOEXCEPT
{
__glibcxx_requires_string_len(__s, __n);
Are we OK with never testing those assertions?
Currently they don't get tested by default because of the extern
template declarations for std::string, so they would only be tested
with -std=c++20 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC, which I
don't test routinely. So I suppose this change doesn't make things any
worse in practice.
> I also noticed some problems with _GLIBCXX_DEBUG_PEDANTIC.
>
> libstdc++: Complete __gnu_debug::string Standard conformity
>
> Add testsuite/testsuite_string.h header to help testing
> __gnu_debug::basic_string like
> std::basic_string depending on _GLIBCXX_DEBUG.
>
> Add using of base type methods in __gnu_debug::basic_string to make
> use of the method
> overloads when there is no debug version.
>
> Fix _GLIBCXX_DEBUG_PEDANTIC assertions in <debug/string>. This
> header has to be used directly
> like __gnu_debug::string, it is not included by _GLIBCXX_DEBUG. It
> means that
> _GLIBCXX_DEBUG_PEDANTIC is not considered to define
> __glibcxx_check_string and
> __glibcxx_check_string_len which are then empty macros. Now those
> macros are defined
> directly in <debug/string> and properly consider
> _GLIBCXX_DEBUG_PEDANTIC.
Nice catch.
OK for trunk, thanks.
next prev parent reply other threads:[~2022-07-19 10:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-10 13:56 François Dumont
2022-07-19 10:42 ` Jonathan Wakely [this message]
2022-07-19 18:08 ` François Dumont
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACb0b4kw8byrYXe05tfN7PtG6PNZmGLW+4k7Gvv4AYF_cS0Z=A@mail.gmail.com' \
--to=jwakely@redhat.com \
--cc=frs.dumont@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).