2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2018 Google LLC. All rights reserved.
|
2018-03-21 18:03:54 +00:00
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
2023-10-14 16:36:01 +00:00
|
|
|
#ifndef PACKAGER_MACROS_STATUS_H_
|
|
|
|
#define PACKAGER_MACROS_STATUS_H_
|
2018-03-21 18:03:54 +00:00
|
|
|
|
2023-10-14 16:36:01 +00:00
|
|
|
#include <packager/status.h>
|
2018-03-21 18:03:54 +00:00
|
|
|
|
|
|
|
// Evaluates an expression that produces a `Status`. If the status is not
|
|
|
|
// ok, returns it from the current function.
|
|
|
|
#define RETURN_IF_ERROR(expr) \
|
|
|
|
do { \
|
|
|
|
/* Using _status below to avoid capture problems if expr is "status". */ \
|
|
|
|
shaka::Status _status = (expr); \
|
|
|
|
if (!_status.ok()) \
|
|
|
|
return _status; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
// TODO(kqyang): Support build Status and update Status message through "<<".
|
|
|
|
|
2023-10-14 16:36:01 +00:00
|
|
|
#endif // PACKAGER_MACROS_STATUS_H_
|