From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111025 invoked by alias); 6 Jul 2019 20:35:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 111008 invoked by uid 89); 6 Jul 2019 20:34:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=krgler, sk:__excha, simplification, powerpc64-linux X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 06 Jul 2019 20:34:57 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B69BE36883; Sat, 6 Jul 2019 20:34:55 +0000 (UTC) Received: from localhost (unknown [10.33.36.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 182F380CF; Sat, 6 Jul 2019 20:34:54 +0000 (UTC) Date: Sat, 06 Jul 2019 22:02:00 -0000 From: Jonathan Wakely To: Daniel =?iso-8859-1?Q?Kr=FCgler?= Cc: Nathan Sidwell , libstdc++ , gcc-patches List , Iain Sandoe Subject: Re: [PATCH] Fix ODR violations in code using Message-ID: <20190706203454.GZ4665@redhat.com> References: <20190621160152.GN7627@redhat.com> <20190621170816.GO7627@redhat.com> <20190621171304.GP7627@redhat.com> <20190705161325.GV4665@redhat.com> <20190705184421.GX4665@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="32u276st3Jlj2kUU" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190705184421.GX4665@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-07/txt/msg00496.txt.bz2 --32u276st3Jlj2kUU Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-length: 1044 On 05/07/19 19:44 +0100, Jonathan Wakely wrote: >On 05/07/19 20:23 +0200, Daniel Krügler wrote: >>Am Fr., 5. Juli 2019 um 18:13 Uhr schrieb Jonathan Wakely : >>> >>[..] >>>I decided against the simplification in the second patch, and >>>committed the attached one which is closer to the first patch I sent >>>(preserving the __atomic_add and __exchange_and_add functions even >>>when they just call the built-ins). >>> >>>Tested x86_64-linux, powerpc64-linux, powerpc-aix. Committed to trunk. >> >>Unrelated to the actual patch, I noticed some explicit "throw()" forms >>used as exception specifications - shouldn't these be replaced by >>either explicit "noexcept" or at least by a library macro that expands >>to one or the other? > >Yes, they should be _GLIBCXX_NOTHROW. > >>(I'm sorry, if such unrelated questions are >>considered as inappropriate for this list). > >Entirely appropriate, thanks! Here's a patch to fix that and the dumb mistake I made in __atomic_add_dispatch. I'll commit after testing finishes. --32u276st3Jlj2kUU Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-length: 1285 commit 1542776ebab8848109d125d05a548fca5efb513a Author: Jonathan Wakely Date: Sat Jul 6 21:24:51 2019 +0100 Fix recent regression in __atomic_add_dispatch * include/ext/atomicity.h (__exchange_and_add, __atomic_add): Replace throw() with _GLIBCXX_NOTHROW. (__atomic_add_dispatch): Return after performing atomic increment. diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h index 73225b3de20..333c8843e14 100644 --- a/libstdc++-v3/include/ext/atomicity.h +++ b/libstdc++-v3/include/ext/atomicity.h @@ -55,10 +55,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } #else _Atomic_word - __exchange_and_add(volatile _Atomic_word*, int) throw (); + __exchange_and_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW; void - __atomic_add(volatile _Atomic_word*, int) throw (); + __atomic_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW; #endif inline _Atomic_word @@ -92,7 +92,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { #ifdef __GTHREADS if (__gthread_active_p()) - __atomic_add(__mem, __val); + { + __atomic_add(__mem, __val); + return; + } #endif __atomic_add_single(__mem, __val); } --32u276st3Jlj2kUU--