Refactor warning logic.

The internal warn function now creates the actual warning message.
Typo warnings are just another kind of warning.
If the specified warning name is not known, a generic warning message is generated instead.