2009/12/24, Richard Kettlewell <rjk@terraraq.org.uk>:
This function's return type is required to be 'void *' because it is
passed to pthread_create(); but it never actually returns. However,
gcc-4.4 -Wall generates the following warning for it:
playrtp.c: In function ‘queue_thread’:
playrtp.c:327: error: no return statement in function returning non-void
This is expected behavior, your function is not of type void.
It is not expected behavior to anyone who has read the documentation for
the option.
It is expected behavior, as you can see in gcc/c-decl.c:
/* Complain if there's just no return statement. */
if (warn_return_type
&& TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) != VOID_TYPE
&& !current_function_returns_value && !current_function_returns_null
/* Don't complain if we are no-return. */
&& !current_function_returns_abnormally
/* Don't warn for main(). */
&& !MAIN_NAME_P (DECL_NAME (fndecl))
/* Or if they didn't actually specify a return type. */
&& !C_FUNCTION_IMPLICIT_INT (fndecl)
/* Normally, with -Wreturn-type, flow will complain, but we might
optimize out static functions. */
&& !TREE_PUBLIC (fndecl))
{
warning (OPT_Wreturn_type,
"no return statement in function returning non-void");
TREE_NO_WARNING (fndecl) = 1;
}