1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Macros specific to the RLZ library.
7 #ifndef RLZ_LIB_ASSERT_H_
8 #define RLZ_LIB_ASSERT_H_
11 #include "base/logging.h"
13 // An assertion macro.
14 // Can mute expected assertions in debug mode.
17 #ifndef MUTE_EXPECTED_ASSERTS
18 #define ASSERT_STRING(expr) LOG_IF(FATAL, false) << (expr)
20 #define ASSERT_STRING(expr) \
22 std::string expr_string(expr); \
23 if (rlz_lib::expected_assertion_ != expr_string) { \
24 LOG_IF(FATAL, false) << (expr); \
33 #define VERIFY(expr) LOG_IF(FATAL, !(expr)) << #expr
35 #define VERIFY(expr) (void)(expr)
41 #ifdef MUTE_EXPECTED_ASSERTS
42 extern std::string expected_assertion_
;
45 inline void SetExpectedAssertion(const char* s
) {
46 #ifdef MUTE_EXPECTED_ASSERTS
47 expected_assertion_
= s
;
53 #endif // RLZ_LIB_ASSERT_H_