From af0d3df984ef481f3f90b4e40b0edf2e08aea5d6 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sat, 16 Mar 2024 16:46:49 +0800 Subject: [PATCH] feat fix GUARDED_BY --- include/sled/lang/attributes.h | 3 ++- include/sled/status_or.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/sled/lang/attributes.h b/include/sled/lang/attributes.h index 0d3158d..2702cf7 100644 --- a/include/sled/lang/attributes.h +++ b/include/sled/lang/attributes.h @@ -14,7 +14,8 @@ #if defined(GUARDED_BY) #undef GUARDED_BY #endif -#define GUARDED_BY(x) __attribute__((guarded_by(x))) + +#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) #if defined(__clang__) #define EXCLUSIVE_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) diff --git a/include/sled/status_or.h b/include/sled/status_or.h index 1b3caec..e58bfe2 100644 --- a/include/sled/status_or.h +++ b/include/sled/status_or.h @@ -96,13 +96,13 @@ public: T &&value() && { CheckHasValue(); - return **this; + return std::move(**this); } T const &&value() const && { CheckHasValue(); - return **this; + return std::move(**this); } T &value_or(T &&val) &