Fix a bunch of GCC/Clang warnings (and other associated changes)
A clean build on a current Debian sid with GCC results in quite a few warnings. Most of them unimportant, but some are potentially security-related. Furthermore, building with CC=clang results in a few more.
Address most of them here.
Future work:
- I'm not sure if the
#ifdef __GNUC__
plastered around make any sense. What are the compilers that we're aiming to support here? (Note that Clang, and I believe even ICC, define__GNUC__
too). - Some of the misleading indentation warnings are a result of spaces-vs-tabs, presumably by different authors, even in the same function. I'd recommend using something like clang-format to enforce a particular style and avoid these getting reintroduced again.