From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A2C6E3858291 for ; Tue, 19 Jul 2022 10:42:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A2C6E3858291 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-nCtjqGqcOiq1pW1IwW8OEg-1; Tue, 19 Jul 2022 06:42:57 -0400 X-MC-Unique: nCtjqGqcOiq1pW1IwW8OEg-1 Received: by mail-ed1-f69.google.com with SMTP id z5-20020a05640235c500b0043ae18edeeeso9693444edc.5 for ; Tue, 19 Jul 2022 03:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=V4D+6vdrrzEd7dKtMKkZI4pk4AXFZRyWpuSgsbtt580=; b=OcF1l7lPAyFDA+bAviHseA0XaRZiUjSZDXh3gQiP36kdjOQ9Pcui8Io4J/K1rekxpN D1RiWxU8H8v9J2Fmo645n9aic79CQLOJJG7UkRy2n1W4mMt9rCpv/GGj7ZKsgpFkM5Wi ClX1evwKKiDkJ3nlSGca0WJfU4gRDxntgH4wqXI/36+Rs/xTctzT6qZ0XBJ4vtfL6bLk CQKeZfLhP0fbjItJWSrLNuBI76n26iv3Xo7Zg7fJUkmRaxamAOboZ8dxanfRPBy109vw +y47jKVu2xCzkkwZuRc8a4G72hs+L5UDgeXoUSwDKQeV/ciBJOHXSFOr7oL6S8glg23K Lbmg== X-Gm-Message-State: AJIora/7LbZYkuSCmLmGdNK987HLo4rtutWdq+IuY89DgDzhKQB8WU2c Cw4eW1OjQKk1+ZaXtH/KZTcC6eHPCHG66jmVioF5DTOnNq+KqBj/v890Tk3nQOjv1HFwdNiNiwf J5SJjHcr681pHUc1h2BTMNDdRQ+gFFqA= X-Received: by 2002:a05:6402:328f:b0:43a:8488:1000 with SMTP id f15-20020a056402328f00b0043a84881000mr42949871eda.105.1658227376125; Tue, 19 Jul 2022 03:42:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uWeQaXjVOodLkO96Uq6LNPR75j2+fufqkYO5rkS0B1Vt/J9F1bQ7yJBzcIvztnPey18bsyIYIWgNhJiwo6AC0= X-Received: by 2002:a05:6402:328f:b0:43a:8488:1000 with SMTP id f15-20020a056402328f00b0043a84881000mr42949852eda.105.1658227375911; Tue, 19 Jul 2022 03:42:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Tue, 19 Jul 2022 11:42:44 +0100 Message-ID: Subject: Re: [PATCH] Complete __gnu_debug::basic_string Standard conformity To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++@gcc.gnu.org" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2022 10:42:59 -0000 On Sun, 10 Jul 2022 at 14:57, Fran=C3=A7ois Dumont via Libstdc++ 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 _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=3Dc++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 . 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 and properly consider > _GLIBCXX_DEBUG_PEDANTIC. Nice catch. OK for trunk, thanks.