Re: [hatari-devel] patch: Add some missing include directives

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 05/12/2019 à 20:30, Thorsten Otto a écrit :
On Mittwoch, 4. Dezember 2019 03:39:56 CET Thorsten Otto wrote:

Some of these warnings look like there is really something wrong there:

/home/sebilla/atari/hatari/src/cpu/softfloat/softfloat.c:181:22: warning: bitwise negation of a boolean expression; did you mean logical negation? [-Wbool-operation] zSig0 &= ~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & ( status->float_rounding_mode == float_round_nearest_even ) ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! /home/sebilla/atari/hatari/src/cpu/softfloat/softfloat.c:300:22: warning: bitwise negation of a boolean expression; did you mean logical negation? [-Wbool-operation] zSig0 &= ~ ( ( (uint64_t) ( zSig1<<1 ) == 0 ) & ( floatx80_internal_mode == float_round_nearest_even ) ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! [ 57%] Building C object src/cpu/CMakeFiles/UaeCpu.dir/softfloat/softfloat_decimal.c.o 2 warnings generated. [ 58%] Building C object src/cpu/CMakeFiles/UaeCpu.dir/softfloat/softfloat_fpsp.c.o /home/sebilla/atari/hatari/src/cpu/softfloat/softfloat_decimal.c:58:13: warning: bitwise negation of a boolean expression; did you mean logical negation? [-Wbool-operation] zSig0 &= ~ (((uint64_t) (zSig1<<1) == 0) & (status->float_rounding_mode == float_round_nearest_even)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !
Remember that gcc in c99 mode implements a real bool type like in C++, and ~((bool)0) will result in 1, not a bitmask of all ones like seems to be intended by above code. Even without c99, the type of the expression will be int, and ~(0) will result in 0xffffffff, not (uint64_t)-1





That one also looks suspicious:

/home/sebilla/atari/hatari/src/cpu/newcpu_common.c:1070:49: warning:
comparison of integers of different signs: 'uae_u32' (aka 'unsigned int') and
'uae_s32' (aka 'int') [-Wsign-compare]
                         } else if (ahigh < 0 && divider < 0 && ahigh >
divider) {
                                                                ~~~~~ ^ ~~~~~~~

ahigh is uae_u32, thus ahigh < 0 can never be true

Hi

yes, there're a few cases like this in winuae cpu core ; last time I checked some of these warnings are harmless. Not all bits are used in the case of the ~bool , so in the end it works.

I leave it to Toni in case he wants to fix some of these, but I'd rather keep the code in Hatari similar to the one in Winuae for easier merging later.

Nicolas




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/