Remove some extra semicolons.
In particular, change CHECK() to be wrapped in `do { ... } while (0)`. Without
this,
if (c1)
CHECK(c2)
else
bar()
would previously have the else attached to the if inside the CHECK, so bar()
would run if (c1 && !c2) instead of if (!c1).
Bug: chromium:926235
Change-Id: I879d29c711a36ce1ec18cd256c056d24e75b169e
Reviewed-on: https://pdfium-review.googlesource.com/c/49530
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
diff --git a/third_party/base/logging.h b/third_party/base/logging.h
index 515742d..59a82a0 100644
--- a/third_party/base/logging.h
+++ b/third_party/base/logging.h
@@ -94,10 +94,12 @@
#define IMMEDIATE_CRASH() WRAPPED_TRAP_SEQUENCE()
#endif
-#define CHECK(condition) \
- if (UNLIKELY(!(condition))) { \
- IMMEDIATE_CRASH(); \
- }
+#define CHECK(condition) \
+ do { \
+ if (UNLIKELY(!(condition))) { \
+ IMMEDIATE_CRASH(); \
+ } \
+ } while (0)
// TODO(palmer): These are quick hacks to import PartitionAlloc with minimum
// hassle. Look into pulling in the real DCHECK definition. It might be more
diff --git a/third_party/base/numerics/safe_math.h b/third_party/base/numerics/safe_math.h
index f24ba02..3d13d78 100644
--- a/third_party/base/numerics/safe_math.h
+++ b/third_party/base/numerics/safe_math.h
@@ -300,7 +300,7 @@
Wrapper<L>::is_valid(lhs) && Wrapper<R>::is_valid(rhs) &&
Math::Do(Wrapper<L>::value(lhs), Wrapper<R>::value(rhs), &result);
return CheckedNumeric<T>(result, is_valid);
- };
+ }
// Assignment arithmetic operations.
template <template <typename, typename, typename> class M, typename R>
@@ -311,7 +311,7 @@
Math::Do(state_.value(), Wrapper<R>::value(rhs), &result);
*this = CheckedNumeric<T>(result, is_valid);
return *this;
- };
+ }
private:
CheckedNumericState<T> state_;