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 9CE213858D38 for ; Mon, 23 Jan 2023 09:22:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9CE213858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674465778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SXFHfnufzbv8+iwyhmvwgg5JtTw+ybwmG5cBKg2B34I=; b=IHPMM/Q9FxTDB65Ew5jTULgabgr57bdhI58Mj3AeJmBeo4qs7yHSAu12Kml+L/NrUspGfA u19vGOevfXe3jOOAQwTfc0r9JcvpqyeeunoKvRLcX98r8P48Z3ZjcqUi30kB4zffE/ZdI9 liliXKF/hKLS5xfPYh2Wph3W/VlpySo= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-265-Po95rAIVOvSWE-vyY4pnNw-1; Mon, 23 Jan 2023 04:22:56 -0500 X-MC-Unique: Po95rAIVOvSWE-vyY4pnNw-1 Received: by mail-lf1-f72.google.com with SMTP id f17-20020ac25091000000b004b565e69540so4778571lfm.12 for ; Mon, 23 Jan 2023 01:22:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SXFHfnufzbv8+iwyhmvwgg5JtTw+ybwmG5cBKg2B34I=; b=jU9pX64T1L5WpirL/7YrjAk88wtDsg7cxEMyQqPz8pb2kgEIKWsxZX58hHoNV8+LRA ZoAOG8fhImqaA/StBymbL8XWtDtL3l/Kr179nonB/QCjcNQgyxQz5s+g2IVOnf2pJnxD HKJI0+liizjt/yQbThVWxtU5xKglgkjyi19DPUruC8+/sVkZiZENsPVxt1Pi1ZBpnnQC obNJ+8e9KG9s5LmteM9GYX90hmk43yC3fUEkr6EnCX3mb/i/tX1iuOFj57MX/LHiAxWr 8G4bjf6IwALUcinZ3qpFA70GDPL6ZuxZhpNSaivZ/J7wHujXcg6IdHbnwDYeMk+Q6Wwn n1Ug== X-Gm-Message-State: AFqh2kphJHESKh/jJ6Wqg/rXFGHi3/j1L0F7rwHxLIYYBhGsl0RP3Eej EVAku0KLIVYFpcLonSDkt3Bfscy73fKrxBA+4Ed0z0v3SWJUDReODgIT0PlDyp1NwmBvYfn7X7p 3tNZFCimLw7lmNljo4qiTmSM52mGjyUw= X-Received: by 2002:ac2:558d:0:b0:4b5:828b:3fa4 with SMTP id v13-20020ac2558d000000b004b5828b3fa4mr1127736lfg.460.1674465775164; Mon, 23 Jan 2023 01:22:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwu4uE02baTXRKenHAv2EV1zrI5qqlnNwxAKSYTbhIaXxj/hC5ipXPAspfaBFIkN8Hr7Ts/8xn118ZodZBFa0= X-Received: by 2002:ac2:558d:0:b0:4b5:828b:3fa4 with SMTP id v13-20020ac2558d000000b004b5828b3fa4mr1127731lfg.460.1674465774777; Mon, 23 Jan 2023 01:22:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 23 Jan 2023 09:22:43 +0000 Message-ID: Subject: Re: [PATCH][_GLIBCXX_DEBUG] Remove useless checks 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=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 List-Id: On Mon, 23 Jan 2023 at 06:02, Fran=C3=A7ois 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.