Commit d5cc31f3 authored by spiiroin's avatar spiiroin

[usb-moded] Do not disable warnings that affect code quality

Compilation options such as: -Wno-unused-parameter and -Wno-unused-result
easily hide genuine issues.

Remove such relaxations and deal with issues that surface.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent cd8d5d24
......@@ -22,7 +22,7 @@ test_gcc_flag() {
# We use gnu99 instead of c99 because many have interpreted the standard
# in a way that int64_t isn't defined on non-64 bit platforms.
CFLAGS="-Os -std=gnu99 -Wall -Wextra -pipe -Wold-style-definition -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -finline-small-functions -Wno-unused-result -fstack-protector -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now -fPIE -fpie -pie"
CFLAGS="-Os -std=gnu99 -Wall -Wextra -pipe -Wold-style-definition -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -finline-small-functions -fstack-protector -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now -fPIE -fpie -pie"
LDFLAGS="-z relro -z now"
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[Enable debug @<:@default=false@:>@]),
......
......@@ -100,6 +100,8 @@ static int check_interface(char *interface)
static char* get_interface(struct mode_list_elem *data)
{
(void)data; // FIXME: why is this passed in the 1st place?
char *interface = 0;
char *setting = get_network_setting(NETWORK_INTERFACE_KEY);
......
......@@ -56,6 +56,8 @@ static void udev_parse(struct udev_device *dev);
static void notify_issue (gpointer data)
{
(void)data;
log_debug("trigger watch destroyed\n!");
/* clean up & restart trigger */
trigger_stop();
......
......@@ -70,6 +70,8 @@ static gboolean cable_connection_timeout_cb(gpointer data);
static void notify_issue (gpointer data)
{
(void)data;
/* we do not want to restart when we try to clean up */
if(cleanup)
return;
......@@ -335,6 +337,8 @@ static void setup_charger_connection(void)
static gboolean cable_connection_timeout_cb(gpointer data)
{
(void)data;
log_debug("connect delay: timeout");
cable_connection_timeout_id = 0;
......
......@@ -206,6 +206,8 @@ void set_usb_connected(gboolean connected)
static gboolean set_disconnected(gpointer data)
{
(void)data;
/* let usb settle */
usb_moded_sleep(1);
/* only disconnect for real if we are actually still disconnected */
......@@ -229,6 +231,8 @@ static gboolean set_disconnected(gpointer data)
/* set disconnected without sending signals. */
static gboolean set_disconnected_silent(gpointer data)
{
(void)data;
if(!get_usb_connection_state())
{
log_debug("Resetting connection data after HUP\n");
......@@ -787,6 +791,8 @@ static void usb_moded_cleanup(void)
/* charging fallback handler */
static gboolean charging_fallback(gpointer data)
{
(void)data;
/* if a mode has been set we don't want it changed to charging
* after 5 seconds. We set it to ask, so anything different
* means a mode has been set */
......@@ -1372,8 +1378,12 @@ int main(int argc, char* argv[])
/* silence usb_moded_system() calls */
if( log_get_type() != LOG_TO_STDERR && log_get_level() != LOG_DEBUG )
{
freopen("/dev/null", "a", stdout);
freopen("/dev/null", "a", stderr);
if( !freopen("/dev/null", "a", stdout) ) {
log_err("can't redirect stdout: %m");
}
if( !freopen("/dev/null", "a", stderr) ) {
log_err("can't redirect stderr: %m");
}
}
#if !GLIB_CHECK_VERSION(2, 36, 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment