2 * Copyright 2006 The WebRTC Project Authors. All rights reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 // This module contains some basic debugging facilities.
12 // Originally comes from shared/commandlineflags/checks.h
14 #ifndef WEBRTC_BASE_CHECKS_H_
15 #define WEBRTC_BASE_CHECKS_H_
19 // Prints an error message to stderr and aborts execution.
20 void Fatal(const char* file, int line, const char* format, ...);
24 // Trigger a fatal error (which aborts the process and prints an error
25 // message). FATAL_ERROR_IF may seem a lot like assert, but there's a crucial
26 // difference: it's always "on". This means that it can be used to check for
27 // regular errors that could actually happen, not just programming errors that
28 // supposedly can't happen---but triggering a fatal error will kill the process
29 // in an ugly way, so it's not suitable for catching errors that might happen
31 #define FATAL_ERROR(msg) do { rtc::Fatal(__FILE__, __LINE__, msg); } while (0)
32 #define FATAL_ERROR_IF(x) do { if (x) FATAL_ERROR("check failed"); } while (0)
34 // The UNREACHABLE macro is very useful during development.
35 #define UNREACHABLE() FATAL_ERROR("unreachable code")
37 #endif // WEBRTC_BASE_CHECKS_H_