Added FCEU_UNUSED and FCEU_MAYBE_UNUSED macros to help silence certain unused variable and function warnings. Used FCEU_MAYBE_UNUSED to silence unused static function warnings (until it can be deemed that these functions will never be needed). Also, cleaned up a few other unused variable warnings.
This commit is contained in:
parent
5f44e8f374
commit
8fc3ea8ba2
|
@ -519,7 +519,7 @@ static DECLFW(COOLGIRL_Flash_Write) {
|
|||
(flash_buffer_a[1] == 0x0555) && (flash_buffer_v[1] == 0x55) &&
|
||||
(flash_buffer_a[2] == 0x0AAA) && (flash_buffer_v[2] == 0xA0))
|
||||
{
|
||||
int sector = prg_bank_a_mapped * 0x2000 / FLASH_SECTOR_SIZE;
|
||||
//int sector = prg_bank_a_mapped * 0x2000 / FLASH_SECTOR_SIZE;
|
||||
uint32 flash_addr = prg_bank_a_mapped * 0x2000 + (A % 0x8000);
|
||||
if (SAVE_FLASH[flash_addr % SAVE_FLASH_SIZE] != 0xFF) {
|
||||
FCEU_PrintError("Error: can't write to 0x%08x, flash sector is not erased.\n", flash_addr);
|
||||
|
|
|
@ -34,11 +34,13 @@ static uint8 *WRAM = NULL;
|
|||
static int kanji_pos, kanji_page, r40C0;
|
||||
static int IRQa, IRQCount;
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static DECLFW(MBWRAM) {
|
||||
if (!(DRegs[3] & 0x10))
|
||||
Page[A >> 11][A] = V;
|
||||
}
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static DECLFR(MAWRAM) {
|
||||
if (DRegs[3] & 0x10)
|
||||
return X.DB;
|
||||
|
|
|
@ -1376,6 +1376,7 @@ static DECLFW(M406IRQWrite) {
|
|||
MMC3_IRQWrite((A & 0xFFFE) | ((A & 2) >> 1), V);
|
||||
}
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static DECLFW(M406Write) {
|
||||
}
|
||||
|
||||
|
|
|
@ -726,7 +726,8 @@ extern unsigned int frameAdvHoldTimer;
|
|||
///Skip may be passed in, if FRAMESKIP is #defined, to cause this to emulate more than one frame
|
||||
void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int skip) {
|
||||
//skip initiates frame skip if 1, or frame skip and sound skip if 2
|
||||
int r, ssize;
|
||||
FCEU_MAYBE_UNUSED int r;
|
||||
int ssize;
|
||||
|
||||
JustFrameAdvanced = false;
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ static const char *guiCallbackTable = "FCEU.GUI";
|
|||
static int frameAdvanceWaiting = FALSE;
|
||||
|
||||
// We save our pause status in the case of a natural death.
|
||||
static int wasPaused = FALSE;
|
||||
//static int wasPaused = FALSE;
|
||||
|
||||
// Transparency strength. 255=opaque, 0=so transparent it's invisible
|
||||
static int transparencyModifier = 255;
|
||||
|
@ -1635,7 +1635,7 @@ static void toCStringConverter(lua_State* L, int i, char*& ptr, int& remaining)
|
|||
if(remaining <= 0)
|
||||
return;
|
||||
|
||||
const char* str = ptr; // for debugging
|
||||
//const char* str = ptr; // for debugging
|
||||
|
||||
// if there is a __tostring metamethod then call it
|
||||
int usedMeta = luaL_callmeta(L, i, "__tostring");
|
||||
|
@ -2451,6 +2451,7 @@ LuaMemHookType MatchHookTypeToCPU(lua_State* L, LuaMemHookType hookType)
|
|||
case LUAMEMHOOK_WRITE: return LUAMEMHOOK_WRITE_SUB;
|
||||
case LUAMEMHOOK_READ: return LUAMEMHOOK_READ_SUB;
|
||||
case LUAMEMHOOK_EXEC: return LUAMEMHOOK_EXEC_SUB;
|
||||
default: return hookType;
|
||||
}
|
||||
}
|
||||
return hookType;
|
||||
|
@ -2460,6 +2461,7 @@ static int memory_registerwrite(lua_State *L)
|
|||
{
|
||||
return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_WRITE), 1);
|
||||
}
|
||||
FCEU_MAYBE_UNUSED
|
||||
static int memory_registerread(lua_State *L)
|
||||
{
|
||||
return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_READ), 1);
|
||||
|
@ -2648,7 +2650,6 @@ static int input_get(lua_State *L) {
|
|||
|
||||
if (keyBuf)
|
||||
{
|
||||
int i=0;
|
||||
char keyName[64];
|
||||
const char *keyOut = nullptr;
|
||||
|
||||
|
@ -3889,7 +3890,6 @@ static inline uint32 gui_getcolour_wrapped(lua_State *L, int offset, bool hasDef
|
|||
lua_pushnil(L); // first key
|
||||
int keyIndex = lua_gettop(L);
|
||||
int valueIndex = keyIndex + 1;
|
||||
bool first = true;
|
||||
while(lua_next(L, offset))
|
||||
{
|
||||
bool keyIsString = (lua_type(L, keyIndex) == LUA_TSTRING);
|
||||
|
@ -4095,6 +4095,7 @@ static int gui_box(lua_State *L) {
|
|||
}
|
||||
|
||||
// (old) gui.box(x1, y1, x2, y2, color)
|
||||
FCEU_MAYBE_UNUSED
|
||||
static int gui_box_old(lua_State *L) {
|
||||
|
||||
int x1,y1,x2,y2;
|
||||
|
@ -4424,6 +4425,7 @@ draw_outline:
|
|||
}
|
||||
}
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static int strlinelen(const char* string)
|
||||
{
|
||||
const char* s = string;
|
||||
|
@ -4434,6 +4436,7 @@ static int strlinelen(const char* string)
|
|||
return s - string;
|
||||
}
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static void LuaDisplayString (const char *string, int y, int x, uint32 color, uint32 outlineColor)
|
||||
{
|
||||
if(!string)
|
||||
|
@ -4601,7 +4604,7 @@ void LuaDrawTextTransWH(const char *str, size_t l, int &x, int y, uint32 color,
|
|||
return;
|
||||
|
||||
size_t len = l;
|
||||
int defaultAlpha = std::max<int>(0, std::min<int>(transparencyModifier, 255));
|
||||
//int defaultAlpha = std::max<int>(0, std::min<int>(transparencyModifier, 255));
|
||||
int diffx;
|
||||
int diffy = std::max<int>(0, std::min<int>(7, LUA_SCREEN_HEIGHT - y));
|
||||
|
||||
|
@ -4670,7 +4673,7 @@ void LuaDrawTextTransWH(const char *str, size_t l, int &x, int y, uint32 color,
|
|||
// main HUD.
|
||||
static int gui_text(lua_State *L) {
|
||||
|
||||
extern int font_height;
|
||||
//extern int font_height;
|
||||
const char *msg;
|
||||
int x, y;
|
||||
size_t l;
|
||||
|
@ -5088,7 +5091,7 @@ static int taseditor_registermanual(lua_State *L)
|
|||
if (!lua_isnil(L,1))
|
||||
luaL_checktype(L, 1, LUA_TFUNCTION);
|
||||
|
||||
const char* caption = NULL;
|
||||
FCEU_MAYBE_UNUSED const char* caption = NULL;
|
||||
if (!lua_isnil(L, 2))
|
||||
caption = lua_tostring(L, 2);
|
||||
|
||||
|
@ -5474,10 +5477,10 @@ static int doPopup(lua_State *L, const char* deftype, const char* deficon) {
|
|||
assert(iicon >= 0 && iicon <= 3);
|
||||
if(!(iicon >= 0 && iicon <= 3)) iicon = 0;
|
||||
|
||||
#ifdef __WIN_DRIVER__
|
||||
static const char * const titles [] = {"Notice", "Question", "Warning", "Error"};
|
||||
const char* answer = "ok";
|
||||
|
||||
#ifdef __WIN_DRIVER__
|
||||
static const int etypes [] = {MB_OK, MB_YESNO, MB_YESNOCANCEL, MB_OKCANCEL, MB_ABORTRETRYIGNORE};
|
||||
static const int eicons [] = {MB_ICONINFORMATION, MB_ICONQUESTION, MB_ICONWARNING, MB_ICONERROR};
|
||||
//StopSound(); //mbg merge 7/27/08
|
||||
|
@ -5912,6 +5915,7 @@ static int bitbit(lua_State *L)
|
|||
}
|
||||
|
||||
// The function called periodically to ensure Lua doesn't run amok.
|
||||
FCEU_MAYBE_UNUSED
|
||||
static void FCEU_LuaHookFunction(lua_State *L, lua_Debug *dbg) {
|
||||
|
||||
if (numTries-- == 0) {
|
||||
|
|
|
@ -87,6 +87,7 @@ pal *palo = NULL;
|
|||
(type) (y + to_rgb [4] * i + to_rgb [5] * q)\
|
||||
)
|
||||
|
||||
FCEU_MAYBE_UNUSED
|
||||
static void ApplyDeemphasisNTSC(int entry, u8& r, u8& g, u8& b)
|
||||
{
|
||||
static float const to_float = 1.0f / 0xFF;
|
||||
|
@ -252,6 +253,7 @@ static void ApplyDeemphasisBisqwit(int entry, u8& r, u8& g, u8& b)
|
|||
}
|
||||
|
||||
//classic algorithm
|
||||
FCEU_MAYBE_UNUSED
|
||||
static void ApplyDeemphasisClassic(int entry, u8& r, u8& g, u8& b)
|
||||
{
|
||||
//DEEMPH BITS MAY BE ORDERED WRONG. PLEASE CHECK
|
||||
|
|
|
@ -6,7 +6,7 @@ uint8 tmpd;
|
|||
#endif
|
||||
|
||||
#ifndef PPUT_MMC5SP
|
||||
uint8 zz;
|
||||
FCEU_MAYBE_UNUSED uint8 zz;
|
||||
#else
|
||||
uint8 xs, ys;
|
||||
xs = X1;
|
||||
|
|
|
@ -143,6 +143,14 @@ typedef uint8 (*readfunc)(uint32 A);
|
|||
#define CTASSERT(x) typedef char __assert ## y[(x) ? 1 : -1];
|
||||
#endif
|
||||
|
||||
#define FCEU_UNUSED(x) (void)(x)
|
||||
|
||||
#if __has_cpp_attribute(maybe_unused)
|
||||
#define FCEU_MAYBE_UNUSED [[maybe_unused]]
|
||||
#else
|
||||
#define FCEU_MAYBE_UNUSED
|
||||
#endif
|
||||
|
||||
#include "utils/endian.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -160,6 +160,9 @@ void FCEU_VSUniPower(void) {
|
|||
case GIPPU_RP2C04_0004:
|
||||
default_palette_selection = GameInfo->vs_ppu;
|
||||
break;
|
||||
default:
|
||||
// nothing todo
|
||||
break;
|
||||
}
|
||||
if (GameInfo->vs_ppu == GIPPU_RC2C05_04) {
|
||||
OldReadPPU = GetReadHandler(0x2002);
|
||||
|
|
|
@ -318,8 +318,8 @@ static uint8 ZNTable[256];
|
|||
#define LD_ZP(op) {uint8 A; uint8 x; GetZP(A); x=RdRAM(A); op; break;}
|
||||
#define LD_ZPX(op) {uint8 A; uint8 x; GetZPI(A,_X); x=RdRAM(A); op; break;}
|
||||
#define LD_ZPY(op) {uint8 A; uint8 x; GetZPI(A,_Y); x=RdRAM(A); op; break;}
|
||||
#define LD_AB(op) {unsigned int A; uint8 x; GetAB(A); x=RdMem(A); op; break; }
|
||||
#define LD_ABI(reg,op) {unsigned int A; uint8 x; GetABIRD(A,reg); x=RdMem(A); op; break;}
|
||||
#define LD_AB(op) {unsigned int A; FCEU_MAYBE_UNUSED uint8 x; GetAB(A); x=RdMem(A); op; break; }
|
||||
#define LD_ABI(reg,op) {unsigned int A; FCEU_MAYBE_UNUSED uint8 x; GetABIRD(A,reg); x=RdMem(A); op; break;}
|
||||
#define LD_ABX(op) LD_ABI(_X,op)
|
||||
#define LD_ABY(op) LD_ABI(_Y,op)
|
||||
#define LD_IX(op) {unsigned int A; uint8 x; GetIX(A); x=RdMem(A); op; break;}
|
||||
|
|
Loading…
Reference in New Issue