[gnome-multi-writer] Use more GNOME_COMPILE_WARNINGS
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-multi-writer] Use more GNOME_COMPILE_WARNINGS
- Date: Mon, 15 Aug 2016 10:40:30 +0000 (UTC)
commit ac5e194578ce7ffd6f65bda34f6b12b0a2f689c9
Author: Richard Hughes <richard hughsie com>
Date: Mon Aug 15 11:40:06 2016 +0100
Use more GNOME_COMPILE_WARNINGS
configure.ac | 79 +++++++++++++++++-------------------------------------
src/Makefile.am | 4 +-
src/gmw-device.c | 28 +++++++++---------
src/gmw-main.c | 10 +++---
src/gmw-probe.c | 10 ++++---
5 files changed, 52 insertions(+), 79 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d826dd3..ecad01d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Copyright (C) 2011-2015 Richard Hughes <richard hughsie com>
AC_PREREQ(2.63)
-AC_INIT([gnome-multi-writer],[3.21.1],[http://www.gnome.org])
+AC_INIT([gnome-multi-writer],[3.21.90],[http://www.gnome.org])
AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz tar-ustar foreign])
AC_CONFIG_HEADERS([config.h])
@@ -30,59 +30,30 @@ AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE(GETTEXT_PACKAGE, "AC_PACKAGE_NAME", [foo])
AM_GLIB_GNU_GETTEXT
-dnl ---------------------------------------------------------------------------
-dnl - Use strict options (default enabled for devs, disabled in releases)
-dnl ---------------------------------------------------------------------------
-if test -d ".git"; then
- default_strict=yes
-else
- default_strict=no
-fi
-
-AC_ARG_ENABLE(strict, AS_HELP_STRING([--enable-strict],
- [Enable strict compilation options]),
- enable_strict=$enableval,
- enable_strict=$default_strict)
-if test x$enable_strict != xno; then
- CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
- CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED"
- CPPFLAGS="$CPPFLAGS -DGSEAL_ENABLE"
-fi
-
-dnl ---------------------------------------------------------------------------
-dnl - Extra verbose warning switches
-dnl ---------------------------------------------------------------------------
-
-if test "$GCC" = "yes"; then
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wall"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align -Wno-uninitialized"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-declarations"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wpointer-arith"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wwrite-strings"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Winit-self"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wreturn-type"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-nonliteral"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-security"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-include-dirs"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-format-attribute"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wclobbered"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wempty-body"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wignored-qualifiers"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wsign-compare"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wtype-limits"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wuninitialized"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Waggregate-return"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wdeclaration-after-statement"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type"
- WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init"
-else
- WARNINGFLAGS_C=""
-fi
-AC_SUBST(WARNINGFLAGS_C)
+dnl -------------
+GNOME_COMPILE_WARNINGS([maximum],[
+ -Wmissing-declarations
+ -Wcast-align
+ -Wwrite-strings
+ -Wreturn-type
+ -Wformat-nonliteral
+ -Wmissing-format-attribute
+ -Wclobbered
+ -Wempty-body
+ -Wignored-qualifiers
+ -Wsign-compare
+ -Wtype-limits
+ -Wuninitialized
+ -Waggregate-return
+ -Wdeclaration-after-statement
+ -Wshadow
+ -Wno-strict-aliasing
+ -Winline
+ -Wmissing-parameter-type
+ -Woverride-init
+ -Wno-discarded-qualifiers
+ -Wformat-signedness
+])
dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
diff --git a/src/Makefile.am b/src/Makefile.am
index eb185bf..a63dafd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,7 +22,7 @@ gnome_multi_writer_LDADD = \
$(UDISKS_LIBS)
gnome_multi_writer_CFLAGS = \
- $(WARNINGFLAGS_C)
+ $(WARN_CFLAGS)
gnome_multi_writer_SOURCES = \
gmw-cleanup.h \
@@ -37,7 +37,7 @@ gnome_multi_writer_probe_LDADD = \
$(GUDEV_LIBS)
gnome_multi_writer_probe_CFLAGS = \
- $(WARNINGFLAGS_C)
+ $(WARN_CFLAGS)
gnome_multi_writer_probe_SOURCES = \
gmw-cleanup.h \
diff --git a/src/gmw-device.c b/src/gmw-device.c
index 8ca46fe..7431647 100644
--- a/src/gmw-device.c
+++ b/src/gmw-device.c
@@ -675,8 +675,8 @@ gmw_device_get_quirk_string (GmwDevice *device)
/* parent */
usb_hub_top = gmw_device_get_toplevel_hub (device);
if (usb_hub_top == NULL) {
- g_string_append_printf (str, "0x%02x, ", 0x00);
- g_string_append_printf (str, "0x%04x, 0x%04x, ", 0x0000, 0x0000);
+ g_string_append_printf (str, "0x%02x, ", 0x00u);
+ g_string_append_printf (str, "0x%04x, 0x%04x, ", 0x0000u, 0x0000u);
} else {
g_string_append_printf (str, "0x%02x, ",
g_usb_device_get_port_number (usb_hub));
@@ -696,7 +696,7 @@ gmw_device_get_quirk_string (GmwDevice *device)
}
if (usb_hub_child == NULL) {
g_string_append_printf (str, "0x%04x, 0x%04x, ",
- 0x0000, 0x0000);
+ 0x0000u, 0x0000u);
} else {
g_string_append_printf (str, "0x%04x, 0x%04x, ",
g_usb_device_get_vid (usb_hub_child),
@@ -720,7 +720,7 @@ gmw_device_get_quirk_string (GmwDevice *device)
g_usb_device_get_port_number (priv->usb_device));
/* chain length */
- g_string_append_printf (str, "0x%01x, ", usb_hub_child ? 0x00 : 0x01);
+ g_string_append_printf (str, "0x%01x, ", usb_hub_child ? 0x00u : 0x01u);
/* label */
if (priv->hub_label == NULL)
@@ -925,15 +925,15 @@ gmw_device_set_usb_device (GmwDevice *device, GUsbDevice *usb_device)
g_debug ("Quirk info: 0x%04x:0x%04x@0x%02x -> "
"0x%04x:0x%04x@0x%02x -> "
"0x%04x:0x%04x@0x%02x",
- usb_hub_parent ? g_usb_device_get_vid (usb_hub_parent) : 0x0,
- usb_hub_parent ? g_usb_device_get_pid (usb_hub_parent) : 0x0,
- usb_hub_parent ? g_usb_device_get_port_number (usb_hub_parent) : 0x0,
- g_usb_device_get_vid (usb_hub),
- g_usb_device_get_pid (usb_hub),
- g_usb_device_get_port_number (usb_hub),
- g_usb_device_get_vid (usb_device),
- g_usb_device_get_pid (usb_device),
- g_usb_device_get_port_number (usb_device));
+ usb_hub_parent ? (guint) g_usb_device_get_vid (usb_hub_parent) : 0x0u,
+ usb_hub_parent ? (guint) g_usb_device_get_pid (usb_hub_parent) : 0x0u,
+ usb_hub_parent ? (guint) g_usb_device_get_port_number (usb_hub_parent) : 0x0u,
+ (guint) g_usb_device_get_vid (usb_hub),
+ (guint) g_usb_device_get_pid (usb_hub),
+ (guint) g_usb_device_get_port_number (usb_hub),
+ (guint) g_usb_device_get_vid (usb_device),
+ (guint) g_usb_device_get_pid (usb_device),
+ (guint) g_usb_device_get_port_number (usb_device));
for (i = 0; quirks[i].hub_label != NULL; i++) {
/* check grandparent */
if (usb_hub_parent != NULL && quirks[i].hub_parent_vid != 0x0000) {
@@ -988,7 +988,7 @@ gmw_device_set_usb_device (GmwDevice *device, GUsbDevice *usb_device)
child_cnt++;
}
if (child_cnt != quirks[i].number_ics) {
- g_debug ("no matching quirk %i != %i",
+ g_debug ("no matching quirk %u != %u",
child_cnt, quirks[i].number_ics);
continue;
}
diff --git a/src/gmw-main.c b/src/gmw-main.c
index d1ccc9d..76c5cdb 100644
--- a/src/gmw-main.c
+++ b/src/gmw-main.c
@@ -217,7 +217,7 @@ gmw_device_list_sort (GmwPrivate *priv)
if (rh->devices->len <= i)
continue;
device = g_ptr_array_index (rh->devices, i);
- key = g_strdup_printf ("%04i", idx++);
+ key = g_strdup_printf ("%04u", idx++);
gmw_device_set_order_process (device, key);
g_debug ("set sort key %s for [%02x:] %s", key,
rh->idx, gmw_device_get_block_path (device));
@@ -374,7 +374,7 @@ gmw_refresh_ui (GmwPrivate *priv)
gtk_widget_set_margin_start (w, 30);
if (gmw_device_get_hub_label (device) != NULL) {
if (priv->rename_labels) {
- label = g_strdup_printf ("%s [%s<a href=\"%i\">?</a>]",
+ label = g_strdup_printf ("%s [%s<a href=\"%u\">?</a>]",
gmw_device_get_hub_id (device),
gmw_device_get_hub_label (device), i);
} else {
@@ -384,7 +384,7 @@ gmw_refresh_ui (GmwPrivate *priv)
}
} else {
if (priv->rename_labels) {
- label = g_strdup_printf ("%s [<a href=\"%i\">?</a>]",
+ label = g_strdup_printf ("%s [<a href=\"%u\">?</a>]",
gmw_device_get_hub_id (device), i);
} else {
label = g_strdup (gmw_device_get_hub_id (device));
@@ -1151,7 +1151,7 @@ gmw_udisks_get_filesystem_for_device (GmwPrivate *priv, GmwDevice *device)
_cleanup_object_unref_ UDisksObject *udisks_object = NULL;
g_auto(GStrv) mtab = NULL;
- object_path = g_strdup_printf ("%s%i",
+ object_path = g_strdup_printf ("%s%u",
gmw_device_get_object_path (device),
i);
udisks_object = udisks_client_get_object (priv->udisks_client,
@@ -1691,7 +1691,7 @@ gmw_update_max_threads (GmwPrivate *priv)
root_hubs = gmw_root_hub_enumerate (priv->devices);
if (root_hubs->len > 0)
nr_root = root_hubs->len;
- g_debug ("%i root %s in use", nr_root, nr_root > 1 ? "hubs" : "hub");
+ g_debug ("%u root %s in use", nr_root, nr_root > 1 ? "hubs" : "hub");
g_thread_pool_set_max_threads (priv->thread_pool,
threads_per_root * nr_root,
NULL);
diff --git a/src/gmw-probe.c b/src/gmw-probe.c
index c7edda0..b1b8890 100644
--- a/src/gmw-probe.c
+++ b/src/gmw-probe.c
@@ -168,7 +168,8 @@ gmw_probe_device_read (GmwProbeDevice *dev, guint64 addr, guint8 *buf, gssize le
gsize bytes_read;
lseek (dev->fd, addr, SEEK_SET);
bytes_read = read (dev->fd, buf, len);
- g_debug ("read %" G_GSSIZE_FORMAT " @ %liMB", bytes_read, addr / ONE_MB);
+ g_debug ("read %" G_GSIZE_FORMAT " @ %" G_GUINT64_FORMAT "MB",
+ bytes_read, addr / ONE_MB);
return bytes_read;
}
@@ -181,7 +182,8 @@ gmw_probe_device_write (GmwProbeDevice *dev, guint64 addr, const guint8 *buf, gs
gsize bytes_written;
lseek (dev->fd, addr, SEEK_SET);
bytes_written = write (dev->fd, buf, len);
- g_debug ("wrote %" G_GSSIZE_FORMAT " @ %liMB", bytes_written, addr / ONE_MB);
+ g_debug ("wrote %" G_GSIZE_FORMAT " @ %" G_GUINT64_FORMAT "MB",
+ bytes_written, addr / ONE_MB);
return bytes_written;
}
@@ -391,7 +393,7 @@ gmw_probe_scan_device (GmwProbeDevice *dev, GCancellable *cancellable, GError **
g_set_error (error,
GMW_ERROR,
GMW_ERROR_FAILED,
- "Failed to write len at %liMB",
+ "Failed to write len at %" G_GUINT64_FORMAT "MB",
item->address / ONE_MB);
gmw_probe_device_data_restore (dev, cancellable, NULL);
return FALSE;
@@ -426,7 +428,7 @@ gmw_probe_scan_device (GmwProbeDevice *dev, GCancellable *cancellable, GError **
g_set_error (error,
GMW_ERROR,
GMW_ERROR_IS_FAKE,
- "Failed to verify data at %liMB",
+ "Failed to verify data at %" G_GUINT64_FORMAT "MB",
item->address / ONE_MB);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]