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:
00000000 <f>: 0: b082 sub sp, #8 2: 9803 ldr r0, [sp, #12] 4: b002 add sp, #8 6: 4770 bx lr
gcc seems not to detect a blatant access to an uninitialised variable here also... although for a simple variable, that does get detected:
int f(void) { int x;
return x; }
gcc -O3 -Wall -Wextra -Warray-bounds -Werror -c tst.c cc1: warnings being treated as errors tst.c: In function âfâ: tst.c:5:17: error: âxâ is used uninitialized in this function
A don't know whether warning issues indicate true bugs, but this is at least strange behaviour.
Cheers ---Dave