Fork of mbed-dev build 137, last build before FAT file system appears to be broken. Also reduced HSE timeout time in STM4XX HAL
Fork of mbed-dev by
Diff: platform/mbed_debug.h
- Revision:
- 164:289d4deac6e4
- Parent:
- 149:156823d33999
diff -r 74e0ce7f98e8 -r 289d4deac6e4 platform/mbed_debug.h --- a/platform/mbed_debug.h Fri Apr 28 14:04:18 2017 +0100 +++ b/platform/mbed_debug.h Wed May 10 12:06:41 2017 +0100 @@ -18,49 +18,49 @@ */ #ifndef MBED_DEBUG_H #define MBED_DEBUG_H -#include "device.h" +#if DEVICE_STDIO_MESSAGES +#include <stdio.h> +#include <stdarg.h> +#endif #ifdef __cplusplus extern "C" { #endif -#if DEVICE_STDIO_MESSAGES -#include <stdio.h> -#include <stdarg.h> /** Output a debug message * * @param format printf-style format string, followed by variables */ static inline void debug(const char *format, ...) { +#if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) va_list args; va_start(args, format); vfprintf(stderr, format, args); va_end(args); +#endif } + /** Conditionally output a debug message * - * NOTE: If the condition is constant false (!= 1) and the compiler optimization + * NOTE: If the condition is constant false (== 0) and the compiler optimization * level is greater than 0, then the whole function will be compiled away. * - * @param condition output only if condition is true (== 1) + * @param condition output only if condition is true (!= 0) * @param format printf-style format string, followed by variables */ static inline void debug_if(int condition, const char *format, ...) { - if (condition == 1) { +#if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) + if (condition) { va_list args; va_start(args, format); vfprintf(stderr, format, args); va_end(args); } +#endif } -#else -static inline void debug(const char *format, ...) {} -static inline void debug_if(int condition, const char *format, ...) {} - -#endif #ifdef __cplusplus }