------- Comment #2 from davek at gcc dot gnu dot org  2010-01-11 00:23 -------
(In reply to comment #1)
> We should probably warn instead "function returning non-void declared with
> attribute noreturn".
> 

I think not; I don't see why you should be obliged to change the prototype of a
function in order to tell the compiler that it does not return, and it's very
often the case that you can't control the prototype of a function.  The
particular example this came from was a thread function that was spawned by
pthread_create, so it had to have an int return type, even though it had a
while (1) loop that meant it never would, in fact return; I wanted to tell the
compiler that.

Note however that I only included noreturn to show that it doesn't suppress the
warning; the warning arises even without it (as I mentioned in the list thread
but see I forgot to mention earlier here; sorry).  The real problem is that it
shouldn't complain about a missing return statement if there's no possible way
of exiting the function.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42674

Reply via email to