[M94 Dev][Tizen] Fix for errors for generating ninja files
[platform/framework/web/chromium-efl.git] / base / check_example.cc
1 // Copyright (c) 2011 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.
4
5 // This file is meant for analyzing the code generated by the CHECK
6 // macros in a small executable file that's easy to disassemble.
7
8 #include <ostream>
9
10 #include "base/check_op.h"
11 #include "base/compiler_specific.h"
12
13 // An official build shouldn't generate code to print out messages for
14 // the CHECK* macros, nor should it have the strings in the
15 // executable. It is also important that the CHECK() function collapse to the
16 // same implementation as RELEASE_ASSERT(), in particular on Windows x86.
17 // Historically, the stream eating caused additional unnecessary instructions.
18 // See https://crbug.com/672699.
19
20 #define BLINK_RELEASE_ASSERT_EQUIVALENT(assertion) \
21   (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH()) : (void)0)
22
23 void DoCheck(bool b) {
24   CHECK(b) << "DoCheck " << b;
25 }
26
27 void DoBlinkReleaseAssert(bool b) {
28   BLINK_RELEASE_ASSERT_EQUIVALENT(b);
29 }
30
31 void DoCheckEq(int x, int y) {
32   CHECK_EQ(x, y);
33 }
34
35 int main(int argc, const char* argv[]) {
36   DoCheck(argc > 1);
37   DoCheckEq(argc, 1);
38   DoBlinkReleaseAssert(argc > 1);
39 }