Fix most warnings that would be caused by gcc flag -Wundef