nemequ/hedley

Incompatible redefinition of macro HEDLEY_CPP_CAST

kblomqvist opened this issue · 0 comments

I got the following error when compiling with IAR ARM 8.42.1.

#  else
     ^
"C:\foobar\hedley-13\hedley.h",760  Error[Pe052]:
          expected a macro parameter name

  #    define HEDLEY_CPP_CAST(T, expr) ((T) (expr))
              ^
"C:\foobar\hedley-13\hedley.h",761  Error[Pa181]:
          incompatible redefinition of macro "HEDLEY_CPP_CAST" (declared at
          line 756)

Workaround: So far I do not need HEDLEY_CPP_CAST so I commented it out as shown below

// #if defined(HEDLEY_CPP_CAST)
// #  undef HEDLEY_CPP_CAST
// #endif
// #if defined(__cplusplus)
// #  if HEDLEY_HAS_WARNING("-Wold-style-cast")
// #    define HEDLEY_CPP_CAST(T, expr) \
//        HEDLEY_DIAGNOSTIC_PUSH \
//        _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
//        ((T) (expr)) \
//        HEDLEY_DIAGNOSTIC_POP
// #  elif HEDLEY_IAR_VERSION_CHECK(8,3,0)
// #    define HEDLEY_CPP_CAST(T, expr) \
//        HEDLEY_DIAGNOSTIC_PUSH \
//        _Pragma("diag_suppress=Pe137") \
//        HEDLEY_DIAGNOSTIC_POP \
// #  else
// #    define HEDLEY_CPP_CAST(T, expr) ((T) (expr))
// #  endif
// #else
// #  define HEDLEY_CPP_CAST(T, expr) (expr)
// #endif