aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2015-09-02 17:51:21 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2015-09-02 17:51:21 +0200
commit7f455719eb619a34ce74cc08711bdabc4f129eaa (patch)
treeb22fc4ae20fded60ebb04bb64d11dc71a0b43f76
parentf3d9a8e93134574c50dfea2147628468d6770f04 (diff)
downloadrelabsd-7f455719eb619a34ce74cc08711bdabc4f129eaa.zip
relabsd-7f455719eb619a34ce74cc08711bdabc4f129eaa.tar.bz2
Adds much needed verbose flags to the compiler and corrects the issues they pointed out.
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/axis.c21
-rw-r--r--src/config.c2
-rw-r--r--src/input.c5
-rw-r--r--src/main.c4
-rw-r--r--src/relabsd_device.c6
6 files changed, 38 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1ca449..1c788ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,3 +14,10 @@ add_executable(relabsd ${SRC_FILES})
pkg_search_module(LIBEVDEV REQUIRED libevdev)
include_directories(${LIBEVDEV_INCLUDE_DIRS})
target_link_libraries(relabsd ${LIBEVDEV_LIBRARIES})
+target_compile_features(relabsd PUBLIC c_variadic_macros)
+
+if (CMAKE_COMPILER_IS_GNUCC)
+ message(STATUS "CMake is using GNUCC. Verbose flags are activated.")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra")
+endif (CMAKE_COMPILER_IS_GNUCC)
+
diff --git a/src/axis.c b/src/axis.c
index 34340f7..bf9a6fc 100644
--- a/src/axis.c
+++ b/src/axis.c
@@ -78,7 +78,14 @@ char * relabsd_axis_to_name (enum relabsd_axis const e)
case RELABSD_UNKNOWN:
return "??";
+
+ default:
+ break;
}
+
+ _S_PROG_ERROR("relabsd_axis_to_name is missing at least 1 case.");
+
+ return "..";
}
enum relabsd_axis relabsd_axis_convert_evdev_rel
@@ -157,7 +164,14 @@ unsigned int relabsd_axis_to_rel (enum relabsd_axis const e)
case RELABSD_UNKNOWN:
_S_PROG_ERROR("relabsd_axis_to_rel(RELABSD_UNKNOWN) is forbidden.");
return REL_MAX;
+
+ default:
+ break;
}
+
+ _S_PROG_ERROR("relabsd_axis_to_rel is missing at least 1 case.");
+
+ return REL_MAX;
}
unsigned int relabsd_axis_to_abs (enum relabsd_axis const e)
@@ -191,7 +205,14 @@ unsigned int relabsd_axis_to_abs (enum relabsd_axis const e)
case RELABSD_UNKNOWN:
_S_PROG_ERROR("relabsd_axis_to_abs(RELABSD_UNKNOWN) is forbidden.");
return ABS_MAX;
+
+ default:
+ break;
}
+
+ _S_PROG_ERROR("relabsd_axis_to_rel is missing at least 1 case.");
+
+ return REL_MAX;
}
/*
diff --git a/src/config.c b/src/config.c
index 3fdea03..d4288ef 100644
--- a/src/config.c
+++ b/src/config.c
@@ -336,7 +336,7 @@ int relabsd_config_filter
/* TODO: handle the other properties. */
return 1;
-};
+}
void relabsd_config_get_absinfo
(
diff --git a/src/input.c b/src/input.c
index 2cba397..c91e405 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1,6 +1,7 @@
#include <fcntl.h>
#include <errno.h>
#include <string.h>
+#include <unistd.h>
#include <libevdev/libevdev.h>
@@ -90,7 +91,7 @@ int relabsd_input_open
{
_FATAL
(
- "Could not open device %s in read only mode:",
+ "Could not open device '%s' in read only mode: %s.",
conf->input_file,
strerror(errno)
);
@@ -105,7 +106,7 @@ int relabsd_input_open
{
_FATAL
(
- "libevdev could not open %s:",
+ "libevdev could not open '%s': %s.",
conf->input_file,
strerror(errno)
);
diff --git a/src/main.c b/src/main.c
index ebfe065..9eb3433 100644
--- a/src/main.c
+++ b/src/main.c
@@ -12,7 +12,7 @@
static int RELABSD_RUN = 1;
-static void interrupt (int signal_id)
+static void interrupt (int unused_mandatory_parameter)
{
RELABSD_RUN = 0;
@@ -58,7 +58,7 @@ static void convert_input
const struct relabsd_device * const dev
)
{
- unsigned int input_type, input_code, abs_code;
+ unsigned int input_type, input_code;
int value;
while (RELABSD_RUN == 1)
diff --git a/src/relabsd_device.c b/src/relabsd_device.c
index eb4da8b..174f1eb 100644
--- a/src/relabsd_device.c
+++ b/src/relabsd_device.c
@@ -3,6 +3,8 @@
#include <unistd.h>
#include <fcntl.h>
+#include <libevdev/libevdev-uinput.h>
+
#include "error.h"
#include "axis.h"
#include "config.h"
@@ -61,7 +63,7 @@ int relabsd_device_create
{
_FATAL
(
- "Could not open device %s in read only mode:",
+ "Could not open device '%s' in read only mode: %s.",
config->input_file,
strerror(errno)
);
@@ -73,7 +75,7 @@ int relabsd_device_create
{
_FATAL
(
- "libevdev could not open %s:",
+ "libevdev could not open '%s': '%s'.",
config->input_file,
strerror(errno)
);