Using gcc
5.2.0, I noticed that this code does not generate a warning:
#include <stddef.h>
int function(void)
{
return NULL;
}
void procedure(void)
{
return NULL;
}
I used the flags -Wall -Wextra -std=c99 -pedantic
and I am running archlinux. I am not sure why this code works fine on gcc
, especially since clang
3.7.0 does generate a warning.
I also tried with older versions of gcc
like 4.9 or 4.7 and they both generate warnings.
The warnings are:
warning: return makes integer from pointer without a cast
and
warning: ‘return’ with a value, in function returning void
I should mention that I tried compiling gcc 5.2 on Debian and the result is the same. So archlinux does not seem to be the problem.
What is the rationale? I cannot seem to find anything related to this anywhere else.
Thank you!
I filled a bug report here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67730
It was confirmed and is fixed for 5.3 it seems!
Thanks for your help.