File check-gnatmake-version-in-gnat_version_compare.patch of Package gdb

From f0aa64a18995ba181aa975804934e9b4b02bf076 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@adacore.com>
Date: Mon, 31 Mar 2025 11:53:53 -0600
Subject: [PATCH 14/25] Check gnatmake version in gnat_version_compare

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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 4d04d597474..3d18e6ad82c 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -223,12 +223,16 @@ proc gnatmake_version_at_least { major } {
 # 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.
-- 
2.51.0

openSUSE Build Service is sponsored by