Add -Wall and -Wpedantic flags and fix corresponding compiler warnings