GNOME Bugzilla – Bug 796346
[PATCH] gmacros: Add G_GNUC_UNUSED for autoptr funcs (notably GLists)
Last modified: 2018-05-24 20:38:15 UTC
Created attachment 372346 [details] [review] [PATCH] gmacros: Add G_GNUC_UNUSED for autoptr funcs (notably GLists) In commit f49a93b20761a0be51b22c481503b4cda0f7264f from bug https://bugzilla.gnome.org/show_bug.cgi?id=791342 we added two new static inline cleanup helpers in case a type was used inside a list. These functions will commonly be unused. In rpm-ostree, we run a build using `CC=clang -Werror=unused` because it catches `g_autofree char *foo = NULL;` as unused, but GCC doesn't. When trying to update to F28 with a newer glib, our CI fell over on this. Mark all of the autocleanups as "maybe unused".
Review of attachment 372346 [details] [review]: This seems reasonable. I’m worried we’ll regress on it in future though. Could you add -Werror=unused to the GLib CFLAGS in a separate commit, please? I assume GLib will build with that enabled for all source (and not just for its public headers).
We only get a warning with clang today. I'm not too worried about regressions here, as my opinion on -Werror hasn't changed much since https://mail.gnome.org/archives/desktop-devel-list/2012-July/msg00100.html - the only evolution is that in CI scenarios, it *can* make sense to use a blanket -Werror if you're using a "fixed" toolchain. Which is in fact what was going on here.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/1390.