[pushed] Add Do_Nothing to two more Ada tests
Commit Message
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 | 2 +-
gdb/testsuite/gdb.ada/py_taft/pkg.adb | 5 ++++
gdb/testsuite/gdb.ada/py_taft/pkg.ads | 4 +++
.../gdb.ada/recursive-variant/main.adb | 4 ++-
.../gdb.ada/recursive-variant/pck.adb | 25 +++++++++++++++++++
.../gdb.ada/recursive-variant/pck.ads | 22 ++++++++++++++++
6 files changed, 60 insertions(+), 2 deletions(-)
create mode 100644 gdb/testsuite/gdb.ada/recursive-variant/pck.adb
create mode 100644 gdb/testsuite/gdb.ada/recursive-variant/pck.ads
base-commit: 1b5496684056bce7e2910db0afc050f7b73e45d7
@@ -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;
@@ -15,6 +15,11 @@
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;
@@ -13,7 +13,11 @@
-- 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
@@ -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;
new file mode 100644
@@ -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;
new file mode 100644
@@ -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;