PR bootstrap/71471 highlighted the need for selftests to provide more information when they fail. The report contained: src/gcc/pretty-print.c:1246: FAIL: ASSERT_STREQ (expected, pp_formatted_text (&pp))
This showed a string-equality failure within the helper function assert_pp_format_va, but didn't show which actual comparison was failing. Patch 1 updates ASSERT_STREQ so that the output includes the actual and expected strings, which would have allowed us to identify the failing test by searching the source. Patch 2 introduces a way to pass location information to helper functions so that the file/line that's printed for a failure points to the specific case, rather than to the inside of the helper function, and uses it within pretty-print.c's selftests. This would have allowed us to directly identify the failing test. Patch 3 fixes a bug that turned out not to be the cause of the PR. I've tested the combination of these patches: * successful bootstrap®rtest on x86_64-pc-linux-gnu * successful build/-fselftest of stage 1 on powerpc-ibm-aix7.1.3.0 OK for trunk? David Malcolm (3): selftest: show values when ASSERT_STREQ fails selftests: improve reported failure locations pretty-print.c: skip color selftests if GCC_COLORS is set gcc/input.c | 4 +- gcc/pretty-print.c | 135 +++++++++++++++++++++++++++++++++-------------------- gcc/selftest.c | 40 ++++++++++++++-- gcc/selftest.h | 76 +++++++++++++++++++++--------- 4 files changed, 177 insertions(+), 78 deletions(-) -- 1.8.5.3