Add -deprecation compilation option and fix some deprecation warnings