foxygit / doom Log in
commit 51ab62f6fb06b42c80c98ea71ab29d208d10e422
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Tue Feb 17 12:00:04 2015 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Tue Feb 17 12:00:04 2015 +0100

    setup: fix "control reaches end of non-void function" compiler warning

    Actually, it is impossible to reach the end of these two functions
    without return()ing earlier from one of the switch() statements'
    branches. But since the compiler cannot know this and warns about it,
    and since this warning can be escalated into an error in later
    compiler versions, silence it by return()ing a dummy value at the end
    of each function.

    Fixes #508
---
 src/setup/txt_joyaxis.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/setup/txt_joyaxis.c b/src/setup/txt_joyaxis.c
index 4747a4ff..5e59b9f7 100644
--- a/src/setup/txt_joyaxis.c
+++ b/src/setup/txt_joyaxis.c
@@ -63,6 +63,8 @@ static char *CalibrationLabel(txt_joystick_axis_t *joystick_axis)
                        "right, and press the button.";
             }
     }
+
+    return NULL;
 }

 static void SetCalibrationLabel(txt_joystick_axis_t *joystick_axis)
@@ -265,6 +267,8 @@ static int NextCalibrateStage(txt_joystick_axis_t *joystick_axis)
         case CONFIG_STAGE2:
             return CONFIG_CENTER;
     }
+
+    return -1;
 }

 static int EventCallback(SDL_Event *event, TXT_UNCAST_ARG(joystick_axis))