From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 4D00C3858C52; Tue, 19 Jul 2022 18:08:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4D00C3858C52 Received: by mail-wm1-x332.google.com with SMTP id be14-20020a05600c1e8e00b003a04a458c54so9654449wmb.3; Tue, 19 Jul 2022 11:08:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=12wzxRH8EI0ly5P77KePdOoN4ZBYc3K7bVMUraPzmjU=; b=LBp76SXs8r0aZv1hY2uJDNPyp5aG1DtWD8X37rPicocLrHxxwWbr62hX024QuwypNb h7MvD7pJSBBTy97XwNJ5XKXAO3DRGvYrMCQ/MrdkdmDlECu48JWH7tgluLXMSv1FZe8j yW5FO4n6049tfIQWqfYv4bCawPVrFoNYDkHFvsICLgol98sFovXr/AkAIoiDqNGM7VUo l6GIgrgTyw2QO90q60TUod6hYdaEsQ/raBGoofKWZT58ftfwSbvrg6OTbNQ+yTbwUEcT ZW/XWrzcjGY5WD+QlGo4ONGMW42N+spJo8uyzQSz7Gb4l0MbLGp7ExO9tp+Szj0ACYNC yB3w== X-Gm-Message-State: AJIora8ZdtyW/H4vSvYyycsjjNz8NOnQiI039nKKZs0EwbuLibzvWRVL RNTC3rd8LXXAH91M0Bx9rjk= X-Google-Smtp-Source: AGRyM1tJxElpfTQZJD1cp9QhVjLTZHfZxqoGa7SF/ve2UN+OsiK2MHPqLLCj2eObjc5LO0J2AwFXOA== X-Received: by 2002:a05:600c:1908:b0:3a3:f85:702a with SMTP id j8-20020a05600c190800b003a30f85702amr470801wmq.157.1658254098887; Tue, 19 Jul 2022 11:08:18 -0700 (PDT) Received: from ?IPV6:2a01:e0a:1dc:b1c0:90de:d384:431:aa6a? ([2a01:e0a:1dc:b1c0:90de:d384:431:aa6a]) by smtp.googlemail.com with ESMTPSA id j9-20020a05600c190900b003a2fde6ef62sm21498481wmq.7.2022.07.19.11.08.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jul 2022 11:08:18 -0700 (PDT) Message-ID: <8af722ad-f99b-d7d4-d28d-cc5e9bbc6776@gmail.com> Date: Tue, 19 Jul 2022 20:08:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] Complete __gnu_debug::basic_string Standard conformity Content-Language: fr To: Jonathan Wakely Cc: "libstdc++@gcc.gnu.org" , gcc-patches References: From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 18:08:22 -0000 On 19/07/22 12:42, Jonathan Wakely wrote: > On Sun, 10 Jul 2022 at 14:57, François 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=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. Good point, I'll try to activate those asserts with just _GLIBCXX_ASSERTIONS so that we will still be able to test despite my change. >> 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. Yes, I forgot to signal that before this patch some tests were XFAIL in segfault rather than with the proper _GLIBCXX_DEBUG_PEDANTIC assertion. > > OK for trunk, thanks. > Ok, committed.