Cleaned up warnings

Hadn't compiled GCC for a while now, so time to clean up warnings and
errors. They should all be gone now, except for externals.