Adler–Bardeen theorem and manifest anomaly cancellation to all orders in gauge theories