This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52304] Gcc does not notice missing header instead it shows a warning. The compiled code may work or not.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]