diff mbox

[3/3] pretty-print.c: skip color selftests if GCC_COLORS is set

Message ID 1465497729-42544-4-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm June 9, 2016, 6:42 p.m. UTC
gcc/ChangeLog:
	* pretty-print.c (assert_pp_format_colored): Skip the test if
	GCC_COLORS is set.
	(test_pp_format): Remove comment about GCC_COLORS.
---
 gcc/pretty-print.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Jeff Law June 13, 2016, 6:20 p.m. UTC | #1
On 06/09/2016 12:42 PM, David Malcolm wrote:
> gcc/ChangeLog:
> 	* pretty-print.c (assert_pp_format_colored): Skip the test if
> 	GCC_COLORS is set.
> 	(test_pp_format): Remove comment about GCC_COLORS.
OK.
jeff
diff mbox

Patch

diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index 86ae3a5..3713953 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -1266,6 +1266,12 @@  static void
 assert_pp_format_colored (const location &loc, const char *expected,
 			  const char *fmt, ...)
 {
+  /* The tests of colorization assume that the default color scheme.
+     If GCC_COLORS is set, then the colors have potentially been
+     overridden; skip the test.  */
+  if (getenv ("GCC_COLORS"))
+    return;
+
   va_list ap;
 
   va_start (ap, fmt);
@@ -1347,7 +1353,6 @@  test_pp_format ()
   ASSERT_PP_FORMAT_2 ("normal colored normal 12345678",
 		      "normal %rcolored%R normal %x",
 		      "error", 0x12345678);
-  /* The following assumes an empty value for GCC_COLORS.  */
   assert_pp_format_colored
     (SELFTEST_LOCATION,
      "normal \33[01;31m\33[Kcolored\33[m\33[K normal 12345678",