Skip to content

Make g_string_free (_, FALSE) warn on unused result

Sergey Bugaev requested to merge bugaevc/glib:gstring-free-warning into main

Use some macro magic, in particular __builtin_constant_p (), to make it so that g_string_free () behaves as if it was declared with G_GNUC_WARN_UNUSED_RESULT when passed free_segment = FALSE (compile-time constant), and without it otherwise.

Silence the few warnings (all benign!) that this change has uncovered in GLib's own codebase.

Discussed with @ebassi and @matthiasc on Matrix/IRC.

Also while nobody's looking, sneak in a couple of tiny fixes to make GLib cleanly build on the Hurd again.

Merge request reports