blob: c24e4dcc5bc66da1e19416f92feef299c82795d5 [file] [log] [blame]
Viet-Trung Luud42e48a2015-11-03 14:54:55 -08001// Copyright 2015 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#include "mojo/edk/util/mutex.h"
6
7#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11
12namespace mojo {
13namespace util {
14namespace internal {
15
16void DcheckHelper(const char* file, int line, const char* condition_string) {
17 fprintf(stderr, "%s:%d: Check failed: %s\n", file, line, condition_string);
18 abort();
19}
20
21void DcheckWithErrnoHelper(const char* file,
22 int line,
23 const char* fn,
24 int error) {
25 fprintf(stderr, "%s:%d: %s: %s\n", file, line, fn, strerror(error));
26 abort();
27}
28
29} // namespace internal
30} // namespace util
31} // namespace mojo
32
33#endif // !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)