From patchwork Tue Dec 6 21:36:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 61612 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0E637382D3E5 for ; Tue, 6 Dec 2022 21:37:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E637382D3E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670362629; bh=cwQlDFiZTqWhngXpuIyDkP+MpE00i7AyKKrs2BPJKHI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ff1Pvq1qS2JyYxAgUqEr+Y+Z7Dtmo6NI7Pp1dhw86eyaOVOCagQB3EzIjDZ6bTcQr myGw2iZruoZKVl/N97d8qNd9mbhN3leipPgDyCi7txttIjtvIG1VXG3e4hQz5XCHW5 yUTiZwQocB+dRtbTeqTGd3VgfaD+ROK7s414ePzA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 15D7D382D3C6 for ; Tue, 6 Dec 2022 21:36:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15D7D382D3C6 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-dTdUlk66PnCbYrtdPQj3lg-1; Tue, 06 Dec 2022 16:36:34 -0500 X-MC-Unique: dTdUlk66PnCbYrtdPQj3lg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35A472999B28; Tue, 6 Dec 2022 21:36:34 +0000 (UTC) Received: from localhost (unknown [10.33.36.203]) by smtp.corp.redhat.com (Postfix) with ESMTP id D403D140EBF5; Tue, 6 Dec 2022 21:36:33 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Add nodiscard attribute to mutex try_lock functions Date: Tue, 6 Dec 2022 21:36:31 +0000 Message-Id: <20221206213631.238976-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/std_mutex.h (mutex): Add nodiscard attribute to try_lock member function. * include/bits/unique_lock.h (unique_lock): Likewise for try_lock, try_lock_until, try_lock_for member functions, and owns_lock and mutex member functions. * include/std/mutex (recursive_mutex): Likewise for try_lock member function. (timed_mutex, recursive_timed_mutex, try_lock): Likewise for try_lock, try_lock_until, try_lock_for member functions. (try_lock): Likewise for non-member function. * include/std/shared_mutex (shared_mutex): Likewise for try_lock and try_lock_shared member functions. (shared_timed_mutex): Likewise for try_lock, try_lock_for, try_lock_shared, try_lock_shared_for, try_lock_until, and try_lock_shared_until member functions. (shared_lock): Likewise for try_lock, try_lock, try_lock_for, try_lock_until, owns_lock, and mutex member functions. * testsuite/30_threads/recursive_timed_mutex/try_lock_until/clock_neg.cc: Cast discarded value expression to void. * testsuite/30_threads/shared_lock/locking/3.cc: Likewise. * testsuite/30_threads/shared_lock/locking/4.cc: Likewise. * testsuite/30_threads/shared_lock/locking/clock_neg.cc: Likewise. * testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc: Likewise. * testsuite/30_threads/try_lock/4.cc: Likewise. * testsuite/30_threads/unique_lock/cons/60497.cc: Likewise. * testsuite/30_threads/unique_lock/locking/3.cc: Likewise. * testsuite/30_threads/unique_lock/locking/clock_neg.cc: Likewise. --- libstdc++-v3/include/bits/std_mutex.h | 1 + libstdc++-v3/include/bits/unique_lock.h | 5 +++++ libstdc++-v3/include/std/mutex | 14 ++++++++++++ libstdc++-v3/include/std/shared_mutex | 22 ++++++++++++++++--- .../try_lock_until/clock_neg.cc | 4 ++-- .../30_threads/shared_lock/locking/3.cc | 2 +- .../30_threads/shared_lock/locking/4.cc | 2 +- .../shared_lock/locking/clock_neg.cc | 4 ++-- .../try_lock_until/clock_neg.cc | 4 ++-- .../timed_mutex/try_lock_until/clock_neg.cc | 4 ++-- .../testsuite/30_threads/try_lock/4.cc | 2 +- .../30_threads/unique_lock/cons/60497.cc | 2 +- .../30_threads/unique_lock/locking/3.cc | 2 +- .../unique_lock/locking/clock_neg.cc | 4 ++-- 14 files changed, 54 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/include/bits/std_mutex.h b/libstdc++-v3/include/bits/std_mutex.h index b22e0e12793..68f5fb9ed65 100644 --- a/libstdc++-v3/include/bits/std_mutex.h +++ b/libstdc++-v3/include/bits/std_mutex.h @@ -117,6 +117,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_system_error(__e); } + _GLIBCXX_NODISCARD bool try_lock() noexcept { diff --git a/libstdc++-v3/include/bits/unique_lock.h b/libstdc++-v3/include/bits/unique_lock.h index 9ed7ba25766..c6402d94e85 100644 --- a/libstdc++-v3/include/bits/unique_lock.h +++ b/libstdc++-v3/include/bits/unique_lock.h @@ -143,6 +143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } + _GLIBCXX_NODISCARD bool try_lock() { @@ -158,6 +159,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { @@ -173,6 +175,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { @@ -215,6 +218,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __ret; } + _GLIBCXX_NODISCARD bool owns_lock() const noexcept { return _M_owns; } @@ -222,6 +226,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit operator bool() const noexcept { return owns_lock(); } + _GLIBCXX_NODISCARD mutex_type* mutex() const noexcept { return _M_device; } diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index b310c15687d..aca5f91e03c 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -124,6 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_system_error(__e); } + _GLIBCXX_NODISCARD bool try_lock() noexcept { @@ -253,6 +254,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_system_error(__e); } + _GLIBCXX_NODISCARD bool try_lock() noexcept { @@ -261,11 +263,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { return _M_try_lock_for(__rtime); } template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { return _M_try_lock_until(__atime); } @@ -328,6 +332,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_system_error(__e); } + _GLIBCXX_NODISCARD bool try_lock() noexcept { @@ -336,11 +341,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { return _M_try_lock_for(__rtime); } template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { return _M_try_lock_until(__atime); } @@ -395,6 +402,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_locked = true; } + _GLIBCXX_NODISCARD bool try_lock() { @@ -406,6 +414,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { @@ -417,6 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { @@ -478,6 +488,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ++_M_count; } + _GLIBCXX_NODISCARD bool try_lock() { @@ -494,6 +505,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { @@ -510,6 +522,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { @@ -616,6 +629,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * Sequentially calls try_lock() on each argument. */ template + _GLIBCXX_NODISCARD inline int try_lock(_L1& __l1, _L2& __l2, _L3&... __l3) { diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex index cf74b32f185..7b70697f178 100644 --- a/libstdc++-v3/include/std/shared_mutex +++ b/libstdc++-v3/include/std/shared_mutex @@ -420,13 +420,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Exclusive ownership void lock() { _M_impl.lock(); } - bool try_lock() { return _M_impl.try_lock(); } + [[nodiscard]] bool try_lock() { return _M_impl.try_lock(); } void unlock() { _M_impl.unlock(); } // Shared ownership void lock_shared() { _M_impl.lock_shared(); } - bool try_lock_shared() { return _M_impl.try_lock_shared(); } + [[nodiscard]] bool try_lock_shared() { return _M_impl.try_lock_shared(); } void unlock_shared() { _M_impl.unlock_shared(); } #if _GLIBCXX_USE_PTHREAD_RWLOCK_T @@ -473,10 +473,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Exclusive ownership void lock() { _Base::lock(); } - bool try_lock() { return _Base::try_lock(); } + _GLIBCXX_NODISCARD bool try_lock() { return _Base::try_lock(); } void unlock() { _Base::unlock(); } template + _GLIBCXX_NODISCARD bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { @@ -489,10 +490,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Shared ownership void lock_shared() { _Base::lock_shared(); } + _GLIBCXX_NODISCARD bool try_lock_shared() { return _Base::try_lock_shared(); } void unlock_shared() { _Base::unlock_shared(); } template + _GLIBCXX_NODISCARD bool try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rtime) { @@ -507,6 +510,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Exclusive ownership template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point& __atime) @@ -532,6 +536,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef _GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point& __atime) @@ -558,6 +563,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { @@ -580,6 +586,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Shared ownership template + _GLIBCXX_NODISCARD bool try_lock_shared_until(const chrono::time_point& __atime) @@ -619,6 +626,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef _GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK template + _GLIBCXX_NODISCARD bool try_lock_shared_until(const chrono::time_point& __atime) @@ -645,6 +653,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif template + _GLIBCXX_NODISCARD bool try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __atime) @@ -670,6 +679,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Exclusive ownership template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { @@ -694,6 +704,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Shared ownership template + _GLIBCXX_NODISCARD bool try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time) @@ -776,6 +787,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_owns = true; } + _GLIBCXX_NODISCARD bool try_lock() { @@ -784,6 +796,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time) { @@ -792,6 +805,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template + _GLIBCXX_NODISCARD bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time) { @@ -826,10 +840,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Getters + _GLIBCXX_NODISCARD bool owns_lock() const noexcept { return _M_owns; } explicit operator bool() const noexcept { return _M_owns; } + _GLIBCXX_NODISCARD mutex_type* mutex() const noexcept { return _M_pm; } private: diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/clock_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/clock_neg.cc index 541bd19f3cf..91f2c83be0d 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/clock_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/clock_neg.cc @@ -33,7 +33,7 @@ void test01() { std::recursive_timed_mutex m; - m.try_lock_until(clok::now()); // { dg-error "here" } + (void) m.try_lock_until(clok::now()); // { dg-error "here" } } struct cloc @@ -51,7 +51,7 @@ void test02() { std::recursive_timed_mutex m; - m.try_lock_until(cloc::now()); // { dg-error "here" } + (void) m.try_lock_until(cloc::now()); // { dg-error "here" } } // { dg-error "static assertion failed" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc index c7637d21993..8ad962baec3 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc @@ -38,7 +38,7 @@ int main() try { - l.try_lock_for(std::chrono::milliseconds(100)); + (void) l.try_lock_for(std::chrono::milliseconds(100)); } catch(const std::system_error&) { diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc index 126098dfeac..96388a1689d 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc @@ -40,7 +40,7 @@ int main() try { - l.try_lock_until(t); + (void) l.try_lock_until(t); } catch(const std::system_error&) { diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/clock_neg.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/clock_neg.cc index 3a6373b5926..d6df66efb17 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/clock_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/clock_neg.cc @@ -34,7 +34,7 @@ test01() { std::shared_timed_mutex m; std::shared_lock l(m, std::defer_lock); - l.try_lock_until(clok::now()); // { dg-error "here" } + (void) l.try_lock_until(clok::now()); // { dg-error "here" } } struct cloc @@ -53,7 +53,7 @@ test02() { std::shared_timed_mutex m; std::shared_lock l(m, std::defer_lock); - l.try_lock_until(cloc::now()); // { dg-error "here" } + (void) l.try_lock_until(cloc::now()); // { dg-error "here" } } // { dg-error "static assertion failed" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc index ac401235f6c..f948101a884 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc @@ -33,7 +33,7 @@ void test01() { std::shared_timed_mutex m; - m.try_lock_until(clok::now()); // { dg-error "here" } + (void) m.try_lock_until(clok::now()); // { dg-error "here" } } struct cloc @@ -51,7 +51,7 @@ void test02() { std::shared_timed_mutex m; - m.try_lock_shared_until(cloc::now()); // { dg-error "here" } + (void) m.try_lock_shared_until(cloc::now()); // { dg-error "here" } } // { dg-error "static assertion failed" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc index 36424747b4d..71c83c514bc 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc @@ -33,7 +33,7 @@ void test01() { std::timed_mutex m; - m.try_lock_until(clok::now()); // { dg-error "here" } + (void) m.try_lock_until(clok::now()); // { dg-error "here" } } struct cloc @@ -51,7 +51,7 @@ void test02() { std::timed_mutex m; - m.try_lock_until(cloc::now()); // { dg-error "here" } + (void) m.try_lock_until(cloc::now()); // { dg-error "here" } } // { dg-error "static assertion failed" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/30_threads/try_lock/4.cc b/libstdc++-v3/testsuite/30_threads/try_lock/4.cc index cfb5a74734f..96afa55a68d 100644 --- a/libstdc++-v3/testsuite/30_threads/try_lock/4.cc +++ b/libstdc++-v3/testsuite/30_threads/try_lock/4.cc @@ -125,7 +125,7 @@ void test03() unreliable_lock::count = 0; try { - std::try_lock(l1, l2, l3); + (void) std::try_lock(l1, l2, l3); VERIFY( false ); } catch (int e) diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc index c3cb6214d63..a8a8db4318a 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/60497.cc @@ -50,5 +50,5 @@ void test02() void test03() { test_type l1, l2, l3; - std::try_lock(l1, l2, l3); + (void) std::try_lock(l1, l2, l3); } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc index 3cb787b3154..ecc5b82f1c1 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc @@ -38,7 +38,7 @@ int main() try { - l.try_lock_for(std::chrono::milliseconds(100)); + (void) l.try_lock_for(std::chrono::milliseconds(100)); } catch(const std::system_error&) { diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/clock_neg.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/clock_neg.cc index 68157f6ad26..b633e5fcc58 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/clock_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/clock_neg.cc @@ -34,7 +34,7 @@ test01() { std::timed_mutex m; std::unique_lock l(m, std::defer_lock); - l.try_lock_until(clok::now()); // { dg-error "here" } + (void) l.try_lock_until(clok::now()); // { dg-error "here" } } struct cloc @@ -53,7 +53,7 @@ test02() { std::recursive_timed_mutex m; std::unique_lock l(m, std::defer_lock); - l.try_lock_until(cloc::now()); // { dg-error "here" } + (void) l.try_lock_until(cloc::now()); // { dg-error "here" } } // { dg-error "static assertion failed" "" { target *-*-* } 0 }