I tried to build a little initialisation function for a robot I'm building. Then warning 16 occured, I've tried searching this site, and tried the sollutions I coulf find. It seems to me it is not a problem of the function not being called?
void initialise(void){ short failed = FALSE; [...] // initialise motors failed |= initMotor(); [...] }
short initMotor(void);
short initMotor(void){ short failed = FALSE; if (DEBUG) printf("Initialising Motors\n"); return failed; }
Okay, seems the functions wasn't called because 'DEBUG = OFF'. When 'DEBUG = ON', the warnings are not generated. Guess they won't be generated when the real implementation is ready either. Tnx for reading :)
Optimisation? what if you make 'failed' volatile?
This ?CO?MOTOR segment is probably the string constant in printf("Initialising Motors\n"); So if DEBUG is false, compiler creates this string, but the printf() call disappears due to optimisation, so the string isn't referenced anywhere. Strange why the compiler leaves the orphan string constant... anyway you can ignore this warning (but lose some code space). Regards, --PA