]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Check gnatmake version in gnat_version_compare
authorTom Tromey <tromey@adacore.com>
Mon, 31 Mar 2025 17:53:53 +0000 (11:53 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 1 Apr 2025 13:11:48 +0000 (07:11 -0600)
Tom de Vries pointed out that my earlier change to
gnat_version_compare made it actually test gcc's version -- not
gnat's.

This patch changes gnat_version_compare to examine gnatmake's version,
while preserving the nicer API.

Approved-By: Tom de Vries <tdevries@suse.de>
gdb/testsuite/lib/ada.exp

index 0a1231b1d592c0f09688897ab6002b6e2a5b2948..e1a3a237c35cf6e72b511aeb91a932916c04c2ba 100644 (file)
@@ -181,12 +181,16 @@ proc find_ada_tool {tool} {
 # compiler does not appear to be GCC, this will always return false.
 
 proc gnat_version_compare {op l2} {
-    set gccvers [gcc_major_version]
-    if {$gccvers == -1} {
+    set gnatmake [find_gnatmake]
+    set gnatmake [lindex [split $gnatmake] 0]
+    if {[catch {exec $gnatmake --version} output]} {
+       return 0
+    }
+    if {![regexp {GNATMAKE ([0-9]+(\.[0-9]+)*)} $output match version]} {
        return 0
     }
 
-    return [version_compare [split $gccvers .] $op $l2]
+    return [version_compare [split $version .] $op $l2]
 }
 
 # Return 1 if the GNAT runtime appears to have debug info.