]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add Do_Nothing to two more Ada tests
authorTom Tromey <tromey@adacore.com>
Wed, 17 Dec 2025 18:08:30 +0000 (11:08 -0700)
committerTom Tromey <tromey@adacore.com>
Thu, 18 Dec 2025 13:47:03 +0000 (06:47 -0700)
A couple of Ada tests were failing with gnat-llvm, because LLVM is a
bit more aggressive about eliminating unused local variables.  This
patch arranges for some variables to be kept alive a little longer,
using the usual Do_Nothing technique.

gdb/testsuite/gdb.ada/py_taft/main.adb
gdb/testsuite/gdb.ada/py_taft/pkg.adb
gdb/testsuite/gdb.ada/py_taft/pkg.ads
gdb/testsuite/gdb.ada/recursive-variant/main.adb
gdb/testsuite/gdb.ada/recursive-variant/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/recursive-variant/pck.ads [new file with mode: 0644]

index 273f637bd15b5b64b8092c34d407e3f4027ebe17..32b03f62f9a2673d771e8aaba80e4850a26d666f 100644 (file)
@@ -18,5 +18,5 @@ with Pkg;
 procedure Main is
    V : Pkg.Value := Pkg.Create (42);
 begin
-   null;                               --  STOP
+   Pkg.Do_Nothing (V'Address);      --  STOP
 end Main;
index 854df1086ffa33b87a6b87c4ee149bd18a176054..8a5bdf527986dc78da6ded929a69c83947cc05d0 100644 (file)
 
 package body Pkg is
 
+   procedure Do_Nothing (A : System.Address) is
+   begin
+      null;
+   end Do_Nothing;
+
    type Value_Record is record
       I : Integer;
    end record;
index c9944025fef095d2ffd19d5fa2e2f90c2cc025a6..faa7e5fdfe121ff8045b5de44564860cd55366be 100644 (file)
 --  You should have received a copy of the GNU General Public License
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+with System;
+
 package Pkg is
+   procedure Do_Nothing (A : System.Address);
+
    type Value is private;
    function Create (I : Integer) return Value;
 private
index d4c3ab6c0244faa32c54612a2f2bbff940298136..6978ddba2dfa3f83c1823dd074c87b37dcbf673d 100644 (file)
@@ -13,6 +13,8 @@
 --  You should have received a copy of the GNU General Public License
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+with Pck; use Pck;
+
 procedure Main is
 
    type Rec_Type;
@@ -33,6 +35,6 @@ procedure Main is
 
 begin
 
-   null; -- STOP
+   Do_Nothing (Instance'Address); -- STOP
 
 end Main;
diff --git a/gdb/testsuite/gdb.ada/recursive-variant/pck.adb b/gdb/testsuite/gdb.ada/recursive-variant/pck.adb
new file mode 100644 (file)
index 0000000..cf6d02c
--- /dev/null
@@ -0,0 +1,25 @@
+--  Copyright 2025 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+with System;
+
+package body Pck is
+
+   procedure Do_Nothing (A : System.Address) is
+   begin
+      null;
+   end Do_Nothing;
+
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/recursive-variant/pck.ads b/gdb/testsuite/gdb.ada/recursive-variant/pck.ads
new file mode 100644 (file)
index 0000000..965e702
--- /dev/null
@@ -0,0 +1,22 @@
+--  Copyright 2025 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+with System;
+
+package Pck is
+
+   procedure Do_Nothing (A : System.Address);
+
+end Pck;