[sysprof] build: fix build warnigns with Clang
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] build: fix build warnigns with Clang
- Date: Fri, 14 Aug 2020 19:59:39 +0000 (UTC)
commit 620f1f0ff0d41a4c47ac6ef9b5615159e8ac71b4
Author: Christian Hergert <chergert redhat com>
Date: Fri Aug 14 12:57:50 2020 -0700
build: fix build warnigns with Clang
src/libsysprof-capture/sysprof-collector.c | 2 +-
src/libsysprof-ui/sysprof-environ-editor.c | 10 +++++-----
src/libsysprof-ui/sysprof-memprof-page.c | 1 -
src/libsysprof/sysprof-local-profiler.c | 8 ++++----
src/libsysprof/sysprof-perf-counter.c | 1 -
src/libsysprof/sysprof-perf-source.c | 15 +++++----------
src/libsysprof/sysprof-proc-source.c | 1 -
src/libsysprof/sysprof-spawnable.c | 6 +++---
src/tests/allocs-by-size.c | 1 -
src/tests/allocs-within-mark.c | 1 -
src/tests/memory-stack-stash.c | 1 -
src/tests/test-addr-map.c | 1 -
src/tests/test-mountinfo.c | 1 -
src/tests/test-resolvers.c | 3 +--
src/tools/sysprof-cat.c | 1 -
15 files changed, 19 insertions(+), 34 deletions(-)
---
diff --git a/src/libsysprof-capture/sysprof-collector.c b/src/libsysprof-capture/sysprof-collector.c
index 1d7a0d61..22c9d382 100644
--- a/src/libsysprof-capture/sysprof-collector.c
+++ b/src/libsysprof-capture/sysprof-collector.c
@@ -275,7 +275,7 @@ receive_fd_blocking (int peer_fd)
if ((cmsg->cmsg_len - ((char *)CMSG_DATA (cmsg) - (char *)cmsg)) % 4 != 0)
return -1;
- fds = (const int *) CMSG_DATA (cmsg);
+ fds = (const int *)(void *)CMSG_DATA (cmsg);
n_fds = (cmsg->cmsg_len - ((char *)CMSG_DATA (cmsg) - (char *)cmsg)) / sizeof (*fds);
/* only expecting one FD */
diff --git a/src/libsysprof-ui/sysprof-environ-editor.c b/src/libsysprof-ui/sysprof-environ-editor.c
index 58ef2f60..e76d9d0c 100644
--- a/src/libsysprof-ui/sysprof-environ-editor.c
+++ b/src/libsysprof-ui/sysprof-environ-editor.c
@@ -287,12 +287,12 @@ sysprof_environ_editor_new (void)
void
sysprof_environ_editor_set_environ (SysprofEnvironEditor *self,
- SysprofEnviron *environ)
+ SysprofEnviron *environ_)
{
g_return_if_fail (SYSPROF_IS_ENVIRON_EDITOR (self));
- g_return_if_fail (SYSPROF_IS_ENVIRON (environ));
+ g_return_if_fail (SYSPROF_IS_ENVIRON (environ_));
- if (self->environ != environ)
+ if (self->environ != environ_)
{
if (self->environ != NULL)
{
@@ -300,9 +300,9 @@ sysprof_environ_editor_set_environ (SysprofEnvironEditor *self,
g_clear_object (&self->environ);
}
- if (environ != NULL)
+ if (environ_ != NULL)
{
- self->environ = g_object_ref (environ);
+ self->environ = g_object_ref (environ_);
sysprof_environ_editor_connect (self);
}
diff --git a/src/libsysprof-ui/sysprof-memprof-page.c b/src/libsysprof-ui/sysprof-memprof-page.c
index 80766990..9dd42a88 100644
--- a/src/libsysprof-ui/sysprof-memprof-page.c
+++ b/src/libsysprof-ui/sysprof-memprof-page.c
@@ -205,7 +205,6 @@ update_summary (SysprofMemprofPage *self,
g_autofree gchar *subtitle_str = NULL;
g_autofree gchar *allocstr = NULL;
g_autofree gchar *tempstr = NULL;
- g_autofree gchar *leakedstr = NULL;
g_autofree gchar *allstr = NULL;
GtkWidget *row;
GtkWidget *title;
diff --git a/src/libsysprof/sysprof-local-profiler.c b/src/libsysprof/sysprof-local-profiler.c
index 9aecaa7b..62fdea1b 100644
--- a/src/libsysprof/sysprof-local-profiler.c
+++ b/src/libsysprof/sysprof-local-profiler.c
@@ -609,11 +609,11 @@ sysprof_local_profiler_authorize_cb (GObject *object,
if (priv->spawn_inherit_environ)
{
- gchar **environ = g_get_environ ();
+ gchar **environ_ = g_get_environ ();
- for (guint i = 0; environ[i]; i++)
- g_ptr_array_add (env, environ[i]);
- g_free (environ);
+ for (guint i = 0; environ_[i]; i++)
+ g_ptr_array_add (env, environ_[i]);
+ g_free (environ_);
}
if (priv->spawn_env)
diff --git a/src/libsysprof/sysprof-perf-counter.c b/src/libsysprof/sysprof-perf-counter.c
index e896baac..2d0b9f46 100644
--- a/src/libsysprof/sysprof-perf-counter.c
+++ b/src/libsysprof/sysprof-perf-counter.c
@@ -432,7 +432,6 @@ sysprof_perf_counter_open (SysprofPerfCounter *self,
gulong flags)
{
SysprofHelpers *helpers = sysprof_helpers_get_default ();
- g_autoptr(GError) error = NULL;
gint out_fd = -1;
g_return_val_if_fail (self != NULL, -1);
diff --git a/src/libsysprof/sysprof-perf-source.c b/src/libsysprof/sysprof-perf-source.c
index 17e1980e..222520ff 100644
--- a/src/libsysprof/sysprof-perf-source.c
+++ b/src/libsysprof/sysprof-perf-source.c
@@ -206,10 +206,8 @@ sysprof_perf_source_handle_tracepoint (SysprofPerfSource *
{
case DRM_VBLANK:
message = g_strdup_printf ("crtc=%d, seq=%u",
- *(gint *)(sample->raw +
- tp_desc->field_offsets[0]),
- *(guint *)(sample->raw +
- tp_desc->field_offsets[1]));
+ *(gint *)(gpointer)(sample->raw + tp_desc->field_offsets[0]),
+ *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[1]));
sysprof_capture_writer_add_mark (self->writer,
sample->time,
@@ -224,12 +222,9 @@ sysprof_perf_source_handle_tracepoint (SysprofPerfSource *
case DRM_I915_BEGIN:
case DRM_I915_END:
message = g_strdup_printf ("ctx=%u, ring=%u, seqno=%u",
- *(guint *)(sample->raw +
- tp_desc->field_offsets[0]),
- *(guint *)(sample->raw +
- tp_desc->field_offsets[1]),
- *(guint *)(sample->raw +
- tp_desc->field_offsets[2]));
+ *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[0]),
+ *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[1]),
+ *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[2]));
sysprof_capture_writer_add_mark (self->writer,
sample->time,
diff --git a/src/libsysprof/sysprof-proc-source.c b/src/libsysprof/sysprof-proc-source.c
index 181c9cfe..973b5e2a 100644
--- a/src/libsysprof/sysprof-proc-source.c
+++ b/src/libsysprof/sysprof-proc-source.c
@@ -82,7 +82,6 @@ sysprof_proc_source_populate_maps (SysprofProcSource *self,
const gchar *mountinfostr)
{
g_auto(GStrv) maps = NULL;
- g_auto(GStrv) mountinfo = NULL;
guint i;
g_assert (SYSPROF_IS_PROC_SOURCE (self));
diff --git a/src/libsysprof/sysprof-spawnable.c b/src/libsysprof/sysprof-spawnable.c
index c206f766..182ccb95 100644
--- a/src/libsysprof/sysprof-spawnable.c
+++ b/src/libsysprof/sysprof-spawnable.c
@@ -166,14 +166,14 @@ sysprof_spawnable_setenv (SysprofSpawnable *self,
void
sysprof_spawnable_set_environ (SysprofSpawnable *self,
- const gchar * const *environ)
+ const gchar * const *environ_)
{
g_return_if_fail (SYSPROF_IS_SPAWNABLE (self));
- if (environ != (const gchar * const *)self->environ)
+ if (environ_ != (const gchar * const *)self->environ)
{
g_strfreev (self->environ);
- self->environ = g_strdupv ((gchar **)environ);
+ self->environ = g_strdupv ((gchar **)environ_);
}
}
diff --git a/src/tests/allocs-by-size.c b/src/tests/allocs-by-size.c
index 8231be70..d98e0f6f 100644
--- a/src/tests/allocs-by-size.c
+++ b/src/tests/allocs-by-size.c
@@ -121,7 +121,6 @@ main (gint argc,
{
SysprofCaptureReader *reader;
const gchar *filename = argv[1];
- g_autoptr(GError) error = NULL;
if (argc < 2)
{
diff --git a/src/tests/allocs-within-mark.c b/src/tests/allocs-within-mark.c
index a3ba5b27..e149ab45 100644
--- a/src/tests/allocs-within-mark.c
+++ b/src/tests/allocs-within-mark.c
@@ -186,7 +186,6 @@ main (gint argc,
{
SysprofCaptureReader *reader;
const gchar *filename;
- g_autoptr(GError) error = NULL;
const gchar *category;
const gchar *name;
diff --git a/src/tests/memory-stack-stash.c b/src/tests/memory-stack-stash.c
index 3a277ad7..5078071d 100644
--- a/src/tests/memory-stack-stash.c
+++ b/src/tests/memory-stack-stash.c
@@ -64,7 +64,6 @@ main (gint argc,
{
SysprofCaptureReader *reader;
const gchar *filename = argv[1];
- g_autoptr(GError) error = NULL;
if (argc < 2)
{
diff --git a/src/tests/test-addr-map.c b/src/tests/test-addr-map.c
index 1e7f9b71..6a771586 100644
--- a/src/tests/test-addr-map.c
+++ b/src/tests/test-addr-map.c
@@ -85,7 +85,6 @@ main (gint argc,
gchar *argv[])
{
g_autoptr(SysprofCaptureReader) reader = NULL;
- g_autoptr(GError) error = NULL;
if (argc != 2)
{
diff --git a/src/tests/test-mountinfo.c b/src/tests/test-mountinfo.c
index e3902112..e458545a 100644
--- a/src/tests/test-mountinfo.c
+++ b/src/tests/test-mountinfo.c
@@ -26,7 +26,6 @@ main (gint argc,
{
g_autoptr(SysprofMountinfo) info = NULL;
g_autofree gchar *contents = NULL;
- g_auto(GStrv) lines = NULL;
g_autoptr(GError) error = NULL;
g_autofree gchar *lookup = NULL;
gsize len;
diff --git a/src/tests/test-resolvers.c b/src/tests/test-resolvers.c
index aadef726..aac7eaf9 100644
--- a/src/tests/test-resolvers.c
+++ b/src/tests/test-resolvers.c
@@ -28,7 +28,6 @@ main (gint argc,
{
g_autoptr(GPtrArray) resolvers = NULL;
g_autoptr(SysprofCaptureReader) reader = NULL;
- g_autoptr(GError) error = NULL;
const SysprofCaptureSample *sample;
const gchar *filename;
@@ -69,7 +68,7 @@ main (gint argc,
{
SysprofAddress addr = sample->addrs[a];
SysprofAddressContext context;
- gboolean found;
+ gboolean found = FALSE;
if (sysprof_address_is_context_switch (addr, &context))
{
diff --git a/src/tools/sysprof-cat.c b/src/tools/sysprof-cat.c
index d023d82d..3bbac8a9 100644
--- a/src/tools/sysprof-cat.c
+++ b/src/tools/sysprof-cat.c
@@ -71,7 +71,6 @@ main (gint argc,
for (guint i = 1; i < argc; i++)
{
g_autoptr(SysprofCaptureReader) reader = NULL;
- g_autoptr(GError) error = NULL;
if (!(reader = sysprof_capture_reader_new (argv[i])))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]