Add doc and examples for attributes allow/warn/deny/forbid.

r? anyone

Fix #7821.