mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-12 23:03:37 +00:00
tests: Fix unreachable code warnings (#14993)
This commit is contained in:
@@ -371,7 +371,6 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
|
||||
switch (event->type) {
|
||||
case SDL_EVENT_QUIT:
|
||||
return SDL_APP_SUCCESS;
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_REMOVED:
|
||||
for (i = 0; i < player_count; i++) {
|
||||
if (players[i].mouse == event->mdevice.which) {
|
||||
|
||||
@@ -55,7 +55,7 @@ static bool SDL_OPENXR_INTERNAL_ValidationLayerAvailable(void)
|
||||
/* On Android/Quest, the xrGetInstanceProcAddr obtained through runtime negotiation
|
||||
* crashes when used for pre-instance global functions. Skip validation layer check. */
|
||||
return false;
|
||||
#endif
|
||||
#else
|
||||
|
||||
Uint32 apiLayerCount;
|
||||
if (XR_FAILED(xrEnumerateApiLayerProperties(0, &apiLayerCount, NULL))) {
|
||||
@@ -84,6 +84,7 @@ static bool SDL_OPENXR_INTERNAL_ValidationLayerAvailable(void)
|
||||
|
||||
SDL_stack_free(apiLayerProperties);
|
||||
return found;
|
||||
#endif
|
||||
}
|
||||
|
||||
XrResult SDL_OPENXR_INTERNAL_GPUInitOpenXR(
|
||||
|
||||
@@ -2795,7 +2795,6 @@ static bool D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("[direct3d12] Trying to set a sampler for a shader which doesn't have one");
|
||||
break;
|
||||
}
|
||||
|
||||
ID3D12GraphicsCommandList2_SetGraphicsRootDescriptorTable(rendererData->commandList, tableIndex, GPUHandle);
|
||||
|
||||
@@ -2230,7 +2230,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||
SDL_SendDropComplete(data->window);
|
||||
DragFinish(drop);
|
||||
return 0;
|
||||
} break;
|
||||
}
|
||||
|
||||
case WM_DISPLAYCHANGE:
|
||||
{
|
||||
@@ -2462,7 +2462,6 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||
data->expected_resize = false;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SETTINGCHANGE:
|
||||
if (wParam == 0 && lParam != 0 && SDL_wcscmp((wchar_t *)lParam, L"ImmersiveColorSet") == 0) {
|
||||
|
||||
@@ -268,12 +268,10 @@ static int SDLCALL video_createWindowVariousFlags(void *arg)
|
||||
flags = SDL_WINDOW_FULLSCREEN;
|
||||
/* Skip - blanks screen; comment out next line to run test */
|
||||
continue;
|
||||
break;
|
||||
case 2:
|
||||
flags = SDL_WINDOW_OPENGL;
|
||||
/* Skip - not every video driver supports OpenGL; comment out next line to run test */
|
||||
continue;
|
||||
break;
|
||||
case 3:
|
||||
flags = 0;
|
||||
break;
|
||||
|
||||
@@ -1069,7 +1069,6 @@ static const char *GetBindingInstruction(void)
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
break;
|
||||
case SDL_GAMEPAD_BUTTON_BACK:
|
||||
return "Press the left center button (Back/View/Share)";
|
||||
case SDL_GAMEPAD_BUTTON_GUIDE:
|
||||
|
||||
@@ -809,6 +809,11 @@ static int process_testNonExistingExecutable(void *arg)
|
||||
|
||||
static int process_testBatBadButVulnerability(void *arg)
|
||||
{
|
||||
#ifndef SDL_PLATFORM_WINDOWS
|
||||
SDLTest_AssertPass("The BatBadBut vulnerability only applied to Windows");
|
||||
return TEST_SKIPPED;
|
||||
#else
|
||||
|
||||
TestProcessData *data = (TestProcessData *)arg;
|
||||
char *inject_arg = NULL;
|
||||
char **process_args = NULL;
|
||||
@@ -819,10 +824,6 @@ static int process_testBatBadButVulnerability(void *arg)
|
||||
SDL_IOStream *child_bat;
|
||||
char buffer[256];
|
||||
|
||||
#ifndef SDL_PLATFORM_WINDOWS
|
||||
SDLTest_AssertPass("The BatBadBut vulnerability only applied to Windows");
|
||||
return TEST_SKIPPED;
|
||||
#endif
|
||||
/* FIXME: remove child.bat at end of loop and/or create in temporary directory */
|
||||
child_bat = SDL_IOFromFile("child_batbadbut.bat", "w");
|
||||
SDL_IOprintf(child_bat, "@echo off\necho Hello from child_batbadbut.bat\necho \"|bat1=%%1|\"\n");
|
||||
@@ -858,6 +859,7 @@ cleanup:
|
||||
SDL_free(inject_arg);
|
||||
DestroyStringArray(process_args);
|
||||
return TEST_COMPLETED;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int process_testFileRedirection(void *arg)
|
||||
@@ -970,6 +972,11 @@ cleanup:
|
||||
|
||||
static int process_testWindowsCmdline(void *arg)
|
||||
{
|
||||
#ifndef SDL_PLATFORM_WINDOWS
|
||||
SDLTest_AssertPass("SDL_PROP_PROCESS_CREATE_CMDLINE_STRING only works on Windows");
|
||||
return TEST_SKIPPED;
|
||||
#else
|
||||
|
||||
TestProcessData *data = (TestProcessData *)arg;
|
||||
const char *process_args[] = {
|
||||
data->childprocess_path,
|
||||
@@ -1012,11 +1019,6 @@ static int process_testWindowsCmdline(void *arg)
|
||||
int i;
|
||||
size_t total_read = 0;
|
||||
|
||||
#ifndef SDL_PLATFORM_WINDOWS
|
||||
SDLTest_AssertPass("SDL_PROP_PROCESS_CREATE_CMDLINE_STRING only works on Windows");
|
||||
return TEST_SKIPPED;
|
||||
#endif
|
||||
|
||||
props = SDL_CreateProperties();
|
||||
SDLTest_AssertCheck(props != 0, "SDL_CreateProperties()");
|
||||
if (!props) {
|
||||
@@ -1062,10 +1064,16 @@ static int process_testWindowsCmdline(void *arg)
|
||||
failed:
|
||||
SDL_DestroyProcess(process);
|
||||
return TEST_ABORTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int process_testWindowsCmdlinePrecedence(void *arg)
|
||||
{
|
||||
#ifndef SDL_PLATFORM_WINDOWS
|
||||
SDLTest_AssertPass("SDL_PROP_PROCESS_CREATE_CMDLINE_STRING only works on Windows");
|
||||
return TEST_SKIPPED;
|
||||
#else
|
||||
|
||||
TestProcessData *data = (TestProcessData *)arg;
|
||||
const char *process_args[] = {
|
||||
data->childprocess_path,
|
||||
@@ -1082,11 +1090,6 @@ static int process_testWindowsCmdlinePrecedence(void *arg)
|
||||
int exit_code;
|
||||
size_t total_read = 0;
|
||||
|
||||
#ifndef SDL_PLATFORM_WINDOWS
|
||||
SDLTest_AssertPass("SDL_PROP_PROCESS_CREATE_CMDLINE_STRING only works on Windows");
|
||||
return TEST_SKIPPED;
|
||||
#endif
|
||||
|
||||
props = SDL_CreateProperties();
|
||||
SDLTest_AssertCheck(props != 0, "SDL_CreateProperties()");
|
||||
if (!props) {
|
||||
@@ -1125,6 +1128,7 @@ static int process_testWindowsCmdlinePrecedence(void *arg)
|
||||
failed:
|
||||
SDL_DestroyProcess(process);
|
||||
return TEST_ABORTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const SDLTest_TestCaseReference processTestArguments = {
|
||||
|
||||
Reference in New Issue
Block a user