aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Yeo <kwlyeo@google.com>2021-07-22 14:43:30 -0400
committerGitHub <noreply@github.com>2021-07-22 14:43:30 -0400
commite88d36aabcf301d904f035ec42f24dc50810ba7e (patch)
tree90457d5ce0b1380cc860e73bf788935651a840d9
parent247802334ab523f9dc611fed872833f43d0c9f5a (diff)
parentfe6237a65de5f3b3b1584f33eef34d9646a93dec (diff)
downloadprivate-join-and-compute-e88d36aabcf301d904f035ec42f24dc50810ba7e.tar.gz
Merge pull request #29 from efoxepstein/status-macros
Improve util/status_macros.h with ifdef guards.
-rw-r--r--util/status_macros.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/status_macros.h b/util/status_macros.h
index 005239c..9f83f54 100644
--- a/util/status_macros.h
+++ b/util/status_macros.h
@@ -24,6 +24,7 @@
// StatusOr with Status OK, and if so assigns the value to the value on the left
// hand side (lhs), otherwise returns the error status. Example:
// ASSIGN_OR_RETURN(lhs, rexpression);
+#ifndef ASSIGN_OR_RETURN
#define ASSIGN_OR_RETURN(lhs, rexpr) \
PRIVACY_BLINDERS_ASSIGN_OR_RETURN_IMPL_( \
PRIVACY_BLINDERS_STATUS_MACROS_IMPL_CONCAT_(status_or_value, __LINE__), \
@@ -35,11 +36,13 @@
if (ABSL_PREDICT_FALSE(!statusor.ok())) { \
return std::move(statusor).status(); \
} \
- lhs = std::move(statusor).value()
+ lhs = *std::move(statusor)
+#endif // ASSIGN_OR_RETURN
// Helper macro that checks if the given expression evaluates to a
// Status with Status OK. If not, returns the error status. Example:
// RETURN_IF_ERROR(expression);
+#ifndef RETURN_IF_ERROR
#define RETURN_IF_ERROR(expr) \
PRIVACY_BLINDERS_RETURN_IF_ERROR_IMPL_( \
PRIVACY_BLINDERS_STATUS_MACROS_IMPL_CONCAT_(status_value, __LINE__), \
@@ -51,6 +54,7 @@
if (ABSL_PREDICT_FALSE(!status.ok())) { \
return status; \
}
+#endif // RETURN_IF_ERROR
// Internal helper for concatenating macro values.
#define PRIVACY_BLINDERS_STATUS_MACROS_IMPL_CONCAT_INNER_(x, y) x##y