Skip to content

Commit e9880c7

Browse files
authored
Merge pull request #3830 from ARMmbed/dummy_definitions
Add NS_DUMMY_DEFINITIONS_OK
2 parents b6fe5ab + 9137ba8 commit e9880c7

File tree

1 file changed

+19
-0
lines changed
  • features/FEATURE_COMMON_PAL/nanostack-libservice/mbed-client-libservice

1 file changed

+19
-0
lines changed

features/FEATURE_COMMON_PAL/nanostack-libservice/mbed-client-libservice/ns_types.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,25 @@ typedef int_fast32_t int_fast24_t;
256256
#define NS_FUNNY_COMPARE_RESTORE
257257
#endif
258258

259+
/** \brief Pragma to suppress warnings arising from dummy definitions.
260+
*
261+
* Useful when you have function-like macros that returning constants
262+
* in cut-down builds. Can be fairly cavalier about disabling as we
263+
* do not expect every build to use this macro. Generic builds of
264+
* components should ensure this is not included by only using it in
265+
* a ifdef blocks providing dummy definitions.
266+
*/
267+
#ifdef __CC_ARM
268+
// statement is unreachable(111), controlling expression is constant(236), expression has no effect(174),
269+
// function was declared but never referenced(177), variable was set but never used(550)
270+
#define NS_DUMMY_DEFINITIONS_OK _Pragma("diag_suppress=111,236,174,177,550")
271+
#elif defined __IAR_SYSTEMS_ICC__
272+
// controlling expression is constant
273+
#define NS_DUMMY_DEFINITIONS_OK _Pragma("diag_suppress=Pe236")
274+
#else
275+
#define NS_DUMMY_DEFINITIONS_OK
276+
#endif
277+
259278
/** \brief Convert pointer to member to pointer to containing structure */
260279
#define NS_CONTAINER_OF(ptr, type, member) \
261280
((type *) ((char *) (ptr) - offsetof(type, member)))

0 commit comments

Comments
 (0)