From f8b635b0c6ecd29a5eb55e970f75c04a4df95ef4 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 9 Dec 2025 17:55:12 +1030 Subject: [PATCH] gold testsuite volatile fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Avoid these mainline gcc complaints (C23 WG14 n2743). copy_test_relro.cc:42:5: error: ‘++’ expression of ‘volatile’-qualified type is deprecated [-Werror=volatile] icf_test_pr21066.cc:50:55: error: ‘volatile’-qualified parameter is deprecated [-Werror=volatile] * testsuite/copy_test_relro.cc (segv): Avoid gcc warning. * testsuite/icf_test_pr21066.cc (capture_exception_of_type): Likewise. --- gold/testsuite/copy_test_relro.cc | 2 +- gold/testsuite/icf_test_pr21066.cc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gold/testsuite/copy_test_relro.cc b/gold/testsuite/copy_test_relro.cc index c2a734d29bb..6cc1d350979 100644 --- a/gold/testsuite/copy_test_relro.cc +++ b/gold/testsuite/copy_test_relro.cc @@ -39,7 +39,7 @@ sigjmp_buf jmp; void segv(int) { - ++segfaults; + segfaults = segfaults + 1; siglongjmp(jmp, 1); } diff --git a/gold/testsuite/icf_test_pr21066.cc b/gold/testsuite/icf_test_pr21066.cc index 2b6c4da0ef0..33e52780f82 100644 --- a/gold/testsuite/icf_test_pr21066.cc +++ b/gold/testsuite/icf_test_pr21066.cc @@ -47,10 +47,11 @@ void raise_second_exception() } template -void capture_exception_of_type(volatile callback_fn_t f) +void capture_exception_of_type(callback_fn_t f) { + volatile callback_fn_t vf = f; try { - f(); + vf(); } catch (E& e) { puts("caught expected exception"); } catch (...) { -- 2.47.3