Print each deprecation message only once per compilation. Fixes #678