[nomaster] better error messages for various macro definition errors

backport of 1d3ec4e708154ec05554f540d7d68ed55dc12426