Fix warnings, and set -Werror

Fixes all warnings and enables `-Wextra` and `-Werror`.