#define CHECK_FOR_ERRORS(ret) \
if(ret != CY_U3P_SUCCESS) \
{ \
handleCriticalError(ret, __FILE__, __LINE__); \
}
Intended usage:
CHECK_FOR_ERRORS(CyU3PPibInit(CyTrue, &pibClock));
No return variables, no extra code lines, only wrapping important function calls with this macro.
But it doesn't work. The macro does not evaluate the function call, it only casts the function pointer to int
.
How do I make this work?