Implement attributes for some well-known macros and allow macro recursion.

Refs #5856
Fixes #5959