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 A41743858C39 for ; Fri, 14 Jan 2022 22:41:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A41743858C39 Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-341-xqphoZcCO4W1XCCOT7KhjQ-1; Fri, 14 Jan 2022 17:41:06 -0500 X-MC-Unique: xqphoZcCO4W1XCCOT7KhjQ-1 Received: by mail-yb1-f200.google.com with SMTP id f12-20020a056902038c00b006116df1190aso20980262ybs.20 for ; Fri, 14 Jan 2022 14:41:06 -0800 (PST) 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; bh=LVfHL7JK/eBdKyKzcgN6uq2no15PCReiZKtKy5UdSd0=; b=YzK/Hb81QXrwItC5OE7so987mzntTqLuQCajA2WFp2n7E2wicf6apmfqWnunNTj6oW B5PbahuMSxMP5eW5atkYkiacCcyqFPooJbOAnMqXyouxYHiktukKtE7blTOQshYQNPHG scNJhymDJxQNxPKuAUm3e6z6VcoRDDSTDVk73FyoTUljqgXStqShiAfvsfvHiX+tehDb /+dhzvkzKgrOrVbcprRL/EmkjagiIrm+GHlVQAcDsci9CJC/TueGBlpMhYiTtKzwC2JW xuWaeoFBzbJz6/cxL8RGncYW5h+kwkXnZvGpVk7bVMUlUme4bv3etHBs94h1xsNBteOp ECSw== X-Gm-Message-State: AOAM533BxIVwaN6+MaNTl9wmMOq2uCYQFZAVbDwxwH9dR+3fh9m/m2wD /1fFHRVoTYGb9mYqfFSxxoJRGgOWaRxdktk+HJZ2VQdWHCL47AqkFom4qEe0OXWp4JXKtI6I2HG /c+XDzgEuKI6vdhxeTRcd/eKujy81FgQ= X-Received: by 2002:a25:bfcb:: with SMTP id q11mr16658509ybm.253.1642200066468; Fri, 14 Jan 2022 14:41:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgNBJD2z3Qw75eVuwDC5Zi6VSzyjL++Q4hp9Fe0xhcV4B2BJFbNIcIG/FepbYMyFd13vd4VFI4i1FMSzuXu74= X-Received: by 2002:a25:bfcb:: with SMTP id q11mr16658490ybm.253.1642200066251; Fri, 14 Jan 2022 14:41:06 -0800 (PST) MIME-Version: 1.0 References: <20210917175152.606596-1-rodgert@appliantology.com> <20210918040157.608691-1-rodgert@appliantology.com> In-Reply-To: <20210918040157.608691-1-rodgert@appliantology.com> From: Jonathan Wakely Date: Fri, 14 Jan 2022 22:40:55 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Implement C++20 atomic and atomic To: Thomas Rodgers Cc: gcc Patches , "libstdc++" , Thomas Rodgers , Thomas Rodgers X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Fri, 14 Jan 2022 22:41:10 -0000 On Sat, 18 Sept 2021 at 05:12, Thomas Rodgers wrote: > From: Thomas Rodgers > > Let's try this one instead. > > Signed-off-by: Thomas Rodgers > If you're doing DCO "Signed-off-by" commits you don't need FSF copyright notices in the new tests. I no longer put any copyright notices in the tests, because it's largely pointless. They're usually not interesting and don't do anything that anybody is going to want to steal to incorporate into non-GPL code. Your new 20_util/shared_ptr/atomic/atomic_shared_ptr.cc is non-trivial, and maybe interesting, but the two that just check feature test macros are not worth putting licence headers and copyright notices on. > libstdc++-v3/ChangeLog: > * acinclude.m4: Update ABI version. > * config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Do not match new > _Sp_locker > constructor. > (GLIBCXX_3.4.30): Export _Sp_locker::_M_wait/_M_notify and new > constructor. > * include/bits/shared_ptr_atomic.h: define > __cpp_lib_atomic_shared_ptr > feature test macro. > (_Sp_locker::_Sp_locker(const void*, bool): New constructor. > (_Sp_locker::_M_wait()), _Sp_locker::_M_notify()): New methods. > (_Sp_impl): New type. > (atomic>): New partial template specialization. > (atomic>): New partial template specialization. > * include/std/version: define __cpp_lib_atomic_shared_ptr feature > test macro. > * doc/xml/manual/abi.xml: New ABI version. > * src/c++11/Makefile.am: Compile src/c++11/shared_ptr.cc > -std=gnu++20. > * src/c++11/Makefile.in: Regenerate. > * src/c++11/shared_ptr.cc (_Sp_locker::_Sp_locker(const void*, > bool), > _Sp_locker::_M_wait(), _Sp_locker::_M_notify(): Implement. > * testsuite/20_util/shared_ptr/atomic/4.cc: New test. > * testsuite/20_util/shared_ptr/atomic/5.cc: Likewise. > * testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc: > Likewise. > * testuite/util/testsuite_abi.cc: New ABI version. > --- > libstdc++-v3/acinclude.m4 | 2 +- > libstdc++-v3/config/abi/pre/gnu.ver | 12 +- > libstdc++-v3/configure | 2 +- > libstdc++-v3/doc/xml/manual/abi.xml | 1 + > libstdc++-v3/include/bits/shared_ptr_atomic.h | 309 ++++++++++++++++++ > libstdc++-v3/include/std/version | 1 + > libstdc++-v3/src/c++11/Makefile.am | 6 + > libstdc++-v3/src/c++11/Makefile.in | 6 + > libstdc++-v3/src/c++11/shared_ptr.cc | 86 ++++- > .../testsuite/20_util/shared_ptr/atomic/4.cc | 28 ++ > .../testsuite/20_util/shared_ptr/atomic/5.cc | 28 ++ > .../shared_ptr/atomic/atomic_shared_ptr.cc | 159 +++++++++ > libstdc++-v3/testsuite/util/testsuite_abi.cc | 3 +- > 13 files changed, 637 insertions(+), 6 deletions(-) > create mode 100644 libstdc++-v3/testsuite/20_util/shared_ptr/atomic/4.cc > create mode 100644 libstdc++-v3/testsuite/20_util/shared_ptr/atomic/5.cc > create mode 100644 > libstdc++-v3/testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc > > [...] > + void > + store(value_type __r, memory_order __o = memory_order_seq_cst) > noexcept > + { _M_impl._M_store(move(__r), __o); } > Every move(x) needs to be qualified as std::move(x) to avoid ADL. > > + > +// { dg-options "-std=gnu++2a" } > +// { dg-do run { target c++2a } } > gnu++20 and c++20 has been OK for a while, there's no need to use the 2a forms. Other than that, the patch looks OK, but I have a modified version based on your patch just using atomic ops, no mutexes, which I'll post shortly.