seems to run fine
so whats the difference..?
thx
When we compile anything with gcc we send it special flags to tell it what warnings we want to know, and what not..
Warnings are less serious than errors. They are just to help us fix any possible bugs in the code. They may not even be real bugs either. In case of gcc, compilation takes an additional paramter (option) called -o2 meaning optimization with level 2. Optimization leads to additional warnings.
So when it builds, there is one more paramater for gcc passed from KBUILD_CFLAGS, called -Werror. This is what causes gcc to stop compiling even if there was a warning while compiling, this is called making a warning a hard error. Whether we want it to make it an error or not is decided by the KBUILD_CFLAGS flag called -Werror. If -Werror is set, warnings become errors. So code stops even if the warning is due to optimization of gcc. There are two fixes-one is to turn off the "Make warnings errors" option in Menuconfig. The other option is to search and locate "-Werror" flag within the Makefiles and remove it.
A third and more drastic solution is to tell gcc that we want all warnings to be ignored, and to build even if there are warnings. That's what I did in the second file. I changed this:
Code:
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-fno-delete-null-pointer-checks
to this:
Code:
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-fno-delete-null-pointer-checks \
-w
Notice the additional -w option. So gcc ignores all warnings. So it builds.
It will still stop building if there are real errors, so no need to worry