From: Tom Tromey Date: Wed, 17 Dec 2025 18:08:30 +0000 (-0700) Subject: Add Do_Nothing to two more Ada tests X-Git-Tag: binutils-2_46~552 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=a30cd56e1014ba7a34cf77719193b3e64834e8e2;p=thirdparty%2Fbinutils-gdb.git Add Do_Nothing to two more Ada tests 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. --- diff --git a/gdb/testsuite/gdb.ada/py_taft/main.adb b/gdb/testsuite/gdb.ada/py_taft/main.adb index 273f637bd15..32b03f62f9a 100644 --- a/gdb/testsuite/gdb.ada/py_taft/main.adb +++ b/gdb/testsuite/gdb.ada/py_taft/main.adb @@ -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; diff --git a/gdb/testsuite/gdb.ada/py_taft/pkg.adb b/gdb/testsuite/gdb.ada/py_taft/pkg.adb index 854df1086ff..8a5bdf52798 100644 --- a/gdb/testsuite/gdb.ada/py_taft/pkg.adb +++ b/gdb/testsuite/gdb.ada/py_taft/pkg.adb @@ -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; diff --git a/gdb/testsuite/gdb.ada/py_taft/pkg.ads b/gdb/testsuite/gdb.ada/py_taft/pkg.ads index c9944025fef..faa7e5fdfe1 100644 --- a/gdb/testsuite/gdb.ada/py_taft/pkg.ads +++ b/gdb/testsuite/gdb.ada/py_taft/pkg.ads @@ -13,7 +13,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +with System; + package Pkg is + procedure Do_Nothing (A : System.Address); + type Value is private; function Create (I : Integer) return Value; private diff --git a/gdb/testsuite/gdb.ada/recursive-variant/main.adb b/gdb/testsuite/gdb.ada/recursive-variant/main.adb index d4c3ab6c024..6978ddba2df 100644 --- a/gdb/testsuite/gdb.ada/recursive-variant/main.adb +++ b/gdb/testsuite/gdb.ada/recursive-variant/main.adb @@ -13,6 +13,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +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 index 00000000000..cf6d02cfde6 --- /dev/null +++ b/gdb/testsuite/gdb.ada/recursive-variant/pck.adb @@ -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 . + +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 index 00000000000..965e702e152 --- /dev/null +++ b/gdb/testsuite/gdb.ada/recursive-variant/pck.ads @@ -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 . + +with System; + +package Pck is + + procedure Do_Nothing (A : System.Address); + +end Pck;