Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence build warnings #488

Merged
merged 1 commit into from Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Expand Up @@ -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' }}
Expand All @@ -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' }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile.gc
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile.wii
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/fceugx.cpp
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions source/fceultra/input.cpp
Expand Up @@ -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();
}

Expand Down
24 changes: 12 additions & 12 deletions source/fceultra/state.cpp
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions source/fceultra/state.h
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Expand Down