From patchwork Fri Oct 25 09:10:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 99561 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E165C385840A for ; Fri, 25 Oct 2024 09:23:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id E88AC3857B90 for ; Fri, 25 Oct 2024 09:11:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E88AC3857B90 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 E88AC3857B90 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729847535; cv=none; b=o2d7c18bYOB+/EbWX3FLl6SrJrt2OdEcSgHdviRKYPK5BSdAQM4IkoLEXYAI+PDM/VkYYa6AteLzCGSXvH/g9b8y55ZbUje4zL6VhrEbsY2J4WmVuNnaUiHlA5UWwQi99lcJnpT+iaSrSESMVO9zMRy4NbJGLT/f35QEMDtd6Ow= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729847535; c=relaxed/simple; bh=xETl+XIz1zsZgg0YuVecSO8QB0Z+S3AmqFWKsegzQCk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZoxmohzfCyd8HlMCjGWYeEQRvNh8ORqkyhSFSuFhS6H5Wnx4UrUGMF5TMg+QltSWMmsVo0bKrGMlxVtxHGGTKkH1OqYjGTUdqLmn04QiEuXrfIxXCOnhqZCgPoekvq/68vJhVHBgOcQlLkeIppDFRFj7worll6kBKvsnt8y5ONY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-37d462c91a9so1227619f8f.2 for ; Fri, 25 Oct 2024 02:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1729847514; x=1730452314; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AoAPTwZW5h4/pwaeKWbJCDIoGJNBmvQHa0+92fkBjG0=; b=UMX94MU9HQZuwICxzch/wa2hLaNnpVoglwPPs5EtrSyepjoZUx+Ijhpl9bxG88lRYl eZMcfFADSUFaTjve73H4tDcN+MaP6ui1ZenbS2nZOOS0YrDENardW1vM+MkRbkLsS5cj JlEG4UKGL9gixJYfkh2xgWDBiZwNqflqNH/I2oxgpSPnSk5cT/fU46p5w26zasQblMh9 Ta2wCp7n+5xLL/w7QuoPXWCPasBDcDt0rlVjdDYhTz8IKBQ+dPmq7FnfHy8kHnoTs8+v qV+JvPOv1b2V5K8mc9mvRWIp/9lf2OFDCT6HWcxYda2hQR7pfmIx4TgwUI/u/1ZSTFzO x6pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729847514; x=1730452314; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AoAPTwZW5h4/pwaeKWbJCDIoGJNBmvQHa0+92fkBjG0=; b=S3b3pKrFj7REN5WdUGGRBgUWpJZPDACloIO8IrrSIs2L2jwcYGrJAi84Orcf3oG9JN 0ixYB4T9Y9xn0xgzhBZZuBgoqAe27UPP+fTuHMjzGXr0Ay2JfMMA7sg+LKtR8TFVFmYT ZWi/D5xLcvcqcfUgAx/T27BTEot1xRcqxlPiZf3UDBFf/kC5mRQ4WneKeF8Cjz9Bv/6C TrdZGwy2xCvSeY8jxIFPwkiTwCv/6/s8aFhaWS7upw+IN79PiIbBKgxV6lo/jId7EREl 6iHQ4bLTAV+/1TfUZsgclG882r8Z4hsnkReF57a9O7A/yWiazD4YN55YrRSjjNjA1wAC ujkg== X-Gm-Message-State: AOJu0YxUpob4EBVD1CxLjrZi4U0rfiziCNg5DpmuzxKDV6lsOqr7tp4w HELWlNXNs9JkKj0ijlxZc8mtzVpiIabJ1BYujeygB26ViMc5q/HraIovydjP89WTpD9ij6l2hrw = X-Google-Smtp-Source: AGHT+IH1BJ0DtifDMlx7lW/tDxA+WeXsrjGe4JHZQnEusdgKv4GFCsusmR60SR7f64JruqC74ALEAw== X-Received: by 2002:adf:fd50:0:b0:374:baeb:2ec with SMTP id ffacd0b85a97d-37efcf06b9emr5826241f8f.19.1729847513570; Fri, 25 Oct 2024 02:11:53 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:2626:b78c:6271:6c01]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b47aa8sm1013079f8f.51.2024.10.25.02.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 02:11:53 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Tom Tromey Subject: [COMMITTED 29/35] ada: Standard types are not artificial Date: Fri, 25 Oct 2024 11:10:58 +0200 Message-ID: <20241025091107.485741-29-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241025091107.485741-1-poulhies@adacore.com> References: <20241025091107.485741-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Tom Tromey This changes gigi so that standard types are no longer marked artificial. This change is needed to prevent subsequent patches from causing standard types to have their names elided. Also, although DWARF says that DW_AT_artificial is used for "the declaration of an object or type artificially generated by a compiler and not explicitly declared by the source program", it seems to me that types provided by the language should not be marked as such; and this is what the C and C++ compilers do. gcc/ada/ChangeLog: * gcc-interface/decl.cc (is_artificial): New function. (gnat_to_gnu_entity): Use it. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index f22dea0d2cf..aa22c495a16 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -259,6 +259,18 @@ typedef struct { static bool intrin_profiles_compatible_p (const intrin_binding_t *); +/* Return true if GNAT_ENTITY is artificial, false otherwise. */ + +static bool +is_artificial (Entity_Id gnat_entity) +{ + if (Comes_From_Source (gnat_entity)) + return false; + if (Sloc (gnat_entity) == Standard_Location) + return false; + return true; +} + /* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada entity, return the equivalent GCC tree for that entity (a ..._DECL node) and associate the ..._DECL node with the input GNAT defining identifier. @@ -284,7 +296,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* True if this is a type. */ const bool is_type = IN (kind, Type_Kind); /* True if this is an artificial entity. */ - const bool artificial_p = !Comes_From_Source (gnat_entity); + const bool artificial_p = is_artificial (gnat_entity); /* True if debug info is requested for this entity. */ const bool debug_info_p = Needs_Debug_Info (gnat_entity); /* True if this entity is to be considered as imported. */ @@ -3006,7 +3018,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) in order to decode the packed array type. */ tree gnu_tmp_decl = create_type_decl (gnu_entity_name, gnu_type, - !Comes_From_Source (Etype (gnat_entity)) + is_artificial (Etype (gnat_entity)) && artificial_p, debug_info_p, gnat_entity); /* Save it as our equivalent in case the call below elaborates