[hatari-devel] gcc warnings during compilation

Eero Tamminen eerot at users.berlios.de
Sat Mar 13 19:31:30 CET 2010


Hi,

On Saturday 13 March 2010, npomarede at corp.free.fr wrote:
> I get a few warnings during compilation :
>
> src/control.c: In function 'Control_SetSocket':
> src/control.c:438: attention : passing argument 2 of 'connect' from
> incompatible pointer type /usr/include/sys/socket.h:129: note: expected
> 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
>
> eero, I think a cast should be added there ?

Commited.


> I also get this :
>
> src/falcon/dsp_cpu.c: In function 'dsp_jsset_pp':
> src/falcon/dsp_cpu.c:909: attention : array subscript is above array
...
> This seems caused by
>      addr = 0xffc0 + value;
>      value = read_memory(memspace, addr);
>
> which puts addr in the range 0xffc0 - 0xffff, but as read_memory defines
> rom as [][0x200], gcc notices value will be out of range because it
> doesn't know there's a case for < 0x200 and > 0xffc0 (but in the case of
> line 909, we know address < 0x200, so this looks like a gcc error).

This was already discussed earlier on the list (Laurent was getting them
too).


> Any idea on how to remove these (harmless) warnings ?
>
> I'm compiling with : -Wall -Wwrite-strings -Wsign-compare
> -Wmissing-prototypes -Wstrict-prototypes -Wcast-qual -Wbad-function-cast
> -Wpointer-arith  -O3

Either don't use -O3 (warnings don't come with -O2), or use a version of GCC
that doesn't show bogus warnings.  -O3 enables several additional gcc
optimizations, you might add the specific options you're interested about
on top of -O2 too.

You might also check gcc bugzilla and/or file the bogus warnings as bug
there.


	- Eero



More information about the hatari-devel mailing list