Fix gcc and clang warnings everywhere

See #773