Compiler is generating a warning in .c when an API SetQuizBuckUFalt is called. The warning says expression has no side effect which means "statement does not change the program’s state", however the functionality is working fine for us but we need to understand why compiler is throwing a warning..?
### mwcceppc.exe Compiler:
# File: ..\CHCM1P25\source\ostaskapi.c
# ---------------------------------------
# 506: SetQuizBuckUFalt(SET_VAL);
# Warning: ^
# expression has no side effect
Compiler used: Freescale code warrior 2.10
Micro Controller: SPC564A80B4
Function definition:
uint8 VBuckFaltFlg;
/* The macro sets the VBuck fault flag to indicate the VBuck fault */
#define SetQuizBuckUFalt(SetValue) \
( (SetValue == SET_VAL)? (VBuckFaltFlg = SET_VAL):(VBuckFaltFlg = CLEAR_VAL) )
Hello,
I consulted your question with my colleague and it seems, this warning occurs, because this SetValue == SET_VAL is always true in case you call SetQuizBuckUFalt(SET_VAL); with SET_VAL parameter.
Try to call SetQuizBuckUFalt with variable parameter not with constant parameter.
Regards,
Martin