GNOME Bugzilla – Bug 752747
Fix error on release builds when compiling with "-Werror=unused-but-set-variable".
Last modified: 2015-07-29 07:47:40 UTC
Created attachment 307944 [details] [review] Fix error on release builds when compiling with "-Werror=unused-but-set-variable". This is a simple fix for release builds where the `assert(had_client)` call is compiled out and as such `had_client` is unused but set.
I don't think we should uglify the code like this to support building releases with -Werror :)
That's a pity, as building from git does use -Werror which makes this a hard compilation error. It's not the prettiest pattern, but it is a "standard" one and one used widely throughout the codebase, not just in -bad. I figured putting #ifdefs around the place would be way uglier in this case and the only clean alternative I see is to remove the assert (and use of had_client) entirely.
Is it less ugly without the comment? ;)
Perhaps I misunderstood. My understanding was this: - you are building a release (not git version) - releases use -DG_DISABLE_ASSERT by default - this causes the mentioned compiler warning - you are adding -Werror=* flags yourself (releases do not use -Werror, only git)