Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 862
    • Issues 862
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 39
    • Merge requests 39
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !3226

Make g_string_free (_, FALSE) warn on unused result

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Sergey Bugaev requested to merge bugaevc/glib:gstring-free-warning into main Jan 24, 2023
  • Overview 17
  • Commits 4
  • Pipelines 8
  • Changes 8

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.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: gstring-free-warning