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 #undef CRAZY_DEBUG // TODO(simonb): Unhack me later. |
| 12 #define CRAZY_DEBUG 1 // TODO(simonb): Unhack me later. |
| 13 #ifndef CRAZY_DEBUG |
| 14 #define CRAZY_DEBUG 0 |
| 15 #endif |
| 16 |
| 17 namespace crazy { |
| 18 |
| 19 #if CRAZY_DEBUG |
| 20 |
| 21 void Log(const char* fmt, ...); |
| 22 void LogErrno(const char* fmt, ...); |
| 23 |
| 24 #define LOG(...) ::crazy::Log(__VA_ARGS__) |
| 25 #define LOG_ERRNO(...) ::crazy::LogErrno(__VA_ARGS__) |
| 26 |
| 27 #else |
| 28 |
| 29 #define LOG(...) ((void)0) |
| 30 #define LOG_ERRNO(...) ((void)0) |
| 31 |
| 32 #endif |
| 33 |
| 34 // Conditional logging. |
| 35 #define LOG_IF(cond, ...) \ |
| 36 do { \ |
| 37 if ((cond)) \ |
| 38 LOG(__VA_ARGS__); \ |
| 39 } while (0) |
| 40 |
| 41 #define LOG_ERRNO_IF(cond, ...) \ |
| 42 do { \ |
| 43 if ((cond)) \ |
| 44 LOG_ERRNO(__VA_ARGS__); \ |
| 45 } while (0) |
| 46 |
| 47 } // namespace crazy |
| 48 |
| 49 #endif // CRAZY_LINKER_DEBUG_H |
OLD | NEW |