libretro / beetle-bsnes-libretro

Standalone port of Mednafen bSNES to libretro, itself a fork of bsnes 0.59.
GNU General Public License v2.0
7 stars 15 forks source link

Silence -Wmaybe-unitialized warnings (Please review) #22

Closed orbea closed 7 years ago

orbea commented 7 years ago

Here are some commits to try to correctly silence the various -Wmaybe-unitialized warnings with gcc. http://pastebin.com/xaZKik8u

In file included from mednafen/snes/src/chip/superfx/superfx.cpp:8:0:
mednafen/snes/src/chip/superfx/core/core.cpp: In member function ‘void SNES::SuperFX::pixelcache_flush(SNES::SuperFX::pixelcache_t&)’:
mednafen/snes/src/chip/superfx/core/core.cpp:89:34: warning: ‘cn’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   unsigned addr = 0x700000 + (cn * (bpp << 3)) + (regs.scbr << 10) + ((y & 0x07) * 2);
                                  ^
mednafen/snes/src/chip/superfx/core/core.cpp: In member function ‘uint8 SNES::SuperFX::rpix(uint8, uint8)’:
mednafen/snes/src/chip/superfx/core/core.cpp:62:34: warning: ‘cn’ may be used uninitialized in this function [-Wmaybe-uninitialized]
In file included from mednafen/snes/src/ppu/bppu/render/render.cpp:9:0,
                 from mednafen/snes/src/ppu/bppu/bppu.cpp:15:
mednafen/snes/src/ppu/bppu/render/line.cpp: In member function ‘void SNES::bPPU::render_line_mode7(uint8, uint8) [with unsigned int bg = 0u; uint8 = unsigned char]’:
mednafen/snes/src/ppu/bppu/render/line.cpp:4:31: warning: ‘palette’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   const unsigned addr = index << 1;
                               ^
In file included from mednafen/snes/src/ppu/bppu/render/render.cpp:7:0,
                 from mednafen/snes/src/ppu/bppu/bppu.cpp:15:
mednafen/snes/src/ppu/bppu/render/mode7.cpp:20:23: note: ‘palette’ was declared here
   int32 tx, ty, tile, palette;
                       ^
mednafen/snes/src/ppu/bppu/render/mode7.cpp: In member function ‘void SNES::bPPU::render_line_mode7(uint8, uint8) [with unsigned int bg = 1u; uint8 = unsigned char ’:
mednafen/snes/src/ppu/bppu/render/mode7.cpp:20:23: warning: ‘palette’ may be used uninitialized in this function [-Wmaybe-uninitialized]
In file included from mednafen/snes/src/system/system.cpp:10:0:
mednafen/snes/src/system/serialization.cpp: In member function ‘bool SNES::System::unserialize(nall::serializer&)’:
mednafen/snes/src/system/serialization.cpp:21:12: warning: ‘signature’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   unsigned signature, version, crc32;
            ^
mednafen/snes/src/system/serialization.cpp:21:23: warning: ‘version’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   unsigned signature, version, crc32;
                       ^
In file included from ./mednafen/snes/src/lib/nall/moduloarray.hpp:4:0,
                 from ./mednafen/snes/src/lib/../base.hpp:26,
                 from mednafen/snes/src/system/system.cpp:1:
./mednafen/snes/src/lib/nall/serializer.hpp:58:44: warning: ‘crc32’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         for(unsigned n = 0; n < size; n++) idata[isize++] = (uint64_t)value >> (n << 3);
                                            ^
In file included from mednafen/snes/src/system/system.cpp:10:0:
mednafen/snes/src/system/serialization.cpp:21:32: note: ‘crc32’ was declared here
   unsigned signature, version, crc32;
                                ^