OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 #ifndef CRAZY_LINKER_DEBUG_H |
| 6 #define CRAZY_LINKER_DEBUG_H |
| 7 |
| 8 // Set CRAZY_DEBUG on the command-line to 1 to enable debugging support. |
| 9 // This really means adding traces that will be sent to both stderr |
| 10 // and the logcat during execution. |
| 11 #ifndef CRAZY_DEBUG |
| 12 #define CRAZY_DEBUG 0 |
| 13 #endif |
| 14 |
| 15 namespace crazy { |
| 16 |
| 17 #if CRAZY_DEBUG |
| 18 |
| 19 void Log(const char* fmt, ...); |
| 20 void LogErrno(const char* fmt, ...); |
| 21 |
| 22 #define LOG(...) ::crazy::Log(__VA_ARGS__) |
| 23 #define LOG_ERRNO(...) ::crazy::LogErrno(__VA_ARGS__) |
| 24 |
| 25 #else |
| 26 |
| 27 #define LOG(...) ((void)0) |
| 28 #define LOG_ERRNO(...) ((void)0) |
| 29 |
| 30 #endif |
| 31 |
| 32 // Conditional logging. |
| 33 #define LOG_IF(cond, ...) \ |
| 34 do { if ((cond)) LOG(__VA_ARGS__); } while (0) |
| 35 |
| 36 #define LOG_ERRNO_IF(cond, ...) \ |
| 37 do { if ((cond)) LOG_ERRNO(__VA_ARGS__); } while (0) |
| 38 |
| 39 } // namespace crazy |
| 40 |
| 41 #endif // CRAZY_LINKER_DEBUG_H |
OLD | NEW |