Silence build warnings (#488)

This commit is contained in:
bladeoner 2023-03-22 18:11:19 +01:00 committed by GitHub
parent 09c57aac4b
commit 2a15a2eac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 23 deletions

View File

@ -20,7 +20,7 @@ jobs:
- name: Build Wii
if: ${{ matrix.image == 'Wii' }}
run: |
make -f Makefile.wii -j2
make -f Makefile.wii -j1
- name: Copy Wii artifacts
if: ${{ matrix.image == 'Wii' }}
@ -46,7 +46,7 @@ jobs:
- name: Build GameCube
if: ${{ matrix.image == 'GameCube' }}
run: |
make -f Makefile.gc -j2
make -f Makefile.gc -j1
- name: Copy GameCube artifact
if: ${{ matrix.image == 'GameCube' }}

View File

@ -35,7 +35,7 @@ SHAREDFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) `freetype-config --cflags` \
-Wno-format -Wno-format-overflow -Wno-stringop-overflow -Wno-format-truncation \
-Wno-unused-parameter -Wno-strict-aliasing -Wno-write-strings -Wno-stringop-truncation -Wno-sign-compare \
-Wno-unused-variable -Wno-parentheses -Wno-unused-function -Wno-switch -Wno-unused-but-set-variable \
-Wno-narrowing -Wno-misleading-indentation -Wno-restrict -Wno-maybe-uninitialized
-Wno-narrowing -Wno-misleading-indentation -Wno-restrict -Wno-maybe-uninitialized -Wno-infinite-recursion
CFLAGS = $(SHAREDFLAGS) -Wno-incompatible-pointer-types
CXXFLAGS = $(SHAREDFLAGS) -Wno-catch-value -Wno-class-memaccess
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map

View File

@ -35,7 +35,7 @@ SHAREDFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) `freetype-config --cflags` \
-Wno-format -Wno-format-overflow -Wno-stringop-overflow -Wno-format-truncation \
-Wno-unused-parameter -Wno-strict-aliasing -Wno-write-strings -Wno-stringop-truncation -Wno-sign-compare \
-Wno-unused-variable -Wno-parentheses -Wno-unused-function -Wno-switch -Wno-unused-but-set-variable \
-Wno-narrowing -Wno-misleading-indentation -Wno-restrict -Wno-maybe-uninitialized
-Wno-narrowing -Wno-misleading-indentation -Wno-restrict -Wno-maybe-uninitialized -Wno-infinite-recursion
CFLAGS = $(SHAREDFLAGS) -Wno-incompatible-pointer-types
CXXFLAGS = $(SHAREDFLAGS) -Wno-catch-value -Wno-class-memaccess
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map

View File

@ -430,7 +430,7 @@ int main(int argc, char *argv[])
FCEUI_SetGameGenie(1); // 0 - OFF, 1 - ON
FDSBIOS=(uint8 *)malloc(8192);
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
memset(FDSBIOS, 0, sizeof(*FDSBIOS)); // clear FDS BIOS memory
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high, 2 - high (alt.)
int currentTiming = 0;

View File

@ -1324,10 +1324,7 @@ static void MovieSubtitleToggle(void)
static void UndoRedoSavestate(void)
{
// FIXME this will always evaluate to true, should this be
// if (*lastSavestateMade...) to check if it holds a string or just
// a '\0'?
if (lastSavestateMade && (undoSS || redoSS))
if ( !lastSavestateMade.empty() && (undoSS || redoSS))
SwapSaveState();
}

View File

@ -70,11 +70,11 @@ static int StateShow;
//tells the save system innards that we're loading the old format
bool FCEU_state_loading_old_format = false;
char lastSavestateMade[2048]; //Stores the filename of the last savestate made (needed for UndoSavestate)
std::string lastSavestateMade; //Stores the filename of the last savestate made (needed for UndoSavestate)
bool undoSS = false; //This will be true if there is lastSavestateMade, it was made since ROM was loaded, a backup state for lastSavestateMade exists
bool redoSS = false; //This will be true if UndoSaveState is run, will turn false when a new savestate is made
char lastLoadstateMade[2048]; //Stores the filename of the last state loaded (needed for Undo/Redo loadstate)
std::string lastLoadstateMade; //Stores the filename of the last state loaded (needed for Undo/Redo loadstate)
bool undoLS = false; //This will be true if a backupstate was made and it was made since ROM was loaded
bool redoLS = false; //This will be true if a backupstate was loaded, meaning redoLoadState can be run
@ -478,7 +478,7 @@ void FCEUSS_Save(const char *fname, bool display_message)
if (CheckFileExists(fn) && backupSavestates) //adelikat: If the files exists and we are allowed to make backup savestates
{
CreateBackupSaveState(fn); //Make a backup of previous savestate before overwriting it
strcpy(lastSavestateMade,fn); //Remember what the last savestate filename was (for undoing later)
lastSavestateMade.assign(fn); //Remember what the last savestate filename was (for undoing later)
undoSS = true; //Backup was created so undo is possible
}
else
@ -736,7 +736,7 @@ bool FCEUSS_Load(const char *fname, bool display_message)
{
strcpy(fn, FCEU_MakeFName(FCEUMKF_STATE,CurrentState,fname).c_str());
st=FCEUD_UTF8_fstream(fn,"rb");
strcpy(lastLoadstateMade,fn);
lastLoadstateMade.assign(fn);
}
if (st == NULL || (st->get_fp() == NULL))
@ -1056,13 +1056,13 @@ void SwapSaveState()
//Both files must exist
//--------------------------------------------------------------------------------------------
if (!lastSavestateMade)
if (lastSavestateMade.empty())
{
FCEUI_DispMessage("Can't Undo",0);
FCEUI_printf("Undo savestate was attempted but unsuccessful because there was not a recently used savestate.\n");
return; //If there is no last savestate, can't undo
}
string backup = GenerateBackupSaveStateFn(lastSavestateMade); //Get filename of backup state
string backup = GenerateBackupSaveStateFn(lastSavestateMade.c_str()); //Get filename of backup state
if (!CheckFileExists(backup.c_str()))
{
FCEUI_DispMessage("Can't Undo",0);
@ -1076,9 +1076,9 @@ void SwapSaveState()
string temp = backup; //Put backup filename in temp
temp.append("x"); //Add x
rename(backup.c_str(),temp.c_str()); //rename backup file to temp file
rename(lastSavestateMade,backup.c_str()); //rename current as backup
rename(temp.c_str(),lastSavestateMade); //rename backup as current
rename(backup.c_str(),temp.c_str()); //rename backup file to temp file
rename(lastSavestateMade.c_str(),backup.c_str()); //rename current as backup
rename(temp.c_str(),lastSavestateMade.c_str()); //rename backup as current
undoSS = true; //Just in case, if this was run, then there is definately a last savestate and backup
if (redoSS) //This was a redo function, so if run again it will be an undo again
@ -1161,10 +1161,10 @@ void LoadBackup()
void RedoLoadState()
{
if (!redoLS) return;
if (lastLoadstateMade && redoLS)
if (!lastLoadstateMade.empty() && redoLS)
{
FCEUSS_Load(lastLoadstateMade);
FCEUI_printf("Redoing %s\n",lastLoadstateMade);
FCEUSS_Load(lastLoadstateMade.c_str());
FCEUI_printf("Redoing %s\n",lastLoadstateMade.c_str());
}
redoLS = false; //Flag that RedoLoadState can not be run again
undoLS = true; //Flag that LoadBackup can be run again

View File

@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string>
enum ENUM_SSLOADPARAMS
{
@ -67,10 +68,10 @@ void LoadBackup(); //Loads the backupsavestate
void RedoLoadState(); //reloads a loadstate if backupsavestate was run
void SwapSaveState(); //Swaps a savestate with its backup state
extern char lastSavestateMade[2048]; //Filename of last savestate used
extern std::string lastSavestateMade; //Filename of last savestate used
extern bool undoSS; //undo savestate flag
extern bool redoSS; //redo savestate flag
extern char lastLoadstateMade[2048]; //Filename of last state loaded
extern std::string lastLoadstateMade; //Filename of last state loaded
extern bool undoLS; //undo loadstate flag
extern bool redoLS; //redo savestate flag
extern bool backupSavestates; //Whether or not to make backups, true by default