[gnome-packagekit] Use more GNOME_COMPILE_WARNINGS
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-packagekit] Use more GNOME_COMPILE_WARNINGS
- Date: Mon, 15 Aug 2016 10:25:23 +0000 (UTC)
commit 37d00efd7d271d645f27deb0524fda986bcf6c5b
Author: Richard Hughes <richard hughsie com>
Date: Mon Aug 15 11:20:45 2016 +0100
Use more GNOME_COMPILE_WARNINGS
configure.ac | 65 ++++++++++++++++------------------------------
src/Makefile.am | 59 ++++++++++++++++++------------------------
src/gpk-common.c | 4 +-
src/gpk-enum.c | 6 ++--
src/gpk-log.c | 4 +-
src/gpk-prefs.c | 2 +-
src/gpk-update-viewer.c | 12 ++++----
7 files changed, 63 insertions(+), 89 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8553b3d..dd0e4cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,48 +20,29 @@ GTK_DOC_CHECK(1.9)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
-dnl ---------------------------------------------------------------------------
-dnl - Use strict options (default enabled for devs, disabled in releases)
-dnl ---------------------------------------------------------------------------
-
-dnl if .git directory is present, considering we are working in the repository
-if test -d ".git"; then
- default_strict=yes
-else
- default_strict=no
-fi
-
-dnl ---------------------------------------------------------------------------
-dnl - Extra verbose warning switches
-dnl ---------------------------------------------------------------------------
-if test "$GCC" = "yes"; then
- CPPFLAGS="$CPPFLAGS -Wall -Wreturn-type"
-# CPPFLAGS="$CPPFLAGS -Wextra"
- CPPFLAGS="$CPPFLAGS -Wdeclaration-after-statement"
-# CPPFLAGS="$CPPFLAGS -Wmissing-declarations"
- CPPFLAGS="$CPPFLAGS -Wno-uninitialized"
-# CPPFLAGS="$CPPFLAGS -Wredundant-decls"
- CPPFLAGS="$CPPFLAGS -Wshadow"
- CPPFLAGS="$CPPFLAGS -Wpointer-arith"
- CPPFLAGS="$CPPFLAGS -Wcast-align"
- CPPFLAGS="$CPPFLAGS -Wwrite-strings"
- CPPFLAGS="$CPPFLAGS -Winline"
- CPPFLAGS="$CPPFLAGS -Wformat-nonliteral"
- CPPFLAGS="$CPPFLAGS -Wformat-security"
- CPPFLAGS="$CPPFLAGS -Wswitch-default"
- CPPFLAGS="$CPPFLAGS -Winit-self"
- CPPFLAGS="$CPPFLAGS -Wmissing-include-dirs"
- CPPFLAGS="$CPPFLAGS -Wno-strict-aliasing"
- CPPFLAGS="$CPPFLAGS -Wundef"
- CPPFLAGS="$CPPFLAGS -Waggregate-return"
- CPPFLAGS="$CPPFLAGS -Wmissing-format-attribute"
-fi
-
-dnl ---------------------------------------------------------------------------
-dnl - Debugging switches (uncomment this if you want to use gdb)
-dnl ---------------------------------------------------------------------------
-#CPPFLAGS="$CPPFLAGS -g"
-#CPPFLAGS="$CPPFLAGS -fexceptions"
+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 - xsltproc
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e5e93c..0dc96de 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,8 +1,6 @@
## We require new-style dependency handling.
AUTOMAKE_OPTIONS = 1.7
-NULL =
-
AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GIO_CFLAGS) \
@@ -24,15 +22,13 @@ AM_CPPFLAGS = \
-DLOCALEDIR=\""$(localedir)"\" \
-DVERSION="\"$(VERSION)\"" \
-DGPK_DATA=\"$(pkgdatadir)\" \
- -DG_LOG_DOMAIN=\"GnomePackageKit\" \
- $(NULL)
+ -DG_LOG_DOMAIN=\"GnomePackageKit\"
bin_PROGRAMS = \
gpk-application \
gpk-prefs \
gpk-update-viewer \
- gpk-log \
- $(NULL)
+ gpk-log
noinst_LIBRARIES = libgpkshared.a
libgpkshared_a_SOURCES = \
@@ -47,8 +43,7 @@ libgpkshared_a_SOURCES = \
gpk-task.c \
gpk-task.h \
gpk-error.c \
- gpk-error.h \
- $(NULL)
+ gpk-error.h
if WITH_SYSTEMD
libgpkshared_a_SOURCES += \
@@ -65,19 +60,16 @@ shared_LIBS = \
$(SYSTEMD_LIBS) \
$(PACKAGEKIT_LIBS) \
$(GNOME_MENUS_LIBS) \
- $(CANBERRA_LIBS) \
- $(NULL)
+ $(CANBERRA_LIBS)
gpk_application_SOURCES = \
gpk-application.c \
gpk-application-resources.c \
- gpk-application-resources.h \
- $(NULL)
+ gpk-application-resources.h
gpk_application_LDADD = \
libgpkshared.a \
- $(shared_LIBS) \
- $(NULL)
+ $(shared_LIBS)
gpk_prefs_SOURCES = \
gpk-debug.h \
@@ -90,14 +82,16 @@ gpk_prefs_SOURCES = \
gpk-error.h \
gpk-prefs.c \
gpk-prefs-resources.c \
- gpk-prefs-resources.h \
- $(NULL)
+ gpk-prefs-resources.h
gpk_prefs_LDADD = \
libgpkshared.a \
$(shared_LIBS) \
-lm
+gpk_prefs_CFLAGS = \
+ $(WARN_CFLAGS)
+
gpk_update_viewer_SOURCES = \
gpk-update-viewer.c \
gpk-update-viewer-resources.c \
@@ -107,24 +101,26 @@ gpk_update_viewer_SOURCES = \
gpk-cell-renderer-info.c \
gpk-cell-renderer-info.h \
gpk-cell-renderer-restart.c \
- gpk-cell-renderer-restart.h \
- $(NULL)
+ gpk-cell-renderer-restart.h
gpk_update_viewer_LDADD = \
libgpkshared.a \
- $(shared_LIBS) \
- $(NULL)
+ $(shared_LIBS)
+
+gpk_update_viewer_CFLAGS = \
+ $(WARN_CFLAGS)
gpk_log_SOURCES = \
gpk-log.c \
gpk-log-resources.c \
- gpk-log-resources.h \
- $(NULL)
+ gpk-log-resources.h
gpk_log_LDADD = \
libgpkshared.a \
- $(shared_LIBS) \
- $(NULL)
+ $(shared_LIBS)
+
+gpk_log_CFLAGS = \
+ $(WARN_CFLAGS)
if EGG_BUILD_TESTS
@@ -147,15 +143,14 @@ gpk_self_test_SOURCES = \
gpk-task.c \
gpk-task.h \
gpk-dialog.c \
- gpk-dialog.h \
- $(NULL)
+ gpk-dialog.h
gpk_self_test_LDADD = \
$(shared_LIBS) \
- $(SELFTEST_LIBS) \
- $(NULL)
+ $(SELFTEST_LIBS)
-gpk_self_test_CFLAGS = $(AM_CFLAGS)
+gpk_self_test_CFLAGS = \
+ $(WARN_CFLAGS)
TESTS = gpk-self-test
endif
@@ -188,8 +183,7 @@ BUILT_SOURCES = \
gpk-prefs-resources.c \
gpk-prefs-resources.h \
gpk-update-viewer-resources.c \
- gpk-update-viewer-resources.h \
- $(NULL)
+ gpk-update-viewer-resources.h
EXTRA_DIST = \
gpk-application.gresource.xml \
@@ -217,7 +211,6 @@ CLEANFILES = *~ $(BUILT_SOURCES) $(noinst_LIBRARIES)
MAINTAINERCLEANFILES = \
*~ \
- Makefile.in \
- $(NULL)
+ Makefile.in
-include $(top_srcdir)/git.mk
diff --git a/src/gpk-common.c b/src/gpk-common.c
index 287f2a2..893f81b 100644
--- a/src/gpk-common.c
+++ b/src/gpk-common.c
@@ -106,7 +106,7 @@ gpk_window_set_size_request (GtkWindow *window, guint width, guint height)
goto out;
#endif
/* normal size laptop panel */
- g_debug ("using native mode: %ix%i", width, height);
+ g_debug ("using native mode: %ux%u", width, height);
gtk_window_set_default_size (window, width, height);
small_form_factor_mode = FALSE;
out:
@@ -271,7 +271,7 @@ gpk_check_privileged_user (const gchar *application_name, gboolean show_ui)
/* user did not agree to run insecure */
if (result != GTK_RESPONSE_OK) {
- g_warning ("uid=%i so closing", uid);
+ g_warning ("uid=%u so closing", uid);
return FALSE;
}
}
diff --git a/src/gpk-enum.c b/src/gpk-enum.c
index 397581c..4f15fae 100644
--- a/src/gpk-enum.c
+++ b/src/gpk-enum.c
@@ -705,7 +705,7 @@ gpk_restart_enum_to_localised_text_future (PkRestartEnum restart)
text = _("A restart will be required due to a security update.");
break;
default:
- g_warning ("restart unrecognized: %i", restart);
+ g_warning ("restart unrecognized: %u", restart);
}
return text;
}
@@ -734,7 +734,7 @@ gpk_restart_enum_to_localised_text (PkRestartEnum restart)
text = _("A restart is required to remain secure.");
break;
default:
- g_warning ("restart unrecognized: %i", restart);
+ g_warning ("restart unrecognized: %u", restart);
}
return text;
}
@@ -1328,7 +1328,7 @@ gpk_group_enum_to_localised_text (PkGroupEnum group)
text = _("Unknown group");
break;
default:
- g_warning ("group unrecognized: %i", group);
+ g_warning ("group unrecognized: %u", group);
}
return text;
}
diff --git a/src/gpk-log.c b/src/gpk-log.c
index 8fb2197..c9cbba1 100644
--- a/src/gpk-log.c
+++ b/src/gpk-log.c
@@ -489,7 +489,7 @@ gpk_log_refilter (void)
else
filter = NULL;
- g_debug ("len=%i", transactions->len);
+ g_debug ("len=%u", transactions->len);
/* mark the items as not used */
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview_simple"));
@@ -650,7 +650,7 @@ gpk_log_startup_cb (GtkApplication *application, gpointer user_data)
/* set the parent window if it is specified */
if (xid != 0) {
- g_debug ("Setting xid %i", xid);
+ g_debug ("Setting xid %u", xid);
gpk_window_set_parent_xid (GTK_WINDOW (widget), xid);
}
diff --git a/src/gpk-prefs.c b/src/gpk-prefs.c
index 649d256..12ecfa2 100644
--- a/src/gpk-prefs.c
+++ b/src/gpk-prefs.c
@@ -535,7 +535,7 @@ gpm_prefs_commandline_cb (GApplication *application,
/* set the parent window if it is specified */
if (xid != 0) {
- g_debug ("Setting xid %i", xid);
+ g_debug ("Setting xid %u", xid);
gpk_window_set_parent_xid (window, xid);
}
return TRUE;
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 50e834e..b274401 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -1333,8 +1333,8 @@ gpk_update_viewer_reconsider_info (void)
/* header */
widget = GTK_WIDGET(gtk_builder_get_object (builder, "label_header_title"));
- text_total = g_strdup_printf (ngettext ("There is %i update available",
- "There are %i updates available", len), len);
+ text_total = g_strdup_printf (ngettext ("There is %u update available",
+ "There are %u updates available", len), len);
text_markup = g_strdup_printf ("<big><b>%s</b></big>", text_total);
gtk_label_set_label (GTK_LABEL(widget), text_markup);
widget = GTK_WIDGET(gtk_builder_get_object (builder, "hbox_header"));
@@ -1348,8 +1348,8 @@ gpk_update_viewer_reconsider_info (void)
if (size_total == 0) {
g_autofree gchar *text = NULL;
/* TRANSLATORS: how many updates are selected in the UI */
- text = g_strdup_printf (ngettext ("%i update selected",
- "%i updates selected",
+ text = g_strdup_printf (ngettext ("%u update selected",
+ "%u updates selected",
number_total), number_total);
gtk_header_bar_set_subtitle (GTK_HEADER_BAR(widget), text);
} else {
@@ -1357,8 +1357,8 @@ gpk_update_viewer_reconsider_info (void)
g_autofree gchar *text_size = NULL;
text_size = g_format_size (size_total);
/* TRANSLATORS: how many updates are selected in the UI, and the size of packages to
download */
- text = g_strdup_printf (ngettext ("%i update selected (%s)",
- "%i updates selected (%s)",
+ text = g_strdup_printf (ngettext ("%u update selected (%s)",
+ "%u updates selected (%s)",
number_total), number_total, text_size);
gtk_header_bar_set_subtitle (GTK_HEADER_BAR(widget), text);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]