A warning shot is usually unadvised and often illegal. It may delay or negate effective action. But dogs are very sensitive to noise, so in this case it might be effective if the dog is not too close. If he is charging, it might be too late for a warning and you need to make an effective shot.