sebastianbiallas / pearpc

PearPC - PowerPC Architecture Emulator
GNU General Public License v2.0
389 stars 70 forks source link

Compare of unsigned int to signed int #8

Open kallisti5 opened 9 years ago

kallisti5 commented 9 years ago

https://github.com/sebastianbiallas/pearpc/blob/master/src/io/prom/promboot.cc#L588

There are a grouping of comparisons of unsigned numbers to a signed -1 here.. likely a bug but I'm not sure what that code is looking for.

g++ -DHAVE_CONFIG_H -I. -I../../..  -I ../..   -Wundef -Wall -Woverloaded-virtual -std=c++11 -fsigned-char -O3 -fomit-frame-pointer -g -fno-inline -pthread -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -MT promboot.o -MD -MP -MF .deps/promboot.Tpo -c -o promboot.o promboot.cc
promboot.cc: In function ‘bool init_page_create(uint32, uint32)’:
promboot.cc:368:32: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
  return prom_claim_page(pa) && ppc_prom_page_create(ea, pa);
                                ^
promboot.cc:368:59: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
  return prom_claim_page(pa) && ppc_prom_page_create(ea, pa);
                                                           ^
promboot.cc: In function ‘bool chrp_init_page_create(uint32, uint32, int)’:
promboot.cc:381:17: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
   return ret && ppc_prom_page_create(ea, pa);
                 ^
promboot.cc:381:44: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
   return ret && ppc_prom_page_create(ea, pa);
                                            ^
promboot.cc: In function ‘bool mapped_load_elf_from_chrp(File&, uint)’:
promboot.cc:588:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (desc->real_base != -1)
                         ^
promboot.cc:591:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (desc->real_size != -1)
                         ^
promboot.cc:594:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (desc->virt_base != -1)
                         ^
promboot.cc:597:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (desc->virt_size != -1)
                         ^
promboot.cc:600:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (desc->load_base != -1)
                         ^
promboot.cc:635:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (loader_size > phdr[i].p_memsz) {
                    ^
promboot.cc:682:3: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
   ppc_prom_page_create(0, 0);
   ^
promboot.cc:682:28: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
   ppc_prom_page_create(0, 0);
                            ^
promboot.cc:620:10: warning: unused variable ‘client_size’ [-Wunused-variable]
   sint32 client_size = f.getSize() - disp_off;
          ^
promboot.cc:623:8: warning: unused variable ‘page’ [-Wunused-variable]
   byte page[PPC_PAGE_SIZE];
        ^
promboot.cc: In function ‘bool mapped_load_elf(File&)’:
promboot.cc:787:3: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
   ppc_prom_page_create(0, 0);
   ^
promboot.cc:787:28: warning: ‘bool ppc_prom_page_create(uint32, uint32)’ is deprecated (declared at ../../cpu/mem.h:42) [-Wdeprecated-declarations]
   ppc_prom_page_create(0, 0);
                            ^
promboot.cc: In function ‘bool mapped_load_chrp(File&)’:
promboot.cc:1082:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (index=0; index<buflen-1; index++) {
                       ^
promboot.cc: In function ‘bool promboot_copy_file_to_memory(File&, uint32&, uint32&, sint32, sint32, int)’:
promboot.cc:479:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
mv -f .deps/promboot.Tpo .deps/promboot.Po
rm -f libprom.a
/usr/bin/ar cru libprom.a prom.o prommem.o fcode.o forth.o forthtable.o promboot.o promosi.o promdt.o 
ranlib libprom.a