dev-ada/gpr: add 26.0.0

Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
This commit is contained in:
Alfredo Tupone
2025-12-25 22:04:07 +01:00
parent bd3e824f1e
commit fb5e488c80
3 changed files with 503 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
DIST gpr-24.2.0-next.tar.gz 1524692 BLAKE2B 0e395f7d913b5b6344bb2d89d7471971ea7fb382bcba8123bcbd3703371b145493ed17560f0b7602f8fa5e89fbbd1a5e24d93763fcf493832a332b9463e96e16 SHA512 4d824a2eddd74fca5b2f51336bc2b8e3a35fac4901ff41ac0d7704aa81474357e0733b96da0fe9d3a09a4b21885812bf29bdeb330025ae466089c9dbefcd8d51
DIST gpr-26.0.0.tar.gz 1881523 BLAKE2B c4dbf58a0b1d9e5e0d483df7c93d6205d7a8287b0da191d4f8a9ff8cd19086789313d063686c772fa45ed6a574fd7474ccfd8e4ea4fd3d064ac87363a34db764 SHA512 ceb34ec18e7719f4fe533fcbaad5586fb6fd6e41e835821a64d41e5a09b8aa0f3e5a35a2ed027e3b1a2e5df7c2ceacfee507a48d0783a641f208c50b93c4f0bf
DIST gpr2-with-gprconfig_kb-25.0.tgz 1772855 BLAKE2B f4bcde7f2ad951d00b7b03b2d49120c301836a2bc676de0c0f7c493573a03b15bc20a6fd7f8d3034a063f6227b47f54468efe14260de1bb52a1da6bc4d5b87d6 SHA512 70fe0fcf541f6d3d90a34cab1638bbc0283dcd765c000406e0cfb73bae1817b30ddfe73f3672247a97c6b6bfc41900bc96a4440ca0c660f9c2f7b9d3cc8f8dcf
DIST gpr2-with-lkparser-24.0.tgz 2030278 BLAKE2B ae42fd876a08a654db2db919e6d777ba603d54d6db618e8b8dbdfcfd9313decad092e0a9feae09ca46ec324cd860eaffbb6fa670290d454414677ad7e4a61dc7 SHA512 eda3c693393763da31312733e2bc06e852b867a32b42da6afdddd623051a1d29f7243aabaef3ae50052b22686dce6db62d9823652ce516d79822e4215f4d87b1
+363
View File
@@ -0,0 +1,363 @@
From 43bb629645c3f558bbba5e3cf4b5902dddae3a6a Mon Sep 17 00:00:00 2001
From: Gary Dismukes <dismukes@adacore.com>
Date: Tue, 21 Oct 2025 00:28:41 +0000
Subject: [PATCH] Updates to gpr2 sources to accommodate limited predefined
reference types
Various reference types declared in gpr2 sources must be changed to be
limited types due to their full types having components of reference types
coming from the predefined container packages, which are now declared as
limited types (as required by AI22-0082). Also, the associated reference
functions's bodies are revised to avoid copying limited references within
return statements.
Note that these changes are being made in advance of merging the changes
to the reference types in the predefined container generics in the GNAT
library, but are believed to be compatible with the nonlimited reference
types in the current library.
Issue: eng/toolchain/gnat#1098
---
src/build/gpr2-build-tree_db.adb | 24 ++++++++++++++++++++----
src/build/gpr2-build-tree_db.ads | 20 +++++++++++---------
src/build/gpr2-build-unit_info-list.adb | 5 +++--
src/build/gpr2-build-unit_info-list.ads | 5 +++--
src/lib/gpr2-log.adb | 4 ++--
src/lib/gpr2-log.ads | 9 +++++----
src/lib/gpr2-project-attribute-set.adb | 6 ++++--
src/lib/gpr2-project-attribute-set.ads | 12 +++++++-----
src/lib/gpr2-project-import-set.adb | 3 ++-
src/lib/gpr2-project-import-set.ads | 6 ++++--
10 files changed, 61 insertions(+), 33 deletions(-)
diff --git a/src/build/gpr2-build-tree_db.adb b/src/build/gpr2-build-tree_db.adb
index 2cb71c052..dca5fa4b7 100644
--- a/src/build/gpr2-build-tree_db.adb
+++ b/src/build/gpr2-build-tree_db.adb
@@ -90,7 +90,8 @@ package body GPR2.Build.Tree_Db is
is
Ref : constant Action_Maps.Reference_Type := Self.Actions.Reference (Id);
begin
- return (Element => Ref.Element.all'Unchecked_Access, Ref => Ref);
+ return (Element => Ref.Element.all'Unchecked_Access,
+ Ref => Self.Actions.Reference (Id));
end Action_Id_To_Reference;
----------------------
@@ -104,7 +105,8 @@ package body GPR2.Build.Tree_Db is
Ref : constant Action_Maps.Reference_Type :=
Iterator.Db.Actions.Reference (Pos.Pos);
begin
- return (Element => Ref.Element.all'Unchecked_Access, Ref => Ref);
+ return (Element => Ref.Element.all'Unchecked_Access,
+ Ref => Iterator.Db.Actions.Reference (Pos.Pos));
end Action_Reference;
----------------
@@ -343,7 +345,8 @@ package body GPR2.Build.Tree_Db is
Ref : constant Action_Maps.Constant_Reference_Type :=
Iterator.Db.Actions.Constant_Reference (Pos.Pos);
begin
- return (Element => Ref.Element.all'Unchecked_Access, Ref => Ref);
+ return (Element => Ref.Element.all'Unchecked_Access,
+ Ref => Iterator.Db.Actions.Constant_Reference (Pos.Pos));
end Constant_Action_Reference;
---------------------------------
@@ -368,7 +371,20 @@ package body GPR2.Build.Tree_Db is
when others =>
raise Internal_Error with "Wrong kind of cursor");
begin
- return (Element => Ref.Element.all'Unchecked_Access, Ref => Ref);
+ return (Element => Ref.Element.all'Unchecked_Access,
+ Ref =>
+ (case Pos.Current is
+ when Implicit_Inputs =>
+ Iterator.Db.Implicit_Inputs.Constant_Reference
+ (Pos.Map_Pos).Constant_Reference (Pos.Pos),
+ when Explicit_Inputs =>
+ Iterator.Db.Inputs.Constant_Reference
+ (Pos.Map_Pos).Constant_Reference (Pos.Pos),
+ when Outputs =>
+ Iterator.Db.Outputs.Constant_Reference
+ (Pos.Map_Pos).Constant_Reference (Pos.Pos),
+ when others =>
+ raise Program_Error with "Wrong kind of cursor"));
end Constant_Artifact_Reference;
------------
diff --git a/src/build/gpr2-build-tree_db.ads b/src/build/gpr2-build-tree_db.ads
index 00a5da22a..3e9fe6dcb 100644
--- a/src/build/gpr2-build-tree_db.ads
+++ b/src/build/gpr2-build-tree_db.ads
@@ -166,8 +166,9 @@ package GPR2.Build.Tree_Db is
(List : Artifacts_List) return Artifact_Iterators.Forward_Iterator'Class;
type Constant_Artifact_Reference_Type
- (Element : not null access constant Artifacts.Object'Class) is private
- with Implicit_Dereference => Element;
+ (Element : not null access constant Artifacts.Object'Class) is
+ limited private
+ with Implicit_Dereference => Element;
function Constant_Artifact_Reference
(Iterator : aliased Artifacts_List;
@@ -199,8 +200,8 @@ package GPR2.Build.Tree_Db is
(List : Actions_List) return Action_Iterators.Forward_Iterator'Class;
type Action_Reference_Type
- (Element : not null access Actions.Object'Class) is private
- with Implicit_Dereference => Element;
+ (Element : not null access Actions.Object'Class) is limited private
+ with Implicit_Dereference => Element;
function Action_Id_To_Reference
(Self : in out Object;
@@ -212,8 +213,9 @@ package GPR2.Build.Tree_Db is
Pos : Action_Cursor) return Action_Reference_Type;
type Constant_Action_Reference_Type
- (Element : not null access constant Actions.Object'Class) is private
- with Implicit_Dereference => Element;
+ (Element : not null access constant Actions.Object'Class) is
+ limited private
+ with Implicit_Dereference => Element;
function Constant_Action_Reference
(Iterator : aliased Actions_List;
@@ -438,7 +440,7 @@ private
type Constant_Artifact_Reference_Type
(Element : not null access constant Artifacts.Object'Class)
- is record
+ is limited record
Ref : Artifact_Vectors.Constant_Reference_Type (Element);
end record;
@@ -463,13 +465,13 @@ private
type Action_Reference_Type
(Element : not null access Actions.Object'Class)
- is record
+ is limited record
Ref : Action_Maps.Reference_Type (Element);
end record;
type Constant_Action_Reference_Type
(Element : not null access constant Actions.Object'Class)
- is record
+ is limited record
Ref : Action_Maps.Constant_Reference_Type (Element);
end record;
diff --git a/src/build/gpr2-build-unit_info-list.adb b/src/build/gpr2-build-unit_info-list.adb
index 69213b9bb..549523efa 100644
--- a/src/build/gpr2-build-unit_info-list.adb
+++ b/src/build/gpr2-build-unit_info-list.adb
@@ -29,7 +29,8 @@ package body GPR2.Build.Unit_Info.List is
Self.Units.Constant_Reference (Unit_Map.Cursor (Position));
begin
return (Element => Ref.Element.all'Unchecked_Access,
- Ref => Ref);
+ Ref => Self.Units.Constant_Reference
+ (Unit_Map.Cursor (Position)));
end Constant_Reference;
function Constant_Reference
@@ -140,7 +141,7 @@ package body GPR2.Build.Unit_Info.List is
Self.Units.Reference (Unit_Map.Cursor (Position));
begin
return (Element => Ref.Element.all'Unchecked_Access,
- Ref => Ref);
+ Ref => Self.Units.Reference (Unit_Map.Cursor (Position)));
end Reference;
end GPR2.Build.Unit_Info.List;
diff --git a/src/build/gpr2-build-unit_info-list.ads b/src/build/gpr2-build-unit_info-list.ads
index 210ad9dc5..8d0bc027a 100644
--- a/src/build/gpr2-build-unit_info-list.ads
+++ b/src/build/gpr2-build-unit_info-list.ads
@@ -56,7 +56,8 @@ package GPR2.Build.Unit_Info.List is
Index : Unit_Index) return Unit_Info.Object;
-- Get a single unit
- type Reference_Type (Element : not null access Unit_Info.Object) is private
+ type Reference_Type
+ (Element : not null access Unit_Info.Object) is limited private
with Implicit_Dereference => Element;
function Reference
@@ -64,7 +65,7 @@ package GPR2.Build.Unit_Info.List is
Position : Cursor) return Reference_Type;
type Constant_Reference_Type
- (Element : not null access constant Unit_Info.Object) is private
+ (Element : not null access constant Unit_Info.Object) is limited private
with Implicit_Dereference => Element;
function Constant_Reference
diff --git a/src/lib/gpr2-log.adb b/src/lib/gpr2-log.adb
index 9711f6048..e66eafef6 100644
--- a/src/lib/gpr2-log.adb
+++ b/src/lib/gpr2-log.adb
@@ -93,7 +93,7 @@ package body GPR2.Log is
begin
return Constant_Reference_Type'
(Message => Ref.Element.all'Unrestricted_Access,
- Ref => Ref);
+ Ref => Message_Set.Constant_Reference (Self.Store, Position.P));
end Constant_Reference;
-----------
@@ -256,7 +256,7 @@ package body GPR2.Log is
begin
return Reference_Type'
(Message => Ref.Element.all'Unrestricted_Access,
- Ref => Ref);
+ Ref => Message_Set.Reference (Self.Store, Position.P));
end Reference;
--------------
diff --git a/src/lib/gpr2-log.ads b/src/lib/gpr2-log.ads
index e4616aa55..63bed5c54 100644
--- a/src/lib/gpr2-log.ads
+++ b/src/lib/gpr2-log.ads
@@ -82,7 +82,8 @@ package GPR2.Log is
package Log_Iterator is new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Constant_Reference_Type
- (Message : not null access constant GPR2.Message.Object) is private
+ (Message : not null access constant GPR2.Message.Object)
+ is limited private
with Implicit_Dereference => Message;
function Constant_Reference
@@ -90,7 +91,7 @@ package GPR2.Log is
Position : Cursor) return Constant_Reference_Type;
type Reference_Type
- (Message : not null access GPR2.Message.Object) is private
+ (Message : not null access GPR2.Message.Object) is limited private
with Implicit_Dereference => Message;
function Reference
@@ -130,7 +131,7 @@ private
end record;
type Constant_Reference_Type
- (Message : not null access constant GPR2.Message.Object) is record
+ (Message : not null access constant GPR2.Message.Object) is limited record
-- We need to keep the underlying reference so that it is not cleared
-- upon return of the getter, and so that the container has the proper
-- busy state
@@ -138,7 +139,7 @@ private
end record;
type Reference_Type
- (Message : not null access GPR2.Message.Object) is record
+ (Message : not null access GPR2.Message.Object) is limited record
-- We need to keep the underlying reference so that it is not cleared
-- upon return of the getter, and so that the container has the proper
-- busy state
diff --git a/src/lib/gpr2-project-attribute-set.adb b/src/lib/gpr2-project-attribute-set.adb
index ca316eb4c..26b4b16bf 100644
--- a/src/lib/gpr2-project-attribute-set.adb
+++ b/src/lib/gpr2-project-attribute-set.adb
@@ -49,7 +49,8 @@ package body GPR2.Project.Attribute.Set is
begin
return Constant_Reference_Type'
(Attribute => Ref.Element.all'Unrestricted_Access,
- Ref => Ref);
+ Ref => Self.Attributes.Constant_Reference
+ (Position.CM).Constant_Reference (Position.CA));
end Constant_Reference;
--------------
@@ -419,7 +420,8 @@ package body GPR2.Project.Attribute.Set is
begin
return Reference_Type'
(Attribute => Ref.Element.all'Unrestricted_Access,
- Ref => Ref);
+ Ref => Self.Attributes.Reference (Position.CM).Reference
+ (Position.CA));
end Reference;
end GPR2.Project.Attribute.Set;
diff --git a/src/lib/gpr2-project-attribute-set.ads b/src/lib/gpr2-project-attribute-set.ads
index bc22704db..28c5186df 100644
--- a/src/lib/gpr2-project-attribute-set.ads
+++ b/src/lib/gpr2-project-attribute-set.ads
@@ -92,12 +92,14 @@ package GPR2.Project.Attribute.Set is
new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Constant_Reference_Type
- (Attribute : not null access constant Project.Attribute.Object) is private
+ (Attribute : not null access constant Project.Attribute.Object)
+ is limited private
with Implicit_Dereference => Attribute;
type Reference_Type
- (Attribute : not null access Project.Attribute.Object) is private
- with Implicit_Dereference => Attribute;
+ (Attribute : not null access Project.Attribute.Object)
+ is limited private
+ with Implicit_Dereference => Attribute;
function Constant_Reference
(Self : aliased Object;
@@ -160,7 +162,7 @@ private
type Constant_Reference_Type
(Attribute : not null access constant Project.Attribute.Object)
- is record
+ is limited record
-- We need to keep the underlying reference so that it is not cleared
-- upon return of the getter, and so that the container has the proper
-- busy state
@@ -169,7 +171,7 @@ private
type Reference_Type
(Attribute : not null access Project.Attribute.Object)
- is record
+ is limited record
-- We need to keep the underlying reference so that it is not cleared
-- upon return of the getter, and so that the container has the proper
-- busy state
diff --git a/src/lib/gpr2-project-import-set.adb b/src/lib/gpr2-project-import-set.adb
index 55748c2b3..dc76b24c7 100644
--- a/src/lib/gpr2-project-import-set.adb
+++ b/src/lib/gpr2-project-import-set.adb
@@ -38,7 +38,8 @@ package body GPR2.Project.Import.Set is
begin
return Constant_Reference_Type'
(Import => Ref.Element.all'Unrestricted_Access,
- Ref => Ref);
+ Ref => Base_Name_Set.Constant_Reference
+ (Self.Set, Position.Current));
end Constant_Reference;
--------------
diff --git a/src/lib/gpr2-project-import-set.ads b/src/lib/gpr2-project-import-set.ads
index 67dae8e03..978f74686 100644
--- a/src/lib/gpr2-project-import-set.ads
+++ b/src/lib/gpr2-project-import-set.ads
@@ -66,7 +66,8 @@ package GPR2.Project.Import.Set is
new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Constant_Reference_Type
- (Import : not null access constant Project.Import.Object) is private
+ (Import : not null access constant Project.Import.Object)
+ is limited private
with Implicit_Dereference => Import;
function Constant_Reference
@@ -93,7 +94,8 @@ private
Cursor'(Current => Base_Name_Set.No_Element);
type Constant_Reference_Type
- (Import : not null access constant Project.Import.Object) is record
+ (Import : not null access constant Project.Import.Object)
+ is limited record
-- We need to keep the underlying reference so that it is not cleared
-- upon return of the getter, and so that the container has the proper
-- busy state
+139
View File
@@ -0,0 +1,139 @@
# Copyright 2022-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
ADA_COMPAT=( gcc_{14..16} )
PYTHON_COMPAT=( python3_{10..13} )
inherit ada python-any-r1 multiprocessing
DESCRIPTION="LibGPR2 - Parser for GPR Project files"
HOMEPAGE="https://github.com/AdaCore/gpr"
SRC_URI="https://github.com/AdaCore/${PN}/archive/refs/tags/v${PV}.tar.gz
-> ${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="static-libs static-pic test"
REQUIRED_USE="${ADA_REQUIRED_USE}"
RESTRICT="!test? ( test )"
RDEPEND="${ADA_DEPS}
dev-ada/xmlada[${ADA_USEDEP},shared,static-libs?,static-pic?]
>=dev-ada/gnatcoll-core-26[${ADA_USEDEP},shared,static-libs?,static-pic?]
dev-ada/gnatcoll-bindings[${ADA_USEDEP},shared,static-libs?,static-pic?,iconv(+),gmp]
"
DEPEND="${RDEPEND}
dev-ada/gprconfig_kb[${ADA_USEDEP}]
dev-ada/gprbuild[${ADA_USEDEP}]"
BDEPEND="test? (
$(python_gen_any_dep '
dev-ada/e3-testsuite[${PYTHON_USEDEP}]
')
dev-ada/gnatmem
)"
PATCHES=( "${FILESDIR}"/${P}-gcc16.patch )
python_check_deps() {
use test || return 0
python_has_version "dev-ada/e3-testsuite[${PYTHON_USEDEP}]"
}
pkg_setup() {
use test && python-any-r1_pkg_setup
ada_pkg_setup
}
src_prepare() {
default
cd testsuite/tests
rm -r \
abstract-importing-non-abstract aggregate ali_parser attribute \
autoconf build-actions build_db build_makefile_parser \
callgraph-install c-closure check-has-value check-mem \
check-shared-lib-import command_line config \
custom_attr_no_pack default-target disable_warnings display-version \
empty_attribute_support explicit-target executable-directory \
excluded_source_dirs externals-in-configuration-project \
ignore_source_sub_dirs installed_asm_object \
invalid-project invalid-project-2 invalid-trace-file kb \
library load-preinstalled \
multi-unit-3 nested-case nested-externals no-naming-package-in-config \
options package-extension package-renaming parent-var-visible \
parser-no-value prj-syntax-error process_manager runtime \
self-project-attribute source subdirs target-checks tools \
types-import unknown-var-config unit_filename_generator view_builder \
build_db_dag/actions_signature tooling/source_dirs || die
}
src_compile() {
local BUILD_ROOT=.build
local KB_BUILD_DIR=${BUILD_ROOT}/kb
mkdir -p ${KB_BUILD_DIR} || die
cp kb/gpr2-kb-embedded.ads ${KB_BUILD_DIR} || die
gprbuild -p -P kb/collect_kb.gpr -v -largs ${LDFLAGS} -cargs ${ADAFLAGS} \
|| die
.build/kb/collect_kb -o .build/kb /usr/share/gprconfig || die
build () {
gprbuild -j$(makeopts_jobs) -m -p -v -XLIBRARY_TYPE=$1 \
-XGPR2_BUILD=release -XXMLADA_BUILD=$1 gpr2.gpr \
-largs ${LDFLAGS} \
-cargs ${ADAFLAGS} || die "gprbuild failed"
}
build relocatable
if use static-libs; then
build static
fi
if use static-pic; then
build static-pic
fi
gprbuild -p -m -v -j$(makeopts_jobs) -aP . -XGPR2_BUILD=release \
-XLIBRARY_TYPE=relocatable -XXMLADA_BUILD=relocatable tools/gpr2_tools.gpr \
-largs ${LDFLAGS} -cargs ${ADAFLAGS} || die
}
src_test() {
cd testsuite
./testsuite.py |& grep -w FAIL && die
}
src_install() {
build () {
gprinstall -XLIBRARY_TYPE=$1 -f -p -v -XGPR2_BUILD=release \
--prefix="${D}/usr" -XXMLADA_BUILD=$1 \
--build-name=$1 --build-var=LIBRARY_TYPE \
--build-var=GPR2_LIBRARY_TYPE gpr2.gpr || die
}
build relocatable
if use static-libs; then
build static
fi
if use static-pic; then
build static-pic
fi
gprinstall -p -f -v --prefix="${D}/usr" -XGPR2_BUILD=release \
-XLIBRARY_TYPE=relocatable -XXMLADA_BUILD=relocatable \
--build-name=relocatable --mode=usage tools/gpr2_tools.gpr || die
sed -i \
-e 's|"gpr2.build.view_tables.update_sources_list", ||g' \
-e 's|"gpr2.tree_internal.load_autoconf", ||g' \
"${D}"/usr/share/gpr/gpr2.gpr \
|| die
einstalldocs
rm "${D}"/usr/bin/gprconfig || die
rm "${D}"/usr/bin/gprbuild || die
rm "${D}"/usr/bin/gprclean || die
rm "${D}"/usr/bin/gprinstall || die
rm -r "${D}"/usr/share/gpr/manifests || die
}