build: fix build warnigns with Clang

This commit is contained in:
Christian Hergert
2020-08-14 12:57:50 -07:00
parent f16bbac342
commit 620f1f0ff0
15 changed files with 19 additions and 34 deletions

View File

@ -275,7 +275,7 @@ receive_fd_blocking (int peer_fd)
if ((cmsg->cmsg_len - ((char *)CMSG_DATA (cmsg) - (char *)cmsg)) % 4 != 0) if ((cmsg->cmsg_len - ((char *)CMSG_DATA (cmsg) - (char *)cmsg)) % 4 != 0)
return -1; 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); n_fds = (cmsg->cmsg_len - ((char *)CMSG_DATA (cmsg) - (char *)cmsg)) / sizeof (*fds);
/* only expecting one FD */ /* only expecting one FD */

View File

@ -287,12 +287,12 @@ sysprof_environ_editor_new (void)
void void
sysprof_environ_editor_set_environ (SysprofEnvironEditor *self, 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_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) if (self->environ != NULL)
{ {
@ -300,9 +300,9 @@ sysprof_environ_editor_set_environ (SysprofEnvironEditor *self,
g_clear_object (&self->environ); 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); sysprof_environ_editor_connect (self);
} }

View File

@ -205,7 +205,6 @@ update_summary (SysprofMemprofPage *self,
g_autofree gchar *subtitle_str = NULL; g_autofree gchar *subtitle_str = NULL;
g_autofree gchar *allocstr = NULL; g_autofree gchar *allocstr = NULL;
g_autofree gchar *tempstr = NULL; g_autofree gchar *tempstr = NULL;
g_autofree gchar *leakedstr = NULL;
g_autofree gchar *allstr = NULL; g_autofree gchar *allstr = NULL;
GtkWidget *row; GtkWidget *row;
GtkWidget *title; GtkWidget *title;

View File

@ -609,11 +609,11 @@ sysprof_local_profiler_authorize_cb (GObject *object,
if (priv->spawn_inherit_environ) if (priv->spawn_inherit_environ)
{ {
gchar **environ = g_get_environ (); gchar **environ_ = g_get_environ ();
for (guint i = 0; environ[i]; i++) for (guint i = 0; environ_[i]; i++)
g_ptr_array_add (env, environ[i]); g_ptr_array_add (env, environ_[i]);
g_free (environ); g_free (environ_);
} }
if (priv->spawn_env) if (priv->spawn_env)

View File

@ -432,7 +432,6 @@ sysprof_perf_counter_open (SysprofPerfCounter *self,
gulong flags) gulong flags)
{ {
SysprofHelpers *helpers = sysprof_helpers_get_default (); SysprofHelpers *helpers = sysprof_helpers_get_default ();
g_autoptr(GError) error = NULL;
gint out_fd = -1; gint out_fd = -1;
g_return_val_if_fail (self != NULL, -1); g_return_val_if_fail (self != NULL, -1);

View File

@ -206,10 +206,8 @@ sysprof_perf_source_handle_tracepoint (SysprofPerfSource *
{ {
case DRM_VBLANK: case DRM_VBLANK:
message = g_strdup_printf ("crtc=%d, seq=%u", message = g_strdup_printf ("crtc=%d, seq=%u",
*(gint *)(sample->raw + *(gint *)(gpointer)(sample->raw + tp_desc->field_offsets[0]),
tp_desc->field_offsets[0]), *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[1]));
*(guint *)(sample->raw +
tp_desc->field_offsets[1]));
sysprof_capture_writer_add_mark (self->writer, sysprof_capture_writer_add_mark (self->writer,
sample->time, sample->time,
@ -224,12 +222,9 @@ sysprof_perf_source_handle_tracepoint (SysprofPerfSource *
case DRM_I915_BEGIN: case DRM_I915_BEGIN:
case DRM_I915_END: case DRM_I915_END:
message = g_strdup_printf ("ctx=%u, ring=%u, seqno=%u", message = g_strdup_printf ("ctx=%u, ring=%u, seqno=%u",
*(guint *)(sample->raw + *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[0]),
tp_desc->field_offsets[0]), *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[1]),
*(guint *)(sample->raw + *(guint *)(gpointer)(sample->raw + tp_desc->field_offsets[2]));
tp_desc->field_offsets[1]),
*(guint *)(sample->raw +
tp_desc->field_offsets[2]));
sysprof_capture_writer_add_mark (self->writer, sysprof_capture_writer_add_mark (self->writer,
sample->time, sample->time,

View File

@ -82,7 +82,6 @@ sysprof_proc_source_populate_maps (SysprofProcSource *self,
const gchar *mountinfostr) const gchar *mountinfostr)
{ {
g_auto(GStrv) maps = NULL; g_auto(GStrv) maps = NULL;
g_auto(GStrv) mountinfo = NULL;
guint i; guint i;
g_assert (SYSPROF_IS_PROC_SOURCE (self)); g_assert (SYSPROF_IS_PROC_SOURCE (self));

View File

@ -166,14 +166,14 @@ sysprof_spawnable_setenv (SysprofSpawnable *self,
void void
sysprof_spawnable_set_environ (SysprofSpawnable *self, sysprof_spawnable_set_environ (SysprofSpawnable *self,
const gchar * const *environ) const gchar * const *environ_)
{ {
g_return_if_fail (SYSPROF_IS_SPAWNABLE (self)); 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); g_strfreev (self->environ);
self->environ = g_strdupv ((gchar **)environ); self->environ = g_strdupv ((gchar **)environ_);
} }
} }

View File

@ -121,7 +121,6 @@ main (gint argc,
{ {
SysprofCaptureReader *reader; SysprofCaptureReader *reader;
const gchar *filename = argv[1]; const gchar *filename = argv[1];
g_autoptr(GError) error = NULL;
if (argc < 2) if (argc < 2)
{ {

View File

@ -186,7 +186,6 @@ main (gint argc,
{ {
SysprofCaptureReader *reader; SysprofCaptureReader *reader;
const gchar *filename; const gchar *filename;
g_autoptr(GError) error = NULL;
const gchar *category; const gchar *category;
const gchar *name; const gchar *name;

View File

@ -64,7 +64,6 @@ main (gint argc,
{ {
SysprofCaptureReader *reader; SysprofCaptureReader *reader;
const gchar *filename = argv[1]; const gchar *filename = argv[1];
g_autoptr(GError) error = NULL;
if (argc < 2) if (argc < 2)
{ {

View File

@ -85,7 +85,6 @@ main (gint argc,
gchar *argv[]) gchar *argv[])
{ {
g_autoptr(SysprofCaptureReader) reader = NULL; g_autoptr(SysprofCaptureReader) reader = NULL;
g_autoptr(GError) error = NULL;
if (argc != 2) if (argc != 2)
{ {

View File

@ -26,7 +26,6 @@ main (gint argc,
{ {
g_autoptr(SysprofMountinfo) info = NULL; g_autoptr(SysprofMountinfo) info = NULL;
g_autofree gchar *contents = NULL; g_autofree gchar *contents = NULL;
g_auto(GStrv) lines = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
g_autofree gchar *lookup = NULL; g_autofree gchar *lookup = NULL;
gsize len; gsize len;

View File

@ -28,7 +28,6 @@ main (gint argc,
{ {
g_autoptr(GPtrArray) resolvers = NULL; g_autoptr(GPtrArray) resolvers = NULL;
g_autoptr(SysprofCaptureReader) reader = NULL; g_autoptr(SysprofCaptureReader) reader = NULL;
g_autoptr(GError) error = NULL;
const SysprofCaptureSample *sample; const SysprofCaptureSample *sample;
const gchar *filename; const gchar *filename;
@ -69,7 +68,7 @@ main (gint argc,
{ {
SysprofAddress addr = sample->addrs[a]; SysprofAddress addr = sample->addrs[a];
SysprofAddressContext context; SysprofAddressContext context;
gboolean found; gboolean found = FALSE;
if (sysprof_address_is_context_switch (addr, &context)) if (sysprof_address_is_context_switch (addr, &context))
{ {

View File

@ -71,7 +71,6 @@ main (gint argc,
for (guint i = 1; i < argc; i++) for (guint i = 1; i < argc; i++)
{ {
g_autoptr(SysprofCaptureReader) reader = NULL; g_autoptr(SysprofCaptureReader) reader = NULL;
g_autoptr(GError) error = NULL;
if (!(reader = sysprof_capture_reader_new (argv[i]))) if (!(reader = sysprof_capture_reader_new (argv[i])))
{ {