From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 389723858D32; Mon, 23 Jan 2023 18:15:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 389723858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id az20so32887951ejc.1; Mon, 23 Jan 2023 10:15:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=OAGnQAgonVwihAj0tuPOvuiTuRLgq8/LYwi94lWzHuc=; b=qzjlTa6uDETFZXZlMVVb9MdMGg+fmWcjWDT1Ut6o0ccQhBTCxtQKAGzS/fDs7vyyHD mcJOExaHVcf+rklCFeXewLaUYyr0iaF72gtKldc21KrcL1FXL3D5eRIjlL/kSKxkDj2J pojy3oFlzWY3c+OFK5W/T5aGuBOzrJvrqWgbwqAF1pqulSL8ixdGI191eqpL9OCGRlKd 5cNJVSYU4lG15JRqNTKkng3A+W+lVwQyVF0N/whlo3cmkmtl5yD/SSETHV8ZZHZu4tNg xHmtMtWvYZEFa1bHYblvda2CgFdI+xGTGBXssUDqCgta/w9pLi8qhrR2pun/tuC58SdZ pLAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OAGnQAgonVwihAj0tuPOvuiTuRLgq8/LYwi94lWzHuc=; b=oMAcx4ksnoYzSkCEQ0MF/kfxfXOaKvWVe0sn0g4Hdlsj+d3MgUGQzsPY30YjRot+hN 2Pxk8unqx2GHn1LQLYwtp2JEpwjAKcpIuznb4LtbuIOmiHDfCmQ4FkuDRW21kMJC/5ld sPpirvFcb7ikiSHwVdNdupIGubIegYazf7R1oSZ1Z78bURxRe5BsyBrGKqOo/6UImCyO Y5fRjQdbcK3HUzolH0o4TZ51RajcOarNdVcypbznLokKF4TWbmod80mrWDEJXPzYtSGt QgoW5pWExlt5tczRGHP6R54MWAR+syywHU6BGJttOW2TdBj4H3U6Wc7Rd1WFT6wS0Emv +faQ== X-Gm-Message-State: AFqh2kogFMoyldWJv8DC0090TbZoiP+yy5ChlfYyolCXio6ds6dK0cBs /5dmhWqtihaRJN0nApd+BN0= X-Google-Smtp-Source: AMrXdXtMbchlyxU4oMUxCy70E5YYJ6rpm+FQqOM7VifgyyvMQf0dNRo2zSvLD/6lxMnfcTP/W6DbXw== X-Received: by 2002:a17:907:76b3:b0:7c1:6fe:f4a2 with SMTP id jw19-20020a17090776b300b007c106fef4a2mr24558248ejc.45.1674497731921; Mon, 23 Jan 2023 10:15:31 -0800 (PST) Received: from [10.10.0.56] ([109.190.253.14]) by smtp.googlemail.com with ESMTPSA id lb24-20020a170907785800b008448d273670sm22240798ejc.49.2023.01.23.10.15.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Jan 2023 10:15:31 -0800 (PST) Message-ID: <290812af-847c-c6dd-3a56-fc51fc839dd3@gmail.com> Date: Mon, 23 Jan 2023 19:15:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH][_GLIBCXX_DEBUG] Remove useless checks To: Jonathan Wakely Cc: "libstdc++@gcc.gnu.org" , gcc-patches References: Content-Language: fr 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=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 23/01/23 10:22, Jonathan Wakely wrote: > On Mon, 23 Jan 2023 at 06:02, François Dumont via Libstdc++ > wrote: >> libstdc++: [_GLIBCXX_DEBUG] Remove useless constructor checks >> >> Creating a safe iterator from a normal iterator is done within the >> library where we >> already know that it is done correctly. The rare situation where a >> user would use safe >> iterators for his own purpose is non-Standard code so outside >> _GLIBCXX_DEBUG scope. For >> those reasons the __msg_init_singular is useless and can be removed. >> >> Additionally in the copy constructor used for post-increment and >> post-decrement operators >> the __msg_init_copy_singular check can also be ommitted because of >> the preliminary >> __msg_bad_inc and __msg_bad_dec checks. >> >> libstdc++-v3/ChangeLog: >> >> * include/debug/safe_iterator.h >> (_Safe_iterator<>::_Unsafe_call): New. > I don't like the name "unsafe call". Why is it unsafe? As you say > above, we don't need to check because we know that it's only called in > a context where it's safe. Can we call it _Unchecked instead of > _Unsafe_call? That seems like a more accurate description of the > behaviour. > > >> (_Safe_iterator(const _Safe_iterator&, _Unsafe_call): New. >> (_Safe_iterator::operator++(int)): Use latter. >> (_Safe_iterator::operator--(int)): Likewise. >> (_Safe_iterator(_Iterator, const _Safe_sequence_base*)): >> Remove !_M_insular() >> check. >> * include/debug/safe_local_iterator.h >> (_Safe_local_iterator<>::_Unsafe_call): >> New. >> (_Safe_local_iterator(const _Safe_local_iterator&, >> _Unsafe_call): New. >> (_Safe_local_iterator::operator++(int)): Use latter. >> * src/c++11/debug.cc (_S_debug_messages): Add as comment >> the _Debug_msg_id >> entry associated to the array entry. > These comments are a great idea, thanks. > > If you agree with the _Unchecked name, OK to commit with that change. > It's unsafe because it's unchecked so _Unchecked is fine for me too :-) Committed with the requested change. Thanks