Add warning macro and fix some const