0
Files
src/base/check_example.cc
Findit c025a5e3ee Revert "Include base/immediate_crash.h in base/check.h conditionally."
This reverts commit ac9e9ebd9b.

Reason for revert:
Findit (https://goo.gl/kROfz5) identified this CL at revision ac9e9ebd9b as
the culprit for failures in the continuous build including:

Sample Failed Build: https://ci.chromium.org/b/8825004509580194353
Sample Failed Step: compile

If it is a false positive, please report it at https://bugs.chromium.org/p/chromium/issues/entry?status=Available&comment=Datastore+key+for+the+culprit+entity%3A+chromium.googlesource.com%2Fchromium%2Fsrc%2Frefs%2Fheads%2Fmain%2Fac9e9ebd9b5f9364241f10218bfe9a35be099481&labels=Test-Findit-Wrong&components=Tools%3ETest%3EFindIt&summary=Wrongly+blame+ac9e9ebd9b5f9364241f10218bfe9a35be099481

Original change's description:
> Include base/immediate_crash.h in base/check.h conditionally.
> 
> Only include it in official builds, where it is needed. Then do IWYU to
> fix the build.
> 
> Change-Id: I4988f60690dd3100ad5ca5320bba1006f580fa58
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3373870
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Commit-Queue: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#959518}


Change-Id: I5bd868367ca2fdfa149a522303b6877d0ee22541
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3391102
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#959522}
2022-01-15 03:51:25 +00:00

40 lines
1.2 KiB
C++

// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is meant for analyzing the code generated by the CHECK
// macros in a small executable file that's easy to disassemble.
#include <ostream>
#include "base/check_op.h"
#include "base/compiler_specific.h"
// An official build shouldn't generate code to print out messages for
// the CHECK* macros, nor should it have the strings in the
// executable. It is also important that the CHECK() function collapse to the
// same implementation as RELEASE_ASSERT(), in particular on Windows x86.
// Historically, the stream eating caused additional unnecessary instructions.
// See https://crbug.com/672699.
#define BLINK_RELEASE_ASSERT_EQUIVALENT(assertion) \
(UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH()) : (void)0)
void DoCheck(bool b) {
CHECK(b) << "DoCheck " << b;
}
void DoBlinkReleaseAssert(bool b) {
BLINK_RELEASE_ASSERT_EQUIVALENT(b);
}
void DoCheckEq(int x, int y) {
CHECK_EQ(x, y);
}
int main(int argc, const char* argv[]) {
DoCheck(argc > 1);
DoCheckEq(argc, 1);
DoBlinkReleaseAssert(argc > 1);
}