add --enable-more-warnings=yes/no and fix up resulting errors

This commit is contained in:
Dan Williams
2009-02-10 06:48:56 -05:00
parent 618db2dd8a
commit bef9c48ffc
18 changed files with 86 additions and 42 deletions

View File

@@ -26,6 +26,35 @@ AC_SUBST(DBUS_SYS_DIR)
GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0` GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL) 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])) AC_ARG_WITH(docs, AC_HELP_STRING([--with-docs], [Build ModemManager documentation]))
AM_CONDITIONAL(WITH_DOCS, test "x$with_docs" = "xyes") AM_CONDITIONAL(WITH_DOCS, test "x$with_docs" = "xyes")
case $with_docs in case $with_docs in

View File

@@ -254,7 +254,7 @@ modem_enable_done (MMSerial *serial,
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -263,7 +263,7 @@ enable (MMModem *modem,
info = mm_callback_info_new (modem, callback, user_data); info = mm_callback_info_new (modem, callback, user_data);
mm_callback_info_set_data (info, "enable", GINT_TO_POINTER (enable), NULL); 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); modem_enable_done (MM_SERIAL (modem), NULL, NULL, info);
else else
mm_serial_queue_command (MM_SERIAL (modem), "AT_OWANCALL=1,0,0", 3, modem_enable_done, info); 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); dns_array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 2);
items = g_strsplit (response->str + strlen (OWANDATA_TAG), ", ", 0); items = g_strsplit (response->str + strlen (OWANDATA_TAG), ", ", 0);
for (iter = items, i = 0; *iter; iter++, i++) { for (iter = items, i = 0; *iter; iter++, i++) {
if (i == 0) { /* CID */ if (i == 0) { /* CID */
long int tmp; long int num;
errno = 0; errno = 0;
tmp = strtol (*iter, NULL, 10); num = strtol (*iter, NULL, 10);
if (errno != 0 || tmp < 0 || (guint) tmp != cid) { if (errno != 0 || num < 0 || (guint) num != cid) {
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
"Unknown CID in OWANDATA response (got %d, expected %d)", (guint) tmp, cid); "Unknown CID in OWANDATA response ("
break; "got %d, expected %d)", (guint) num, cid);
} break;
} else if (i == 1) { /* IP address */ }
if (inet_pton (AF_INET, *iter, &tmp) > 0) } 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); mm_callback_info_set_data (info, "ip4-address", GUINT_TO_POINTER (tmp), NULL);
} else if (i == 3) { /* DNS 1 */ } else if (i == 3) { /* DNS 1 */
if (inet_pton (AF_INET, *iter, &tmp) > 0) if (inet_pton (AF_INET, *iter, &tmp) > 0)
g_array_append_val (dns_array, tmp); g_array_append_val (dns_array, tmp);
} else if (i == 4) { /* DNS 2 */ } else if (i == 4) { /* DNS 2 */
if (inet_pton (AF_INET, *iter, &tmp) > 0) if (inet_pton (AF_INET, *iter, &tmp) > 0)
g_array_append_val (dns_array, tmp); g_array_append_val (dns_array, tmp);
} }
} }
g_strfreev (items); g_strfreev (items);
mm_callback_info_set_data (info, "ip4-dns", dns_array, free_dns_array); mm_callback_info_set_data (info, "ip4-dns", dns_array, free_dns_array);

View File

@@ -128,7 +128,7 @@ parent_enable_done (MMModem *modem, GError *error, gpointer user_data)
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -136,14 +136,14 @@ enable (MMModem *modem,
parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (modem)); parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (modem));
if (enable) { if (do_enable) {
MMCallbackInfo *info; MMCallbackInfo *info;
info = mm_callback_info_new (modem, callback, user_data); 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 { } else {
pending_registration_stop (MM_MODEM_HUAWEI (modem)); 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);
} }
} }

View File

@@ -234,7 +234,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data)
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -245,7 +245,7 @@ enable (MMModem *modem,
info = mm_callback_info_new (modem, callback, user_data); info = mm_callback_info_new (modem, callback, user_data);
if (!enable) { if (!do_enable) {
if (mm_serial_is_connected (MM_SERIAL (modem))) if (mm_serial_is_connected (MM_SERIAL (modem)))
mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info);
else else

View File

@@ -97,7 +97,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data)
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -108,7 +108,7 @@ enable (MMModem *modem,
info = mm_callback_info_new (modem, callback, user_data); info = mm_callback_info_new (modem, callback, user_data);
if (!enable) { if (!do_enable) {
if (mm_serial_is_connected (MM_SERIAL (modem))) if (mm_serial_is_connected (MM_SERIAL (modem)))
mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info);
else else

View File

@@ -65,7 +65,7 @@ parent_enable_done (MMModem *modem, GError *error, gpointer user_data)
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -73,10 +73,10 @@ enable (MMModem *modem,
MMCallbackInfo *info; MMCallbackInfo *info;
info = mm_callback_info_new (modem, callback, user_data); 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 = 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 static void

View File

@@ -82,7 +82,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data)
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -92,9 +92,9 @@ enable (MMModem *modem,
mm_generic_gsm_set_cid (MM_GENERIC_GSM (modem), 0); mm_generic_gsm_set_cid (MM_GENERIC_GSM (modem), 0);
info = mm_callback_info_new (modem, callback, user_data); 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))) if (mm_serial_is_connected (MM_SERIAL (modem)))
mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info);
else else

View File

@@ -23,4 +23,6 @@ typedef struct {
GType mm_plugin_hso_get_type (void); GType mm_plugin_hso_get_type (void);
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
#endif /* MM_PLUGIN_HSO_H */ #endif /* MM_PLUGIN_HSO_H */

View File

@@ -23,4 +23,6 @@ typedef struct {
GType mm_plugin_huawei_get_type (void); GType mm_plugin_huawei_get_type (void);
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
#endif /* MM_PLUGIN_HUAWEI_H */ #endif /* MM_PLUGIN_HUAWEI_H */

View File

@@ -45,4 +45,6 @@ typedef struct {
GType mm_plugin_mbm_get_type (void); GType mm_plugin_mbm_get_type (void);
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
#endif /* MM_PLUGIN_MBM_H */ #endif /* MM_PLUGIN_MBM_H */

View File

@@ -23,4 +23,6 @@ typedef struct {
GType mm_plugin_novatel_get_type (void); GType mm_plugin_novatel_get_type (void);
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
#endif /* MM_PLUGIN_NOVATEL_H */ #endif /* MM_PLUGIN_NOVATEL_H */

View File

@@ -23,4 +23,6 @@ typedef struct {
GType mm_plugin_option_get_type (void); GType mm_plugin_option_get_type (void);
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
#endif /* MM_PLUGIN_OPTION_H */ #endif /* MM_PLUGIN_OPTION_H */

View File

@@ -23,4 +23,6 @@ typedef struct {
GType mm_plugin_sierra_get_type (void); GType mm_plugin_sierra_get_type (void);
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
#endif /* MM_PLUGIN_SIERRA_H */ #endif /* MM_PLUGIN_SIERRA_H */

View File

@@ -1,5 +1,6 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <signal.h>
#include <syslog.h> #include <syslog.h>
#include <dbus/dbus-glib.h> #include <dbus/dbus-glib.h>
#include "mm-manager.h" #include "mm-manager.h"

View File

@@ -77,7 +77,7 @@ flash_done (MMSerial *serial, gpointer user_data)
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -85,7 +85,7 @@ enable (MMModem *modem,
info = mm_callback_info_new (modem, callback, user_data); info = mm_callback_info_new (modem, callback, user_data);
if (!enable) { if (!do_enable) {
mm_serial_close (MM_SERIAL (modem)); mm_serial_close (MM_SERIAL (modem));
mm_callback_info_schedule (info); mm_callback_info_schedule (info);
return; return;

View File

@@ -192,7 +192,7 @@ disable_flash_done (MMSerial *serial, gpointer user_data)
static void static void
enable (MMModem *modem, enable (MMModem *modem,
gboolean enable, gboolean do_enable,
MMModemFn callback, MMModemFn callback,
gpointer user_data) gpointer user_data)
{ {
@@ -203,7 +203,7 @@ enable (MMModem *modem,
info = mm_callback_info_new (modem, callback, user_data); info = mm_callback_info_new (modem, callback, user_data);
if (!enable) { if (!do_enable) {
if (mm_serial_is_connected (MM_SERIAL (modem))) if (mm_serial_is_connected (MM_SERIAL (modem)))
mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info); mm_serial_flash (MM_SERIAL (modem), 1000, disable_flash_done, info);
else else

View File

@@ -85,7 +85,7 @@ impl_modem_simple_connect (MMModemSimple *self,
} }
static void static void
get_status_done (MMModem *modem, get_status_done (MMModemSimple *modem,
GHashTable *properties, GHashTable *properties,
GError *error, GError *error,
gpointer user_data) gpointer user_data)

View File

@@ -93,7 +93,8 @@ mm_serial_parser_v0_parse (gpointer data,
if (str) { if (str) {
code = atoi (str); code = atoi (str);
g_free (str); g_free (str);
} } else
code = MM_MOBILE_ERROR_UNKNOWN;
g_match_info_free (match_info); g_match_info_free (match_info);