Platform: Add MBED_PRETTY_FUNCTION macro.

This macro yields a string literal of the enclosing function name.
pull/5485/head
Vincent Coubard 2017-11-14 10:07:30 +00:00
parent 3aa4bf4346
commit 5310451c8f
1 changed files with 14 additions and 0 deletions

View File

@ -330,6 +330,20 @@
#endif
#endif
/**
* Macro expanding to a string literal of the enclosing function name.
*
* The string returned takes into account language specificity and yield human
* readable content.
*
* As an example, if the macro is used within a C++ function then the string
* literal containing the function name will contain the complete signature of
* the function - including template parameters - and namespace qualifications.
*/
#ifndef MBED_PRETTY_FUNCTION
#define MBED_PRETTY_FUNCTION __PRETTY_FUNCTION__
#endif
#ifndef MBED_PRINTF
#if defined(__GNUC__) || defined(__CC_ARM)
#define MBED_PRINTF(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx, first_param_idx)))