Sounds good. I've added the changes you suggested (diff is linked below). I'll send an updated patch after your review.
https://github.com/gcc-mirror/gcc/compare/97e8cd9...pkeir:gcc:4f699d8 ________________________________________ From: Jonathan Wakely <jwak...@redhat.com> Sent: 23 May 2025 8:11 PM To: Paul Keir Cc: gcc-patches@gcc.gnu.org; libstd...@gcc.gnu.org Subject: Re: [PATCH] libstdc++: Add smart ptr owner_equals and owner_hash structs and members for P1901R2 Warning: Do not open attachments or click on links unless you trust the sender On Fri, 23 May 2025 at 18:56, Paul Keir <paul.k...@uws.ac.uk> wrote: > > This patch implements C++26 "Enabling the Use of weak_ptr as Keys in > Unordered Associative Containers", as specified in P1901R2. Splendid, thanks. I'll review this more carefully next week. Some quick comments: This should define the __cpp_lib_smart_pointer_owner_equality feature test macro. To do that you need to add a new entry in include/bits/version.def (see the comments at the top and the existing entries which should be fairly clear - I am in the middle of documenting this process). Then in the $objdir/x86_64-pc-linux-gnu/libstdc++-v3/include directory run 'make update-version' which should regenerate the bits/version.h file to include your new macro. Then in <memory> define __glibcxx_want_smart_pointer_owner_equality before including <bits/version.h>. > diff --git a/libstdc++-v3/testsuite/20_util/owner_equal/cmp.cc > b/libstdc++-v3/testsuite/20_util/owner_equal/cmp.cc > new file mode 100644 > index 00000000000..c958d9c62ea > --- /dev/null > +++ b/libstdc++-v3/testsuite/20_util/owner_equal/cmp.cc > @@ -0,0 +1,122 @@ > +// { dg-do run { target c++26 } } > +// { dg-require-effective-target hosted } > + > +// Copyright (C) 2008-2025 Free Software Foundation, Inc. I see that all the new tests have copyright dates varying from 2008 to 2017, but they're all new files (I don't think they copy anythign from existing tests, right?). So they should not have copyright dates claiming to be written in the past. They also shouldn't have copyright notices claiming to be owned by the FSF if you're contributing them under the DCO terms, because you retain your own copyright. My preference for new tests is not to bother with the copyright notice or license text at all. Nothing in those tests looks very novel or inventive, it's just repetitive, fairly mechanical testing of the API. I am sceptical whether such things are even copyrightable. So I don't both with the 20 lines of comments in each file, e.g. see testsuite/20_util/weak_ptr/atomic_weak_ptr.cc from 2022. > +// This file is part of the GNU ISO C++ Library. This library is free > +// software; you can redistribute it and/or modify it under the > +// terms of the GNU General Public License as published by the > +// Free Software Foundation; either version 3, or (at your option) > +// any later version. > + > +// This library is distributed in the hope that it will be useful, > +// but WITHOUT ANY WARRANTY; without even the implied warranty of > +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +// GNU General Public License for more details. > + > +// You should have received a copy of the GNU General Public License along > +// with this library; see the file COPYING3. If not see > +// <http://www.gnu.org/licenses/>. > + > +// 20.3.2.6 Struct owner_equal [util.smartptr.owner.equal] Please put the C++ standard version, or in this case working draft number, in these comments, e.g. // N5008 20.3.2.6 Struct owner_equal [util.smartptr.owner.equal] We didn't used to do that (as you'll see in the old tests) and it becomes pretty pointless to just have a subclause number in some unspecified document (unlike the C standard, the C++ subclause numbers change dramatically between standards). I have been trying to add "C++11" or "C++03" those comments in old tests when I touch the file for some other reason. Please consider the environment and think before you print. The University of the West of Scotland is a registered Scottish charity. Charity number SC002520. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the University of the West of Scotland. As a public body, the University of the West of Scotland may be required to make available emails as well as other written forms of information as a result of a request made under the Freedom of Information (Scotland) Act 2002.