Commit 94e9ee3f by Abseil Team Committed by Copybara-Service

Remove static initializer from mutex.h.

PiperOrigin-RevId: 491915718
Change-Id: I7469601857b5a3506163518d29f49792f3053b34
parent e7e31f27
...@@ -2787,8 +2787,7 @@ static bool Dereference(void *arg) { ...@@ -2787,8 +2787,7 @@ static bool Dereference(void *arg) {
return *(static_cast<bool *>(arg)); return *(static_cast<bool *>(arg));
} }
Condition::Condition() = default; // null constructor, used for kTrue only ABSL_CONST_INIT const Condition Condition::kTrue;
const Condition Condition::kTrue;
Condition::Condition(bool (*func)(void *), void *arg) Condition::Condition(bool (*func)(void *), void *arg)
: eval_(&CallVoidPtrFunction), : eval_(&CallVoidPtrFunction),
......
...@@ -729,7 +729,7 @@ class Condition { ...@@ -729,7 +729,7 @@ class Condition {
: Condition(obj, static_cast<bool (T::*)() const>(&T::operator())) {} : Condition(obj, static_cast<bool (T::*)() const>(&T::operator())) {}
// A Condition that always returns `true`. // A Condition that always returns `true`.
static const Condition kTrue; ABSL_CONST_INIT static const Condition kTrue;
// Evaluates the condition. // Evaluates the condition.
bool Eval() const; bool Eval() const;
...@@ -766,10 +766,10 @@ class Condition { ...@@ -766,10 +766,10 @@ class Condition {
#endif #endif
// Function with which to evaluate callbacks and/or arguments. // Function with which to evaluate callbacks and/or arguments.
bool (*eval_)(const Condition*); bool (*eval_)(const Condition*) = nullptr;
// Either an argument for a function call or an object for a method call. // Either an argument for a function call or an object for a method call.
void *arg_; void *arg_ = nullptr;
// Various functions eval_ can point to: // Various functions eval_ can point to:
static bool CallVoidPtrFunction(const Condition*); static bool CallVoidPtrFunction(const Condition*);
...@@ -790,7 +790,8 @@ class Condition { ...@@ -790,7 +790,8 @@ class Condition {
std::memcpy(callback, callback_, sizeof(*callback)); std::memcpy(callback, callback_, sizeof(*callback));
} }
Condition(); // null constructor used only to create kTrue // Used only to create kTrue.
constexpr Condition() = default;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment