summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhaedrus Leeds <mwleeds@protonmail.com>2022-05-10 18:08:28 +0000
committerPhaedrus Leeds <mwleeds@protonmail.com>2022-05-10 18:08:28 +0000
commitc59eb271b5127309c73117bbc871dcfd9fd159a6 (patch)
tree00e8c3aed6b11bd19783240797c8a8b06b692994
parent72e532d7edd0219b20f391f6dc63533e75a445cf (diff)
parent9f033ee2f6fb2b7ef238b4d6609d55a1e1e8e3e2 (diff)
downloadlibglnx-c59eb271b5127309c73117bbc871dcfd9fd159a6.tar.gz
Merge branch 'wip/smcv/warnings' into 'master'
Fix and enable more compiler warnings See merge request GNOME/libglnx!35
-rw-r--r--glnx-console.c2
-rw-r--r--glnx-fdio.c8
-rw-r--r--glnx-xattrs.c6
-rw-r--r--meson.build1
-rw-r--r--tests/test-libglnx-xattrs.c4
5 files changed, 11 insertions, 10 deletions
diff --git a/glnx-console.c b/glnx-console.c
index 3ce2452..f6ce0d4 100644
--- a/glnx-console.c
+++ b/glnx-console.c
@@ -143,7 +143,7 @@ glnx_console_lines (void)
}
static void
-on_sigwinch (int signum)
+on_sigwinch (G_GNUC_UNUSED int signum)
{
cached_columns = 0;
cached_lines = 0;
diff --git a/glnx-fdio.c b/glnx-fdio.c
index b3a6239..ee69aa1 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -229,7 +229,7 @@ open_tmpfile_core (int dfd, const char *subpath,
const guint count_max = 100;
{ g_autofree char *tmp = g_strconcat (subpath, "/tmp.XXXXXX", NULL);
- for (int count = 0; count < count_max; count++)
+ for (guint count = 0; count < count_max; count++)
{
glnx_gen_temp_name (tmp);
@@ -660,7 +660,7 @@ glnx_file_get_contents_utf8_at (int dfd,
char *
glnx_readlinkat_malloc (int dfd,
const char *subpath,
- GCancellable *cancellable,
+ G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
dfd = glnx_dirfd_canonicalize (dfd);
@@ -1106,7 +1106,7 @@ glnx_file_replace_contents_with_perms_at (int dfd,
uid_t uid,
gid_t gid,
GLnxFileReplaceFlags flags,
- GCancellable *cancellable,
+ G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
char *dnbuf = strdupa (subpath);
@@ -1130,7 +1130,7 @@ glnx_file_replace_contents_with_perms_at (int dfd,
&tmpf, error))
return FALSE;
- if (len == -1)
+ if (len == (gsize) -1)
len = strlen ((char*)buf);
if (!glnx_try_fallocate (tmpf.fd, 0, len, error))
diff --git a/glnx-xattrs.c b/glnx-xattrs.c
index 32479cc..d0e6ab3 100644
--- a/glnx-xattrs.c
+++ b/glnx-xattrs.c
@@ -141,7 +141,7 @@ static gboolean
get_xattrs_impl (const char *path,
int fd,
GVariant **out_xattrs,
- GCancellable *cancellable,
+ G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
@@ -269,7 +269,7 @@ glnx_dfd_name_get_all_xattrs (int dfd,
static gboolean
set_all_xattrs_for_path (const char *path,
GVariant *xattrs,
- GCancellable *cancellable,
+ G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
const guint n = g_variant_n_children (xattrs);
@@ -337,7 +337,7 @@ glnx_dfd_name_set_all_xattrs (int dfd,
gboolean
glnx_fd_set_all_xattrs (int fd,
GVariant *xattrs,
- GCancellable *cancellable,
+ G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
const guint n = g_variant_n_children (xattrs);
diff --git a/meson.build b/meson.build
index f3dc8a4..4787c85 100644
--- a/meson.build
+++ b/meson.build
@@ -7,6 +7,7 @@ project(
'c',
default_options : [
'c_std=gnu99',
+ 'warning_level=3',
],
)
diff --git a/tests/test-libglnx-xattrs.c b/tests/test-libglnx-xattrs.c
index b72b0d0..1de9acd 100644
--- a/tests/test-libglnx-xattrs.c
+++ b/tests/test-libglnx-xattrs.c
@@ -122,7 +122,7 @@ do_write_run (GLnxDirFdIterator *dfd_iter, GError **error)
if (!glnx_fd_get_all_xattrs (fd, &current_xattrs, NULL, error))
return FALSE;
- for (int i = 0; i < g_variant_n_children (current_xattrs); i++)
+ for (size_t i = 0; i < g_variant_n_children (current_xattrs); i++)
{
const char *name, *value;
g_variant_get_child (current_xattrs, i, "(^&ay^&ay)", &name, &value);
@@ -182,7 +182,7 @@ xattr_thread (gpointer data)
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
struct XattrWorker *worker = data;
- guint64 end_time = g_get_monotonic_time () + XATTR_THREAD_RUN_TIME_USECS;
+ gint64 end_time = g_get_monotonic_time () + XATTR_THREAD_RUN_TIME_USECS;
guint n_read = 0;
while (g_get_monotonic_time () < end_time)