[hatari-devel] Clang warnings for the DSP code
Laurent Sallafranque
laurent.sallafranque at free.fr
Mon Jul 4 23:24:21 CEST 2011
Hi,
> numreg1 = numreg2 = DSP_REG_NULL;
This line was added to avoid some compiler warnings.
In fact, numreg1 and numreg2 are always computed (in a if or a else
section). Both of these sections contains a switch with only 4
possibilities.
The best, for my point of view, would be to remove the init line with
DSP_REG_NULL.
/home/eero/work/hatari/src/falcon/dsp_cpu.c:3851:3: warning: Pass-by-value
argument in function call is undefined
write_memory(DSP_SPACE_X, l_addr, save_lx);
^ ~~~~~~~
I really don't understand what's wrong here.
Finally, static void dsp_update_rn_modulo(Uint32 numreg, Sint16
modifier) function :
This function is quite sentitive. I'll give a closer look at the
documentation.
Feel free to modify code in dsp_cpu.c if you can fix these 2 warnings,
but wait for the last ones (signed and unsigned values).
Regards,
Laurent
Le 04/07/2011 21:15, Eero Tamminen a écrit :
> Hi,
>
> Laurent, when compiling the latest Hatari sources, I noticed still warnings
> from the DSP core:
>
> Clang analyzer:
> [ 32%] Building C object src/falcon/CMakeFiles/Falcon.dir/dsp_cpu.c.o
> clang: warning: argument unused during compilation: '-c'
> /home/eero/work/hatari/src/falcon/dsp_cpu.c:3502:12: warning: Although the
> value stored to 'numreg2' is used in the enclosing expression, the value is
> never actually
> read from 'numreg2'
> numreg1 = numreg2 = DSP_REG_NULL;
> ^ ~~~~~~~~~~~~
> /home/eero/work/hatari/src/falcon/dsp_cpu.c:3851:3: warning: Pass-by-value
> argument in function call is undefined
> write_memory(DSP_SPACE_X, l_addr, save_lx);
> ^ ~~~~~~~
>
> Clang itself:
> [ 40%] Building C object src/falcon/CMakeFiles/Falcon.dir/dsp_cpu.c.o
> /home/eero/work/hatari/src/falcon/dsp_cpu.c:1529:19: warning: comparison of
> integers of different signs: 'Sint16' (aka 'short') and 'Uint16' (aka
> 'unsigned short')
> [-Wsign-compare]
> if (orig_modifier>modulo) {
> ~~~~~~~~~~~~~^~~~~~~
> /home/eero/work/hatari/src/falcon/dsp_cpu.c:1530:18: warning: comparison of
> integers of different signs: 'Sint16' (aka 'short') and 'Uint16' (aka
> 'unsigned short')
> [-Wsign-compare]
> while (modifier>bufsize) {
> ~~~~~~~~^~~~~~~~
> /home/eero/work/hatari/src/falcon/dsp_cpu.c:1542:19: warning: comparison of
> integers of different signs: 'Sint16' (aka 'short') and 'Uint16' (aka
> 'unsigned short')
> [-Wsign-compare]
> if (orig_modifier!=modulo) {
> ~~~~~~~~~~~~~^ ~~~~~~
> /home/eero/work/hatari/src/falcon/dsp_cpu.c:1543:12: warning: comparison of
> integers of different signs: 'Sint16' (aka 'short') and 'Uint16' (aka
> 'unsigned short')
> [-Wsign-compare]
> if (r_reg>hibound) {
> ~~~~~^~~~~~~~
> /home/eero/work/hatari/src/falcon/dsp_cpu.c:1545:19: warning: comparison of
> integers of different signs: 'Sint16' (aka 'short') and 'Uint16' (aka
> 'unsigned short')
> [-Wsign-compare]
> } else if (r_reg<lobound) {
>
>
> Any comments on them?
>
>
> - Eero
> _______________________________________________
> hatari-devel mailing list
> hatari-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/hatari-devel
>
More information about the hatari-devel
mailing list