split function generation and error checking macros