[testsuite] Fix gcc_compiled for gcc 6 & 7

Message ID 20161020193158.GA16273@host1.jankratochvil.net
State New, archived
Headers

Commit Message

Jan Kratochvil Oct. 20, 2016, 7:31 p.m. UTC
  Hi,

OK for check-in?


Jan
gdb/testsuite/ChangeLog
2016-10-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/gdb.exp (get_compiler_info): Generalize gcc_compile regexp.
  

Comments

Yao Qi Oct. 20, 2016, 7:45 p.m. UTC | #1
On Thu, Oct 20, 2016 at 3:31 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> Hi,
>
> OK for check-in?
>
>
> Jan
>
> gdb/testsuite/ChangeLog
> 2016-10-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>         * lib/gdb.exp (get_compiler_info): Generalize gcc_compile regexp.

Patch is good to me.
  
Jan Kratochvil Oct. 20, 2016, 8 p.m. UTC | #2
On Thu, 20 Oct 2016 21:45:52 +0200, Yao Qi wrote:
> On Thu, Oct 20, 2016 at 3:31 PM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> > 2016-10-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
> >
> >         * lib/gdb.exp (get_compiler_info): Generalize gcc_compile regexp.
> 
> Patch is good to me.

Checked in:
	f90fd8c2f17c7631915103ce5b760830a156ee93


Thanks,
Jan
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 378eea0..7d9b198 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3290,12 +3290,8 @@  proc get_compiler_info {{arg ""}} {
     }
 
     # Set the legacy symbols.
-    set gcc_compiled     0
-    if { [regexp "^gcc-1-" "$compiler_info" ] } { set gcc_compiled 1 }
-    if { [regexp "^gcc-2-" "$compiler_info" ] } { set gcc_compiled 2 }
-    if { [regexp "^gcc-3-" "$compiler_info" ] } { set gcc_compiled 3 }
-    if { [regexp "^gcc-4-" "$compiler_info" ] } { set gcc_compiled 4 }
-    if { [regexp "^gcc-5-" "$compiler_info" ] } { set gcc_compiled 5 }
+    set gcc_compiled 0
+    regexp "^gcc-(\[0-9\]+)-" "$compiler_info" matchall gcc_compiled
 
     # Log what happened.
     verbose -log "get_compiler_info: $compiler_info"