Fixes to support building in -std=c++20 mode.

* Structs with user-declared constructors are no longer considered
  aggregates, so remove the declarations when possible
* Types of both arguments to "==" must match to avoid "ambiguous
  function call" warning
* Various types of math involving enums are deprecated, so replace with
  constexprs where necessary
* ABSL_CONST_INIT must be used on definition as well as declaration
* volatile memory may no longer be read from and written to by the same
  operator, so replace e.g. "n++" with "n = n + 1"
* Replace an outdated check for no_unique_address support with
  __has_cpp_attribute
* std::result_of(f(x)) has been removed, replace with
  std::invoke_result(f, x)

Bug: chromium:1284275
Change-Id: I77b366ab1da7eb2c1e4c825b2714417c31ee5903
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261221
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Tomas Gunnarsson <tommi@google.com>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36786}
This commit is contained in:
Peter Kasting
2022-05-04 12:57:00 -07:00
committed by WebRTC LUCI CQ
parent 95897aea2f
commit 662d7f11d5
14 changed files with 48 additions and 52 deletions

View File

@ -25,7 +25,9 @@ RaceChecker::RaceChecker() {}
bool RaceChecker::Acquire() const {
const PlatformThreadRef current_thread = CurrentThreadRef();
// Set new accessing thread if this is a new use.
if (access_count_++ == 0)
const int current_access_count = access_count_;
access_count_ = access_count_ + 1;
if (current_access_count == 0)
accessing_thread_ = current_thread;
// If this is being used concurrently this check will fail for the second
// thread entering since it won't set the thread. Recursive use of checked
@ -35,7 +37,7 @@ bool RaceChecker::Acquire() const {
}
void RaceChecker::Release() const {
--access_count_;
access_count_ = access_count_ - 1;
}
namespace internal {