diff options
author | Dan Williams <dcbw@redhat.com> | 2009-02-10 06:48:56 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2009-02-10 06:48:56 -0500 |
commit | bef9c48ffc926b97a7c0b1d56b9de751e37efe69 (patch) | |
tree | d8b636b2144d91452b0a79393df81ed54c0192fc | |
parent | 618db2dd8ab255271f388c3c4a7ccbe8ad9a0ae4 (diff) |
add --enable-more-warnings=yes/no and fix up resulting errors
-rw-r--r-- | configure.in | 29 | ||||
-rw-r--r-- | plugins/mm-modem-hso.c | 47 | ||||
-rw-r--r-- | plugins/mm-modem-huawei.c | 8 | ||||
-rw-r--r-- | plugins/mm-modem-mbm.c | 4 | ||||
-rw-r--r-- | plugins/mm-modem-novatel.c | 4 | ||||
-rw-r--r-- | plugins/mm-modem-option.c | 6 | ||||
-rw-r--r-- | plugins/mm-modem-sierra.c | 6 | ||||
-rw-r--r-- | plugins/mm-plugin-hso.h | 2 | ||||
-rw-r--r-- | plugins/mm-plugin-huawei.h | 2 | ||||
-rw-r--r-- | plugins/mm-plugin-mbm.h | 2 | ||||
-rw-r--r-- | plugins/mm-plugin-novatel.h | 2 | ||||
-rw-r--r-- | plugins/mm-plugin-option.h | 2 | ||||
-rw-r--r-- | plugins/mm-plugin-sierra.h | 2 | ||||
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/mm-generic-cdma.c | 4 | ||||
-rw-r--r-- | src/mm-generic-gsm.c | 4 | ||||
-rw-r--r-- | src/mm-modem-simple.c | 2 | ||||
-rw-r--r-- | src/mm-serial-parsers.c | 3 |
18 files changed, 87 insertions, 43 deletions
diff --git a/configure.in b/configure.in index 46bb885e..5da50126 100644 --- a/configure.in +++ b/configure.in @@ -26,6 +26,35 @@ AC_SUBST(DBUS_SYS_DIR) GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0` AC_SUBST(GLIB_GENMARSHAL) +AC_ARG_ENABLE(more-warnings, +AS_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]), set_more_warnings="$enableval",set_more_warnings=yes) +AC_MSG_CHECKING(for more warnings, including -Werror) +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + AC_MSG_RESULT(yes) + CFLAGS="-Wall -Werror -std=gnu89 $CFLAGS" + + for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \ + -Wdeclaration-after-statement -Wstrict-prototypes \ + -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \ + -fno-strict-aliasing; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + if test $has_option = no; then + CFLAGS="$SAVE_CFLAGS" + fi + AC_MSG_RESULT($has_option) + unset has_option + unset SAVE_CFLAGS + done + unset option +else + AC_MSG_RESULT(no) +fi + AC_ARG_WITH(docs, AC_HELP_STRING([--with-docs], [Build ModemManager documentation])) AM_CONDITIONAL(WITH_DOCS, test "x$with_docs" = "xyes") case $with_docs in diff --git a/plugins/mm-modem-hso.c b/plugins/mm-modem-hso.c index bf901056..9c9d7d20 100644 --- a/plugins/mm-modem-hso.c +++ b/plugins/mm-modem-hso.c @@ -254,7 +254,7 @@ modem_enable_done (MMSerial *serial, static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -263,7 +263,7 @@ enable (MMModem *modem, info = mm_callback_info_new (modem, callback, user_data); mm_callback_info_set_data (info, "enable", GINT_TO_POINTER (enable), NULL); - if (enable) + if (do_enable) modem_enable_done (MM_SERIAL (modem), NULL, NULL, info); else mm_serial_queue_command (MM_SERIAL (modem), "AT_OWANCALL=1,0,0", 3, modem_enable_done, info); @@ -325,28 +325,29 @@ get_ip4_config_done (MMSerial *serial, dns_array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 2); items = g_strsplit (response->str + strlen (OWANDATA_TAG), ", ", 0); - for (iter = items, i = 0; *iter; iter++, i++) { - if (i == 0) { /* CID */ - long int tmp; - - errno = 0; - tmp = strtol (*iter, NULL, 10); - if (errno != 0 || tmp < 0 || (guint) tmp != cid) { - info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, - "Unknown CID in OWANDATA response (got %d, expected %d)", (guint) tmp, cid); - break; - } - } else if (i == 1) { /* IP address */ - if (inet_pton (AF_INET, *iter, &tmp) > 0) + for (iter = items, i = 0; *iter; iter++, i++) { + if (i == 0) { /* CID */ + long int num; + + errno = 0; + num = strtol (*iter, NULL, 10); + if (errno != 0 || num < 0 || (guint) num != cid) { + info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, + "Unknown CID in OWANDATA response (" + "got %d, expected %d)", (guint) num, cid); + break; + } + } else if (i == 1) { /* IP address */ + if (inet_pton (AF_INET, *iter, &tmp) > 0) mm_callback_info_set_data (info, "ip4-address", GUINT_TO_POINTER (tmp), NULL); - } else if (i == 3) { /* DNS 1 */ - if (inet_pton (AF_INET, *iter, &tmp) > 0) - g_array_append_val (dns_array, tmp); - } else if (i == 4) { /* DNS 2 */ - if (inet_pton (AF_INET, *iter, &tmp) > 0) - g_array_append_val (dns_array, tmp); - } - } + } else if (i == 3) { /* DNS 1 */ + if (inet_pton (AF_INET, *iter, &tmp) > 0) + g_array_append_val (dns_array, tmp); + } else if (i == 4) { /* DNS 2 */ + if (inet_pton (AF_INET, *iter, &tmp) > 0) + g_array_append_val (dns_array, tmp); + } + } g_strfreev (items); mm_callback_info_set_data (info, "ip4-dns", dns_array, free_dns_array); diff --git a/plugins/mm-modem-huawei.c b/plugins/mm-modem-huawei.c index d503d17e..e607ce7f 100644 --- a/plugins/mm-modem-huawei.c +++ b/plugins/mm-modem-huawei.c @@ -128,7 +128,7 @@ parent_enable_done (MMModem *modem, GError *error, gpointer user_data) static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -136,14 +136,14 @@ enable (MMModem *modem, parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (modem)); - if (enable) { + if (do_enable) { MMCallbackInfo *info; info = mm_callback_info_new (modem, callback, user_data); - parent_modem_iface->enable (modem, enable, parent_enable_done, info); + parent_modem_iface->enable (modem, do_enable, parent_enable_done, info); } else { pending_registration_stop (MM_MODEM_HUAWEI (modem)); - parent_modem_iface->enable (modem, enable, callback, user_data); + parent_modem_iface->enable (modem, do_enable, callback, user_data); } } diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c index dbfe70c3..966ae35b 100644 --- a/plugins/mm-modem-mbm.c +++ b/plugins/mm-modem-mbm.c @@ -234,7 +234,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data) static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -245,7 +245,7 @@ enable (MMModem *modem, info = mm_callback_info_new (modem, callback, user_data); - if (!enable) { + if (!do_enable) { if (mm_serial_is_connected (MM_SERIAL (modem))) mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); else diff --git a/plugins/mm-modem-novatel.c b/plugins/mm-modem-novatel.c index 00188fd3..c0da1eef 100644 --- a/plugins/mm-modem-novatel.c +++ b/plugins/mm-modem-novatel.c @@ -97,7 +97,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data) static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -108,7 +108,7 @@ enable (MMModem *modem, info = mm_callback_info_new (modem, callback, user_data); - if (!enable) { + if (!do_enable) { if (mm_serial_is_connected (MM_SERIAL (modem))) mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); else diff --git a/plugins/mm-modem-option.c b/plugins/mm-modem-option.c index c09d1df4..8a587908 100644 --- a/plugins/mm-modem-option.c +++ b/plugins/mm-modem-option.c @@ -65,7 +65,7 @@ parent_enable_done (MMModem *modem, GError *error, gpointer user_data) static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -73,10 +73,10 @@ enable (MMModem *modem, MMCallbackInfo *info; info = mm_callback_info_new (modem, callback, user_data); - mm_callback_info_set_data (info, "option-enable", GINT_TO_POINTER (enable), NULL); + mm_callback_info_set_data (info, "option-enable", GINT_TO_POINTER (do_enable), NULL); parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (modem)); - parent_modem_iface->enable (modem, enable, parent_enable_done, info); + parent_modem_iface->enable (modem, do_enable, parent_enable_done, info); } static void diff --git a/plugins/mm-modem-sierra.c b/plugins/mm-modem-sierra.c index 4b5389a5..4040ed84 100644 --- a/plugins/mm-modem-sierra.c +++ b/plugins/mm-modem-sierra.c @@ -82,7 +82,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data) static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -92,9 +92,9 @@ enable (MMModem *modem, mm_generic_gsm_set_cid (MM_GENERIC_GSM (modem), 0); info = mm_callback_info_new (modem, callback, user_data); - mm_callback_info_set_data (info, "sierra-enable", GINT_TO_POINTER (enable), NULL); + mm_callback_info_set_data (info, "sierra-enable", GINT_TO_POINTER (do_enable), NULL); - if (!enable) { + if (!do_enable) { if (mm_serial_is_connected (MM_SERIAL (modem))) mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); else diff --git a/plugins/mm-plugin-hso.h b/plugins/mm-plugin-hso.h index f8ead6d6..2395837c 100644 --- a/plugins/mm-plugin-hso.h +++ b/plugins/mm-plugin-hso.h @@ -23,4 +23,6 @@ typedef struct { GType mm_plugin_hso_get_type (void); +G_MODULE_EXPORT MMPlugin *mm_plugin_create (void); + #endif /* MM_PLUGIN_HSO_H */ diff --git a/plugins/mm-plugin-huawei.h b/plugins/mm-plugin-huawei.h index 291c18d9..e37a3a7a 100644 --- a/plugins/mm-plugin-huawei.h +++ b/plugins/mm-plugin-huawei.h @@ -23,4 +23,6 @@ typedef struct { GType mm_plugin_huawei_get_type (void); +G_MODULE_EXPORT MMPlugin *mm_plugin_create (void); + #endif /* MM_PLUGIN_HUAWEI_H */ diff --git a/plugins/mm-plugin-mbm.h b/plugins/mm-plugin-mbm.h index 4c6a6d08..72cd28f0 100644 --- a/plugins/mm-plugin-mbm.h +++ b/plugins/mm-plugin-mbm.h @@ -45,4 +45,6 @@ typedef struct { GType mm_plugin_mbm_get_type (void); +G_MODULE_EXPORT MMPlugin *mm_plugin_create (void); + #endif /* MM_PLUGIN_MBM_H */ diff --git a/plugins/mm-plugin-novatel.h b/plugins/mm-plugin-novatel.h index ac3e46d6..fbbf9735 100644 --- a/plugins/mm-plugin-novatel.h +++ b/plugins/mm-plugin-novatel.h @@ -23,4 +23,6 @@ typedef struct { GType mm_plugin_novatel_get_type (void); +G_MODULE_EXPORT MMPlugin *mm_plugin_create (void); + #endif /* MM_PLUGIN_NOVATEL_H */ diff --git a/plugins/mm-plugin-option.h b/plugins/mm-plugin-option.h index 2cc7560f..7ac7e8a5 100644 --- a/plugins/mm-plugin-option.h +++ b/plugins/mm-plugin-option.h @@ -23,4 +23,6 @@ typedef struct { GType mm_plugin_option_get_type (void); +G_MODULE_EXPORT MMPlugin *mm_plugin_create (void); + #endif /* MM_PLUGIN_OPTION_H */ diff --git a/plugins/mm-plugin-sierra.h b/plugins/mm-plugin-sierra.h index 31334d1b..b2473acb 100644 --- a/plugins/mm-plugin-sierra.h +++ b/plugins/mm-plugin-sierra.h @@ -23,4 +23,6 @@ typedef struct { GType mm_plugin_sierra_get_type (void); +G_MODULE_EXPORT MMPlugin *mm_plugin_create (void); + #endif /* MM_PLUGIN_SIERRA_H */ @@ -1,5 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include <signal.h> #include <syslog.h> #include <dbus/dbus-glib.h> #include "mm-manager.h" diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c index eb9e25b0..de8c916a 100644 --- a/src/mm-generic-cdma.c +++ b/src/mm-generic-cdma.c @@ -77,7 +77,7 @@ flash_done (MMSerial *serial, gpointer user_data) static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -85,7 +85,7 @@ enable (MMModem *modem, info = mm_callback_info_new (modem, callback, user_data); - if (!enable) { + if (!do_enable) { mm_serial_close (MM_SERIAL (modem)); mm_callback_info_schedule (info); return; diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index b4475cdc..a76cd698 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -192,7 +192,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data) static void enable (MMModem *modem, - gboolean enable, + gboolean do_enable, MMModemFn callback, gpointer user_data) { @@ -203,7 +203,7 @@ enable (MMModem *modem, info = mm_callback_info_new (modem, callback, user_data); - if (!enable) { + if (!do_enable) { if (mm_serial_is_connected (MM_SERIAL (modem))) mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); else diff --git a/src/mm-modem-simple.c b/src/mm-modem-simple.c index 62819cf7..713098f5 100644 --- a/src/mm-modem-simple.c +++ b/src/mm-modem-simple.c @@ -85,7 +85,7 @@ impl_modem_simple_connect (MMModemSimple *self, } static void -get_status_done (MMModem *modem, +get_status_done (MMModemSimple *modem, GHashTable *properties, GError *error, gpointer user_data) diff --git a/src/mm-serial-parsers.c b/src/mm-serial-parsers.c index 5f0da7ce..2f4e2a96 100644 --- a/src/mm-serial-parsers.c +++ b/src/mm-serial-parsers.c @@ -93,7 +93,8 @@ mm_serial_parser_v0_parse (gpointer data, if (str) { code = atoi (str); g_free (str); - } + } else + code = MM_MOBILE_ERROR_UNKNOWN; g_match_info_free (match_info); |