From f679864c23ab3be7a1f96bdd95686cf9c903e976 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 15 May 2023 17:32:20 +0200 Subject: [PATCH] trace: C++20 compatibility With the new standard, volatile variables cannot be incremented, decremented, or modified by compound assignments (e.g., +=). Issue #4869 --- repos/base/include/base/trace/buffer.h | 2 +- repos/base/src/include/base/internal/trace_control.h | 2 +- repos/base/src/lib/base/trace_buffer.cc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/repos/base/include/base/trace/buffer.h b/repos/base/include/base/trace/buffer.h index 4ad84bb640..405b517d75 100644 --- a/repos/base/include/base/trace/buffer.h +++ b/repos/base/include/base/trace/buffer.h @@ -185,7 +185,7 @@ class Genode::Trace::Simple_buffer * the new head */ size_t *old_head_len = &_head_entry()->len; - _num_entries++; + _num_entries = _num_entries + 1; /* advance head offset, wrap when next entry does not fit into buffer */ _head_offset += sizeof(_Entry) + len; diff --git a/repos/base/src/include/base/internal/trace_control.h b/repos/base/src/include/base/internal/trace_control.h index e185d16f64..3dcd244644 100644 --- a/repos/base/src/include/base/internal/trace_control.h +++ b/repos/base/src/include/base/internal/trace_control.h @@ -145,7 +145,7 @@ class Genode::Trace::Control void trace() { - _policy_version++; + _policy_version = _policy_version + 1; enable(); } diff --git a/repos/base/src/lib/base/trace_buffer.cc b/repos/base/src/lib/base/trace_buffer.cc index 9e3badfe00..e17ad9745b 100644 --- a/repos/base/src/lib/base/trace_buffer.cc +++ b/repos/base/src/lib/base/trace_buffer.cc @@ -81,7 +81,7 @@ Trace::Simple_buffer &Trace::Partitioned_buffer::_switch_producer() * consumer may still switch partitions at this point but not continue * reading until we set the new head entry */ - _lost_entries += _producer()._num_entries; + _lost_entries = _lost_entries + _producer()._num_entries; switched = true; } } @@ -92,7 +92,7 @@ Trace::Simple_buffer &Trace::Partitioned_buffer::_switch_producer() /* XXX _wrapped only needed for testing */ if (State::Producer::get(_state) == PRIMARY) - _wrapped++; + _wrapped = _wrapped + 1; Genode::memory_barrier(); _consumer_lock = SPINLOCK_UNLOCKED;