From 1abd629461e76f11de74a2d7078dcf5a7f0c71bc Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 24 Jan 2017 07:22:54 -1000 Subject: [PATCH] Move common macros to systemlib/px4_macros.h --- src/lib/version/version.h | 4 +--- src/modules/systemlib/hardfault_log.h | 2 -- src/modules/systemlib/px4_macros.h | 17 +++++++++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/lib/version/version.h b/src/lib/version/version.h index b78376cc68..81bc12d52f 100644 --- a/src/lib/version/version.h +++ b/src/lib/version/version.h @@ -44,11 +44,9 @@ #pragma once #include +#include #include -#define FREEZE_STR(s) #s -#define STRINGIFY(s) FREEZE_STR(s) - /* The preferred method for publishing a board name is to * define it in board_config.h as BOARD_NAME */ diff --git a/src/modules/systemlib/hardfault_log.h b/src/modules/systemlib/hardfault_log.h index 334db78656..a80245a9a9 100644 --- a/src/modules/systemlib/hardfault_log.h +++ b/src/modules/systemlib/hardfault_log.h @@ -41,8 +41,6 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -#define FREEZE_STR(s) #s -#define STRINGIFY(s) FREEZE_STR(s) #define HARDFAULT_FILENO 3 #define HARDFAULT_PATH BBSRAM_PATH""STRINGIFY(HARDFAULT_FILENO) #define HARDFAULT_REBOOT_FILENO 0 diff --git a/src/modules/systemlib/px4_macros.h b/src/modules/systemlib/px4_macros.h index fc8079fea6..a6c11108e9 100644 --- a/src/modules/systemlib/px4_macros.h +++ b/src/modules/systemlib/px4_macros.h @@ -86,6 +86,14 @@ #define CAT(a, b) _CAT(a, b) #endif +#if !defined(FREEZE_STR) +# define FREEZE_STR(s) #s +#endif + +#if !defined(STRINGIFY) +#define STRINGIFY(s) FREEZE_STR(s) +#endif + #if !defined(CCASSERT) #if defined(static_assert) # define CCASSERT(predicate) static_assert(predicate) @@ -97,7 +105,12 @@ # endif #endif -#define DO_PRAGMA(x) _Pragma (#x) -#define TODO(x) DO_PRAGMA(message ("TODO - " #x)) +#if !defined(DO_PRAGMA) +# define DO_PRAGMA(x) _Pragma (#x) +#endif + +#if !defined(TODO) +# define TODO(x) DO_PRAGMA(message ("TODO - " #x)) +#endif #endif /* _PX4_MACROS_H */