This Time Self-Hosted
dark mode light mode Search

Fixing warnings

Okay, after the post where I reiterate about the importance of warnings I’ve started trying to patch my packages and the simplest packages for which I maintain an ebuild for to build without warnings.

This required to cleanup wefts and mxmlplus, that had a few warnings with GCC 4.1.0, and then I moved to other software as I had time. One of the most common warning I found was ablut unused parameters, but that was simple to resolve by adding a new check to my attributes.m4 file and reusing that to patch other software. Luckily the test is also caching, so with confcache it will be quick to run for every package I patch 😉

The patches to libtorrent, rtorrent, libarchive and bsdtar are already merged upstream. A patch for mt-daapd has been sent upstream and I’m waiting for Ron Pedde to read and check it, and one for xine-ui is in the works.

Also, a friend of mine suggested to give a try to the custom libmodplug fork developed with umodplayer, and as I remember being a bit annoyed by libmodplug being dead upstream, I started giving that a try, a patch for that is also ready and sent upstream (I’ll see later today whether to add custom_libmodplug to portage, patched with that patch).

Another thing I try to do is to add -fno-strict-aliasing flag to packages that “dereferences type-punned pointers”, as that breaks strict aliasing and might cause bugs. By using this flag the compiler has an harder work to optimise as it can’t assume that strict aliasing rules apply, so there might be a little hit on performance (I don’t think it can be noticed anyway). If you’re such a ricer that you can’t stand such a change, you can probably try to recode the part and fix the type-punning, but it might as well make the code messier or heavier. As the warnings about strict aliasing don’t appear if -fno-strict-aliasing is passed, you might want to enable -Wstrict-aliasing=2 if you want to check them.

For who wants to know which warnings I consider usually, I just use -Werror (only if there aren’t problems with lex or with tests in configure) -Wall -Wextra -fno-common and -fpedantic if the code is mine and it can be fixed (sometimes -fpedantic errors out for many things that are just ISO-said and pointless, like extra ; outside of functions in C++).
And for the ricer wondering -fno-common is not going to have any kind of impact on your system so just don’t use it. I use it only because that way I’m sure I don’t end up with code that might not work on some system that are a bit more stricter with duplicate symbols, so that I can fix those cases before I get reports about them being broken.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.