From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uTCqDtj1GWrrsycAWB0awg (envelope-from ) for ; Fri, 29 May 2026 16:23:52 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=XQs+3bQF; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 261501E024; Fri, 29 May 2026 16:23:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 40D931E024 for ; Fri, 29 May 2026 16:23:51 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C92A04BA7995 for ; Fri, 29 May 2026 20:23:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C92A04BA7995 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=XQs+3bQF Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 10E134BA7986 for ; Fri, 29 May 2026 20:22:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10E134BA7986 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 10E134BA7986 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::232 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780086146; cv=none; b=PXlHXFuJuG85wMxIXGCrbwdXvHWWlwobhWa945hIN3vwHTUku8epj5vJYcBkVuCwvFl15sB94NNurI/wXRRGbNDgEq+k3Gruw39Oy4SI9tZMnBi8aUkwHGGSGa2dUzAS2FSkwcdEBR+LBnXoJtaGReCEiuXB8NBkXiXsi7cVQpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780086146; c=relaxed/simple; bh=OxwM2UgGyiNJEKq1cHhewaJHL1/wscPoMqOVHll7UxI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XucDerFVvmDl3zR7Tj0TJnyfLPx0nIT8jfAdCI0vWTwiriiTx3VTJFT3lsfiGwtae9A3FJic+y8xl6brZyYmIUjFMqEoPVkwtYoUHeC+fRnF8ybfjl2JOURyvoiS6t1HpnmqGQyDWRMzTuuGjYGk9Xs4qKJayZVSGG4Hvh34inU= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=XQs+3bQF DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10E134BA7986 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-47c6f914617so6819169b6e.1 for ; Fri, 29 May 2026 13:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1780086145; x=1780690945; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=av4BNVk8QzLkSuYD6OLGU5a/aCh87buudqsBSDA8Xj0=; b=XQs+3bQFsCOuXL8U4eZ2qucJS7RPLtR43Z8GnBTr1eodTRlOj3Bausq4RFMslUOOXK /z9FGCWMkw4qT64l3ewcoirGld0TIpxCIFs6RcSebLnCt5y+sKJfat3ujd3VtMQpgDMs pDbKAdNZDENY1OwfHfpMmwZ1DLICnNx9zlT53jVxIcUS68b2w1eWBt8h6carYvA3smam VsnLdTs/jhM+6aPYYBfR9odx3UCi7AH1nsInH/SdT1E4lIO9tTn1OpO4N+nnoNQJf+Rs /DiSbu7mngmaaOgFWXhirASGpkEVTtpo4Iz3K7KDleBtAFLrxaa3mxXuZKZ+xNCrTr4J BRRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780086145; x=1780690945; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=av4BNVk8QzLkSuYD6OLGU5a/aCh87buudqsBSDA8Xj0=; b=BrzjXwygQp7x4CoI4roGXwtuwfjrrhJ8nljGPBjwywRGzw69V9e5OW+w0zQN5bOFkI 1dGnz+8dXVrJxdcLJbL0qo2IeMb58KIFaRXA2lFwi/59j93wg/tspTQGt6kxKqo+xTJ6 GORcayJE3mBK+ujD+LcW3NTkK1n1zd7bLh2fNVY07pLMHfHR0rk7BZ8UXdElI5DXfURs 9F5Ed1UJcJB7E0x9hH7IbVu+s3LEfQ/1P7GhbZJHDKg44yLnbhoxoOwVD4VhujZRRynp H4um3F6lEV3xW5rfYk2JnFbRVQJ+TA6sz9/RuunVTSb6Xv36wFB7oFkTKA37H+YZDPcF J2LQ== X-Gm-Message-State: AOJu0Yy9ho1sF29r2FimhV9LEMHW9rN8LDrVExVJ7ImCRSzBF3VKLC7r 2yO6cQr/KzUdR7zuw1xNrNMTQFkhAE8Q2uh1Zlk17kwVuusHTV0dkoFdT3Wn/pfZrLjncMMGcKZ abmY= X-Gm-Gg: Acq92OFejGD+SKuFJ5reHVF+AWSOA1hKJFITT33Uapu3C4Td/S51dhkHeCzRa4th66B qzlbty4IPfCW3BxdetLL7DE/s6/jfPmiD6lrCEnMC9qnEmTgS+X535AcxSqxfVtRQ6UA8xVZ3+M S6VHjgL01bw5y4hBCmuO86tsgtB/wTyvaDNn+NM+XGraeEHgBbiXtuEfcBzriwmVM3fBCtgACgG bktGpFMgZCXQ06s3PeIlCB8BJpVRkxSWgyOI87sIBNYzQ4NthO/FS5NoSyvf9UzqGGKTwQJJPsg 5Zs3zPg7QVgxxUPfwHtoYytYl+PWRaRLuKzhqK7S72d+S84KdMmAuFeGKtOHPr08ouiFj/OxrId qdZmakHIYddcVj5kcwQzXWNieqBXoKrL8uhBhvnJqqCi/F8ziEw8Xo2DkjsP5FBAx2yY5g6Bn3H RbLQ/KJR4cf3+5TIekllWIxjtqiEmOCamBclaN7qvZBahK3ff0jNMEQA== X-Received: by 2002:a05:6808:22ac:b0:467:de0e:fe9a with SMTP id 5614622812f47-485fbb4354emr533914b6e.25.1780086145227; Fri, 29 May 2026 13:22:25 -0700 (PDT) Received: from bapiya (75-166-225-82.hlrn.qwest.net. [75.166.225.82]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-43c94078170sm1695199fac.14.2026.05.29.13.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 13:22:24 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Add tests for Ada "in" operator Date: Fri, 29 May 2026 14:22:23 -0600 Message-ID: <20260529202223.4130030-1-tromey@adacore.com> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Coverage testing showed that there were no existing tests of the Ada "in" operator. This patch adds tests for this. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34041 --- gdb/testsuite/gdb.ada/range.exp | 70 ++++++++++++++++++++++++++++ gdb/testsuite/gdb.ada/range/prog.adb | 29 ++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 gdb/testsuite/gdb.ada/range.exp create mode 100644 gdb/testsuite/gdb.ada/range/prog.adb diff --git a/gdb/testsuite/gdb.ada/range.exp b/gdb/testsuite/gdb.ada/range.exp new file mode 100644 index 00000000000..370f2fdcc85 --- /dev/null +++ b/gdb/testsuite/gdb.ada/range.exp @@ -0,0 +1,70 @@ +# Copyright 2026 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 . + +# Simple tests of the 'abs' operator. + +load_lib "ada.exp" + +require allow_ada_tests + +standard_ada_testfile prog + +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { + return +} + +clean_restart ${testfile} + +set bp_location [gdb_get_line_number "START" ${testdir}/prog.adb] +if {![runto "prog.adb:$bp_location"]} { + return +} + +set is_true [quotemeta {$@DECIMAL = true}] +set is_false [quotemeta {$@DECIMAL = false}] + +proc check_true {var expr} { + gdb_test "print $var in $expr" $::is_true + gdb_test "print $var not in $expr" $::is_false +} + +proc check_false {var expr} { + gdb_test "print $var in $expr" $::is_false + gdb_test "print $var not in $expr" $::is_true +} + +check_true se smaller_enum +check_true se classic_enum +check_false ce smaller_enum +check_true ce classic_enum + +check_true gamma smaller_enum +check_true gamma classic_enum +check_false alpha smaller_enum +check_true alpha classic_enum + +check_true gamma "alpha .. epsilon" +check_false gamma "alpha .. beta" +check_false alpha "gamma .. epsilon" + +check_true beta "a'range" +check_false alpha "a'range" +check_false epsilon "a'range" +check_true beta "a'range(1)" +check_false alpha "a'range(1)" +check_false epsilon "a'range(1)" +check_true beta "a'range(2)" +check_true alpha "a'range(2)" +check_true epsilon "a'range(2)" diff --git a/gdb/testsuite/gdb.ada/range/prog.adb b/gdb/testsuite/gdb.ada/range/prog.adb new file mode 100644 index 00000000000..7b095a5bf36 --- /dev/null +++ b/gdb/testsuite/gdb.ada/range/prog.adb @@ -0,0 +1,29 @@ +-- Copyright 2026 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 . + +procedure Prog is + type Classic_Enum is (Alpha, Beta, Gamma, Epsilon); + subtype Smaller_Enum is Classic_Enum range Beta .. Gamma; + + type A_T is array (Smaller_Enum, Classic_Enum) of Integer; + + SE : Smaller_Enum := Gamma; + CE : Classic_Enum := Epsilon; + + A : A_T := (others => (others => 0)); + +begin + null; -- START +end Prog; base-commit: 742a479fc38a2b119d74a0bac270489911a1fd6c -- 2.54.0