Fix warnings, and set -Werror

Fixes all warnings and enables `-Wall -Wextra`, and `-Werror` with an option to disable it.