From 6dd0a52561096a6314e5bdde3b02684ca24fdd08 Mon Sep 17 00:00:00 2001 From: Wiktor Garbacz Date: Fri, 8 Jan 2021 02:09:09 -0800 Subject: [PATCH] Use unique var name in SAPI_RETURN_IF_ERROR to avoid name clashes PiperOrigin-RevId: 350724380 Change-Id: I07c11b1897043df188bbef7934b5a41185a82a79 --- sandboxed_api/util/status_macros.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sandboxed_api/util/status_macros.h b/sandboxed_api/util/status_macros.h index d22215b..7a5bed2 100644 --- a/sandboxed_api/util/status_macros.h +++ b/sandboxed_api/util/status_macros.h @@ -25,12 +25,16 @@ #define SAPI_MACROS_IMPL_CONCAT_INNER_(x, y) x##y #define SAPI_MACROS_IMPL_CONCAT(x, y) SAPI_MACROS_IMPL_CONCAT_INNER_(x, y) -#define SAPI_RETURN_IF_ERROR(expr) \ - do { \ - const auto status = (expr); \ - if (ABSL_PREDICT_FALSE(!status.ok())) { \ - return status; \ - } \ +#define SAPI_RETURN_IF_ERROR(expr) \ + SAPI_RETURN_IF_ERROR_IMPL(SAPI_MACROS_IMPL_CONCAT(_sapi_status, __LINE__), \ + expr) + +#define SAPI_RETURN_IF_ERROR_IMPL(status, expr) \ + do { \ + const auto status = (expr); \ + if (ABSL_PREDICT_FALSE(!status.ok())) { \ + return status; \ + } \ } while (0); #define SAPI_ASSIGN_OR_RETURN(lhs, rexpr) \