clean up pedantic mode tag handling (issue #5125)