[Bug c/52304] Gcc does not notice missing header instead it shows a warning. The compiled code may work or not.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Feb 18 14:08:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52304
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |4.5.2
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-18 14:01:15 UTC ---
So basically without all the cmake cruft it's just this:
$ gcc -g -Wall -Wextra test_included.c test_not_included.c test.c -o main
Which gives these warnings telling you about the problem:
test.c: In function ‘main’:
test.c:22:3: warning: implicit declaration of function
‘not_included_get_buffer’ [-Wimplicit-function-declaration]
test.c:22:14: warning: initialization makes pointer from integer without a cast
[enabled by default]
test.c:29:14: warning: initialization makes pointer from integer without a cast
[enabled by default]
test.c:7:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
test.c:7:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
This is how C works, if you dno't declare a function it is assumed to return
'int' and a pointer can't fit in an int.
If you don't like it you should fix the warnings or use
-Werror=implicit-function-declaration to make it an error.
This is not a bug in gcc
More information about the Gcc-bugs
mailing list