From 727b8fa2fac766ad923e7e2e09ba9116dd95f17a Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Tue, 15 May 2018 15:45:13 -0700 Subject: [PATCH] [debug] allow build system to provide custom file name (#2706) --- src/core/common/debug.hpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/core/common/debug.hpp b/src/core/common/debug.hpp index 13f0aa4da..5b8be715e 100644 --- a/src/core/common/debug.hpp +++ b/src/core/common/debug.hpp @@ -58,16 +58,24 @@ #include "openthread/platform/misc.h" -#define assert(cond) \ - do \ - { \ - if (!(cond)) \ - { \ - otPlatAssertFail(__FILE__, __LINE__); \ - while (1) \ - { \ - } \ - } \ +/** + * Allow the build system to provide a custom file name. + * + */ +#ifndef FILE_NAME +#define FILE_NAME __FILE__ +#endif + +#define assert(cond) \ + do \ + { \ + if (!(cond)) \ + { \ + otPlatAssertFail(FILE_NAME, __LINE__); \ + while (1) \ + { \ + } \ + } \ } while (0) #else