From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id 356C4383942B; Wed, 18 May 2022 14:32:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 356C4383942B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8394] Reduce usage of limited_with clauses with -fdump-ada-spec X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 9c8125b98cdd406fbad09995529a5c6acffdd928 X-Git-Newrev: 696fce736841ea77621a1195ce1914a74b840def Message-Id: <20220518143251.356C4383942B@sourceware.org> Date: Wed, 18 May 2022 14:32:51 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2022 14:32:51 -0000 https://gcc.gnu.org/g:696fce736841ea77621a1195ce1914a74b840def commit r12-8394-g696fce736841ea77621a1195ce1914a74b840def Author: Eric Botcazou Date: Wed May 18 16:27:55 2022 +0200 Reduce usage of limited_with clauses with -fdump-ada-spec The problem is that subtypes are not part of the limited view of a package so we need to use types in conjunction with limited_with clauses, which is not always desirable as this yields less portable Ada bindings. The patch also contains a small enhancement for complex floating-point types. gcc/c-family/ * c-ada-spec.cc (dump_ada_node) : Deal with usual floating-point complex types. : Do not use limited_with clause if the designated type is a scalar type. Diff: --- gcc/c-family/c-ada-spec.cc | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc index f291e150934..faf71742522 100644 --- a/gcc/c-family/c-ada-spec.cc +++ b/gcc/c-family/c-ada-spec.cc @@ -2105,6 +2105,21 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, append_withs ("Interfaces.C.Extensions", false); pp_string (buffer, "Extensions.CFloat_128"); } + else if (TREE_TYPE (node) == float_type_node) + { + append_withs ("Ada.Numerics.Complex_Types", false); + pp_string (buffer, "Ada.Numerics.Complex_Types.Complex"); + } + else if (TREE_TYPE (node) == double_type_node) + { + append_withs ("Ada.Numerics.Long_Complex_Types", false); + pp_string (buffer, "Ada.Numerics.Long_Complex_Types.Complex"); + } + else if (TREE_TYPE (node) == long_double_type_node) + { + append_withs ("Ada.Numerics.Long_Long_Complex_Types", false); + pp_string (buffer, "Ada.Numerics.Long_Long_Complex_Types.Complex"); + } else pp_string (buffer, ""); break; @@ -2190,7 +2205,7 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, { tree ref_type = TREE_TYPE (node); const unsigned int quals = TYPE_QUALS (ref_type); - bool is_access = false; + bool is_access; if (VOID_TYPE_P (ref_type)) { @@ -2242,7 +2257,10 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, } if (!package_prefix) - pp_string (buffer, "access"); + { + is_access = false; + pp_string (buffer, "access"); + } else if (AGGREGATE_TYPE_P (ref_type)) { if (!type || TREE_CODE (type) != FUNCTION_DECL) @@ -2256,17 +2274,21 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc, pp_string (buffer, "all "); } else if (quals & TYPE_QUAL_CONST) - pp_string (buffer, "in "); + { + is_access = false; + pp_string (buffer, "in "); + } else { is_access = true; pp_string (buffer, "access "); - /* ??? should be configurable: access or in out. */ } } else { - is_access = true; + /* We want to use regular with clauses for scalar types, + as they are not involved in circular declarations. */ + is_access = false; pp_string (buffer, "access "); if (!name_only)