Ticket #5139: Properly simplify recursive macro definitions