Fix build problems with modern GCC and Clang releases

Ting-Wei Lan requested to merge wip/lantw/fix-build-with-modern-compilers into master

These patches were uploaded to Bugzilla 3 years ago, but nobody reviews it. I hope the migration to GitLab opens up an opportunity to get these patches merged, so I no longer have to keep these patches on all machines which I use to test GNOME builds. Close #284 and #287 (closed).

Merge request reports