Fix build warning and add related gcc options