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.133.124]) by sourceware.org (Postfix) with ESMTPS id 72C83385274B for ; Tue, 19 Jul 2022 10:43:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72C83385274B 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-636-_GFzw3vSMICFWW4LDaPgOg-1; Tue, 19 Jul 2022 06:42:57 -0400 X-MC-Unique: _GFzw3vSMICFWW4LDaPgOg-1 Received: by mail-ed1-f69.google.com with SMTP id m10-20020a056402510a00b0043a93d807ffso9676284edd.12 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=S4Xe8AWy/ZFNNSDaZvhHPe9DQ1g0elebVfAAV4OUlYVMNbJn+1W3KxH70YR7TKeNil gUrIfLoWzKwMP7zYk9OF/vQHlGiZBz7cbLkGIRo75N6qDiqRywA7NCgR53HLx9Tn6W/5 X4YQemsak2AUUFFK78hCtmQZ+BUNKTehZrmcyzV/3hlnBCmRCsVtoAF+YAE/fqE3JWVG 6137dT5d5MGV2HMkMGNRp4Jus6TpgAokBCF7n2MGH7GpyzVOKa+rOTwndhWm41O2ogPM SN2g0yBuDr4recbauzMLdcsX9AEIgj0U5/yZ4bCUUh/p2puv09Lo9peTfL9LsIPj3DsR /6AA== X-Gm-Message-State: AJIora+yZPokyZBwHzRgEAvAS46H3MWVJNSdnoRuYwOwEkqG7M/Q+WpG DbXIYGjxWVgJWSwGfWmZsy5+uiqu/PO8VcV9YLhYHEPYEjeomFj9aJOVpKA5zUx1OR2PjfmrpZi CZPCr4FYYgtp9GrWC9aiZFYMWG4X4rYwKkA== X-Received: by 2002:a05:6402:328f:b0:43a:8488:1000 with SMTP id f15-20020a056402328f00b0043a84881000mr42949876eda.105.1658227376162; 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.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2022 10:43:05 -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.