[RFA] Don't use -fdiagnostics-color=never for rustc

Message ID 20170904051630.18976-1-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Sept. 4, 2017, 5:16 a.m. UTC
  I noticed that the gdb.rust tests fail because the test suite passes
-fdiagnostics-color=never to rustc.  This is not a recognized rustc
option, and the test suite already handles passing the appropriate
option to the Rust compiler.

This patch fixes the problem.

testsuite/ChangeLog
2017-09-03  Tom Tromey  <tom@tromey.com>

	* lib/gdb.exp (gdb_compile): Don't use universal_compile_options
	for rust.
---
 gdb/testsuite/ChangeLog   | 5 +++++
 gdb/testsuite/lib/gdb.exp | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
  

Comments

Pedro Alves Sept. 5, 2017, 11:08 a.m. UTC | #1
On 09/04/2017 06:16 AM, Tom Tromey wrote:
> I noticed that the gdb.rust tests fail because the test suite passes
> -fdiagnostics-color=never to rustc.  This is not a recognized rustc
> option, and the test suite already handles passing the appropriate
> option to the Rust compiler.
> 
> This patch fixes the problem.

Funny that the "error: Unrecognized option: 'f'." error message
comes out in color, even though "--color never" had been specified
earlier.

Patch is OK.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c15743b..718edb8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2017-09-03  Tom Tromey  <tom@tromey.com>
+
+	* lib/gdb.exp (gdb_compile): Don't use universal_compile_options
+	for rust.
+
 2017-08-31  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	* gdb.base/share-env-with-gdbserver.c: New file.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index c0ecab3..8af1b77 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3447,7 +3447,12 @@  proc gdb_compile {source dest type options} {
 
     # Add platform-specific options if a shared library was specified using
     # "shlib=librarypath" in OPTIONS.
-    set new_options [universal_compile_options]
+    if {[lsearch -exact $options rust] != -1} {
+	# -fdiagnostics-color is not a rustcc option.
+    } else {
+	set new_options [universal_compile_options]
+    }
+    set new_options {}
     set shlib_found 0
     set shlib_load 0
     foreach opt $options {