Viet-Trung Luu | d42e48a | 2015-11-03 14:54:55 -0800 | [diff] [blame] | 1 | // 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 | |
| 12 | namespace mojo { |
| 13 | namespace util { |
| 14 | namespace internal { |
| 15 | |
| 16 | void 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 | |
| 21 | void 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) |