Add pedantic, Wall and gnu99 compiler flags.  Fix warnings.