On Fri, Nov 25, 2011 at 12:01 AM, Dave Martin dave.martin@linaro.org wrote:
On Thu, Nov 24, 2011 at 08:28:53AM +1300, Michael Hope wrote:
On Thu, Nov 24, 2011 at 6:51 AM, Dave Martin dave.martin@linaro.org wrote:
On Wed, Nov 23, 2011 at 09:41:52PM +0700, tknv wrote:
Thank you very much, quick reply. Yes, It is right," it may be better to improve the code instead of turning of the error check." But this time I would like to testing some modules at first even any warnings occur at other modules. I removed -Werror from Makefile at modules have warnings. By the way, KBUILD_CFLAGS's -Werror does not work correct ?
Can you re-run your build with V=1 on the make command line, and post the log so I can see what happens?
I still don't feel I have enough information to understand exactly what's happening.
Additional CFLAGS get added at different places in the Makefiles, so it is possible that your change has been overridden somewhere else.
A side note: adding a -Wno-error to the end of a set of flags cancels out any earlier -Werror. I needed to use this recently with a build system that unconditionally turned on -Werror and a g++-4.1 that was a bit wrong in it's warnings.
Hmmm, that may be the cause.
The perf tools' script in the Linux tree for example has:
# Treat warnings as errors unless directed not to ifneq ($(WERROR),0) CFLAGS_WERROR := -Werror endif
...which isn't going to work if gcc is excessive about the errors it flags up, given the -W options in the top-level Makefile. Adding -Wno-array-bounds might work.
Interestingly, I can't seem to make gcc-4.5.2 report an array bounds error, even for obviously wrong code:
int f(void) { int x[1];
return x[2]; }
gcc -O3 -Wall -Wextra -Warray-bounds -Werror -c tst.c
...reports no error. gcc "did what I asked", but the code is clearly nonsensical, and doesn't describe any possible C function:
This is OK with GCC 4.5:
michaelh@ursa2:~/linaro/bugs$ /tools/toolchains/arch/armv7l/gcc-linaro-4.6-2011.11-armv7l-natty-cbuild205-tcpanda03-cortexa9r1/bin/gcc -S -O2 -Warray-bounds bounds.c bounds.c: In function 'f': bounds.c:5:12: warning: array subscript is above array bounds [-Warray-bounds]
I tracked down the explicit -Werror I saw earlier to gcc/lto-plugin:
lto-plugin/Makefile.in:AM_CFLAGS = -Wall -Werror
In this case gcc-4.1 (don't ask) was a bit enthusiastic about the warnings. Adding a -Wno-error to CFLAGS was better than patching the Makefile.
-- Michael