diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /third_party/jpeg-xl/lib/jxl/base/status.h | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/base/status.h')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/base/status.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/base/status.h b/third_party/jpeg-xl/lib/jxl/base/status.h index b33bd64fc3..2e88ba68ae 100644 --- a/third_party/jpeg-xl/lib/jxl/base/status.h +++ b/third_party/jpeg-xl/lib/jxl/base/status.h @@ -16,6 +16,7 @@ #include <type_traits> #include <utility> +#include "lib/jxl/base/common.h" #include "lib/jxl/base/compiler_specific.h" #include "lib/jxl/base/sanitizer_definitions.h" @@ -442,7 +443,7 @@ class JXL_MUST_USE_RESULT StatusOr { #define JXL_ASSIGN_OR_RETURN(lhs, statusor) \ PRIVATE_JXL_ASSIGN_OR_RETURN_IMPL( \ - assign_or_return_temporary_variable##__LINE__, lhs, statusor) + JXL_JOIN(assign_or_return_temporary_variable, __LINE__), lhs, statusor) // NOLINTBEGIN(bugprone-macro-parentheses) #define PRIVATE_JXL_ASSIGN_OR_RETURN_IMPL(name, lhs, statusor) \ @@ -451,6 +452,18 @@ class JXL_MUST_USE_RESULT StatusOr { lhs = std::move(name).value(); // NOLINTEND(bugprone-macro-parentheses) +// NB: do not use outside of tests / tools!!! +#define JXL_ASSIGN_OR_DIE(lhs, statusor) \ + PRIVATE_JXL_ASSIGN_OR_DIE_IMPL( \ + JXL_JOIN(assign_or_die_temporary_variable, __LINE__), lhs, statusor) + +// NOLINTBEGIN(bugprone-macro-parentheses) +#define PRIVATE_JXL_ASSIGN_OR_DIE_IMPL(name, lhs, statusor) \ + auto name = statusor; \ + if (!name.ok()) jxl::Abort(); \ + lhs = std::move(name).value(); +// NOLINTEND(bugprone-macro-parentheses) + } // namespace jxl #endif // LIB_JXL_BASE_STATUS_H_ |