You have something like:
int function(void) { return; }
Add a return value or change the return type to void.
The error message is very clear:
warning: 'return' with no value, in a function that returns a non-void.
Returning without a value is similar to what I showed. The message also tells you that if the function returns "void", this will not give a warning. But since the function should return a value, but your "return" statement did not do this, you have a problem.
This often indicates an ancient code. In the days leading up to the C89 standard, compilers did not necessarily support void. The accepted style was then:
function_not_returning_an_explicit_value(i) char *i; { ... if (...something...) return; }
Technically, the function returns int , but no value was expected. This code style triggers the warning you received - and C99 officially outlaws it, but compilers continue to accept it for backward compatibility reasons.
source share