From patchwork Tue Nov 9 09:45:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 47247 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 34A5E3858422 for ; Tue, 9 Nov 2021 09:50:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34A5E3858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636451438; bh=Z1LiZgI67yEm5BZ27EQCt2e8dlUTFQk7MLdKXccnPxA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=RmSYduNkcBNpwWY2gixNcNrbzmOrFCW1v9AYeZ6PMTexfqbWYwLhV98q4RSav5zVl 55ktFJO3h3kQ5cBY4oR+LVx/M1gmGK6qms6VEp/rxOni+YkhTlJErAi9swtEsOuOJc eEVIqt5B8vGw480btOaNN0949i4GZ3aDGF4OqxT4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id 9096B3858C60 for ; Tue, 9 Nov 2021 09:45:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9096B3858C60 Received: by mail-lf1-x133.google.com with SMTP id b40so13618664lfv.10 for ; Tue, 09 Nov 2021 01:45:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Z1LiZgI67yEm5BZ27EQCt2e8dlUTFQk7MLdKXccnPxA=; b=H8VzJbOBWHJQmnq/kOjGE016mDq/ZZH3edrp6zZV4b7++JK1Nyi98Spivqv7DQEeyG GSu6heFS9H9Xn+dXlB26D3rnSVXWNuhIwyUpiVPh9j1hGGuqDCJffHcGAob406yQ6CgN 8y7N6+3klDisisfRZcnQcbCHcJUTmvMGe8GNY1eLj7i0zNeANVig36IZ2H0smDyRW6jM 34aRkh8eIoyDx5jK49o1YJAF2802pMDi8goFsFFNb+2uTFaPzU2Jc9qXkpjJzWjd1fyJ RpiDtM7zbVbiKAE3P8Y2imAh1RvtHWZUKlmTU/+ZivZ9L10htNHNA5khIqg9zJlv2vtQ AXCw== X-Gm-Message-State: AOAM530DTGLXPhhK8ovHGjise+daizSHmWbb2hOqtkmSQRHrG7Mfp9TK GJdnXmLXUTeebeS+Cz+23FFT9ZvEli3TcQ== X-Google-Smtp-Source: ABdhPJzUd5XtpeYxugBrfsnb5AhSisqbBzYY6pfQinxGyWHeKGMOeD1vVwD5OhwiyS36diiuD+oEkw== X-Received: by 2002:a05:6512:1102:: with SMTP id l2mr5527721lfg.181.1636451146365; Tue, 09 Nov 2021 01:45:46 -0800 (PST) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id a16sm2085085lfu.274.2021.11.09.01.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 01:45:45 -0800 (PST) Date: Tue, 9 Nov 2021 09:45:44 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Complete support for prefixed call on subtypes/derived types Message-ID: <20211109094544.GA830021@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Yannick Moy Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Definition of subtypes and derived types needs to possibly initialize the list meant to store primitive operations when -gnatX is used. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration, Derived_Type_Declaration): Initialize list of primitive operations when Extensions_Allowed. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -5755,6 +5755,15 @@ package body Sem_Ch3 is if Is_Tagged_Type (Id) then Set_No_Tagged_Streams_Pragma (Id, No_Tagged_Streams_Pragma (T)); + end if; + + -- For tagged types, or when prefixed-call syntax is allowed + -- for untagged types, initialize the list of primitive + -- operations to an empty list. + + if Is_Tagged_Type (Id) + or else Extensions_Allowed + then Set_Direct_Primitive_Operations (Id, New_Elmt_List); end if; @@ -17199,8 +17208,12 @@ package body Sem_Ch3 is Set_Etype (T, Any_Type); Set_Scalar_Range (T, Scalar_Range (Any_Type)); - if Is_Tagged_Type (T) - and then Is_Record_Type (T) + -- For tagged types, or when prefixed-call syntax is allowed for + -- untagged types, initialize the list of primitive operations to + -- an empty list. + + if (Is_Tagged_Type (T) and then Is_Record_Type (T)) + or else Extensions_Allowed then Set_Direct_Primitive_Operations (T, New_Elmt_List); end if;