libretro / beetle-pce-fast-libretro

Standalone fork of Mednafen PCE Fast to libretro
GNU General Public License v2.0
29 stars 52 forks source link

Silence warnings and avoid undefined behavior #140

Closed negativeExponent closed 4 years ago

negativeExponent commented 4 years ago
libretro.cpp:1190:45: warning: suggest braces around initialization of subobject [-Wmissing-braces]
static uint8_t input_buf[MAX_PLAYERS][2] = {0};
                                            ^
                                            {}
1 warning generated.
mednafen/pce_fast/huc6280.cpp:613:4: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
   LOAD_LOCALS();
   ^
mednafen/pce_fast/huc6280.cpp:49:2: note: expanded from macro 'LOAD_LOCALS'
        LOAD_LOCALS_PC();                       \
        ^
mednafen/pce_fast/huc6280.cpp:43:33: note: expanded from macro 'LOAD_LOCALS_PC'
#define LOAD_LOCALS_PC()        register uint8 *PC_local = HuCPU.PC;
                                ^
1 warning generated.
libretro.cpp:263:30: warning: array subscript -2031616 is below array bounds of ‘uint8 [40960]’ {aka ‘unsigned char [40960]’} [-Warray-bounds]
    HuCPUFastMap[x] = BaseRAM - x * 8192;
                      ~~~~~~~~^~~~~~~~~~
libretro.cpp:263:30: warning: array subscript -2039808 is below array bounds of ‘uint8 [40960]’ {aka ‘unsigned char [40960]’} [-Warray-bounds]
libretro.cpp:263:30: warning: array subscript -2048000 is below array bounds of ‘uint8 [40960]’ {aka ‘unsigned char [40960]’} [-Warray-bounds]
lgtm-com[bot] commented 4 years ago

This pull request fixes 3 alerts when merging 83a234a1c74ea4a626e0a6b92197784e4887e0ae into 74eb499489521950647bf12c88f4f019f68c2ee6 - view on LGTM.com

fixed alerts: