mirror of https://github.com/ARMmbed/mbed-os.git
Allow the trace output by mbed error to be conditional of NDEBUG.
This change avoid inclusion of printf and friends code in a binary when it is compiled with the macro NDEBUG enabled (this macro is usually enabled for production builds). Unlike assert, the error function will still crash/halt the execution of the application even if NDEBUG is enabled; the traces are just not outputed.pull/2715/head
parent
7669d7f8f5
commit
903afa33c4
|
@ -24,9 +24,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WEAK void error(const char* format, ...) {
|
WEAK void error(const char* format, ...) {
|
||||||
|
#ifndef NDEBUG
|
||||||
va_list arg;
|
va_list arg;
|
||||||
va_start(arg, format);
|
va_start(arg, format);
|
||||||
mbed_error_vfprintf(format, arg);
|
mbed_error_vfprintf(format, arg);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue