]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commit
Silence compiler warnings when compiling with GCC's -Wsign-compare
authorThomas Huth <huth@tuxfamily.org>
Sat, 1 Dec 2018 11:53:59 +0000 (12:53 +0100)
committerThomas Huth <huth@tuxfamily.org>
Sat, 1 Dec 2018 12:03:21 +0000 (13:03 +0100)
commit7521d35c06808a598799b80909d0456c1dee4967
tree2373999284077c3e1be1f18078116e2b82826ec3
parent4885c3377147f2984a61eac6cb4c94bf907efead
Silence compiler warnings when compiling with GCC's -Wsign-compare

When compiling the CPU files with the -Wsign-compare compiler flag, there
are a couple of harmless warnings, e.g.:

cpummu030.c: In function 'm68k_do_rte_mmu030':
cpummu030.c:2745:48: warning: operand of ?: changes signedness from 'int' to 'uae_u32' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
  uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? -1 : (oc & 0xffff);
                                                ^~
cpummu030.c:2792:24: warning: comparison of integer expressions of different signedness: 'uae_u32' {aka 'unsigned int'} and 'int' [-Wsign-compare]
    if (mmu030_opcode_v == -1) {
                        ^~
cpummu030.c: In function 'm68k_do_rte_mmu030c':
cpummu030.c:3133:48: warning: operand of ?: changes signedness from 'int' to 'uae_u32' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
  uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? -1 : (oc & 0xffff);
                                                ^~
cpummu030.c:3185:50: warning: operand of ?: changes signedness from 'int' to 'uae_u32' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
   regs.pipeline_stop = ((ps >> 20) & 15) == 15 ? -1 : (ps >> 20) & 15;
                                                  ^~
fpp.c: In function 'fp_unimp_datatype':
fpp.c:998:54: warning: operand of ?: changes signedness from 'int' to 'uae_u32' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
     fsave_data.stag = get_ftag(src, (opclass == 0) ? -1 : size);
                                                      ^~

Let's make sure to use the correct signedness of the target variable to
silence these warnings.
cpummu30.cpp
fpp.cpp