mirror of https://github.com/ARMmbed/mbed-os.git
Fix issues with __FILENAME__ macro
- Move macro definition to mbed_toolchain.h - Remove double underscores from macro which are reserved. - Fix macro for IAR until compiler flags to disable path are added again.pull/6377/head
parent
6d7576a309
commit
ab2abcb29d
|
@ -68,26 +68,18 @@ extern "C" {
|
|||
void sleep_tracker_lock(const char *const filename, int line);
|
||||
void sleep_tracker_unlock(const char *const filename, int line);
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
#define __FILENAME__ __MODULE__
|
||||
#elif defined(__GNUC__)
|
||||
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __builtin_strrchr(__FILE__, '\\') ? __builtin_strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||
#else
|
||||
#define __FILENAME__ __FILE__
|
||||
#endif
|
||||
|
||||
#define sleep_manager_lock_deep_sleep() \
|
||||
do \
|
||||
{ \
|
||||
sleep_manager_lock_deep_sleep_internal(); \
|
||||
sleep_tracker_lock(__FILENAME__, __LINE__); \
|
||||
#define sleep_manager_lock_deep_sleep() \
|
||||
do \
|
||||
{ \
|
||||
sleep_manager_lock_deep_sleep_internal(); \
|
||||
sleep_tracker_lock(MBED_FILENAME, __LINE__); \
|
||||
} while (0);
|
||||
|
||||
#define sleep_manager_unlock_deep_sleep() \
|
||||
do \
|
||||
{ \
|
||||
sleep_manager_unlock_deep_sleep_internal(); \
|
||||
sleep_tracker_unlock(__FILENAME__, __LINE__); \
|
||||
#define sleep_manager_unlock_deep_sleep() \
|
||||
do \
|
||||
{ \
|
||||
sleep_manager_unlock_deep_sleep_internal(); \
|
||||
sleep_tracker_unlock(MBED_FILENAME, __LINE__); \
|
||||
} while (0);
|
||||
|
||||
#else
|
||||
|
|
|
@ -376,13 +376,27 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// Macro containing the filename part of the value of __FILE__. Defined as
|
||||
// string literal.
|
||||
#ifndef MBED_FILENAME
|
||||
#if defined(__CC_ARM)
|
||||
#define MBED_FILENAME __MODULE__
|
||||
#elif defined(__GNUC__)
|
||||
#define MBED_FILENAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __builtin_strrchr(__FILE__, '\\') ? __builtin_strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||
#elif defined(__ICCARM__)
|
||||
#define MBED_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||
#else
|
||||
#define MBED_FILENAME __FILE__
|
||||
#endif
|
||||
#endif // #ifndef MBED_FILENAME
|
||||
|
||||
// FILEHANDLE declaration
|
||||
#if defined(TOOLCHAIN_ARM)
|
||||
#include <rt_sys.h>
|
||||
#endif
|
||||
|
||||
#ifndef FILEHANDLE
|
||||
typedef int FILEHANDLE;
|
||||
typedef int FILEHANDLE;
|
||||
#endif
|
||||
|
||||
// Backwards compatibility
|
||||
|
|
Loading…
Reference in New Issue