From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id DA3923858D38 for ; Mon, 20 May 2024 07:49:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA3923858D38 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 DA3923858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716191374; cv=none; b=Pro9R9NmpGF70xoaKPHvGg2yTbMa6EJAb6up4b6HquYFszwLOoFOIOmJM/eWgVl3u+XO0tVzbcd3zxechl5Npj5W25wFrwT/fgxkCqaBonKd91GC7FlyI1ZOI3Bd27s5shJVUp2wqYln90YabQ1TSuKdd1U/+Hrea93yHAPYiLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716191374; c=relaxed/simple; bh=tQ/rFdaE74zyXLThRGMZv3ePKdk+OibtS/Q+cA6Vtac=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FOnmTUo6MxvfW6sahDS8u6q8guY6YqAIinFuddlWuHeYzALIVOVAZqYOlq9e7QEPrUEs7biM2erAYw8Iw+GkgwljNq1nIgGlmwde/oDbcfWd6qL4pCk7NPwoGyFk473DQDYnkkxtUQ4i+olr7JD17s81UBVQoxAgBWjwcoDVITk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-420180b5898so17034655e9.2 for ; Mon, 20 May 2024 00:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716191365; x=1716796165; 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=Hn5qmik197VPuhx8s9GbLXuPPETBepO3r2eb3WUwjHo=; b=QrlMf1sFflSlJF70Id/w5kaS7MkYz5sfDGIE+3kNO8JJf5AiNkFQtBzh7UgZgpkbGF VvOKj5oNb0zz849DfJ77DTKAptGePLTb/QDyPcqnkNxaUX97v0AapfXEHLvLtZVncWoE x4j+3E2BQX87QCTcIuW9vRd16F8P9K2FmHokmhDJOL8aFf4NIEUAio1UH+eWXdTxGdy3 i7/78qzz77n3tvGxMvX1fdhV0wcJJt7/YRBCiPJkhhgOW8oyTHyyLUIAgUC3VO/rQzha FUgSnyqpjaRMbwtlV4NM0CjEk5fZ3H+7WrFa05Ga6rHy2tYBrYy1AWhbyCkREFg/SCDe bLuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716191365; x=1716796165; 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=Hn5qmik197VPuhx8s9GbLXuPPETBepO3r2eb3WUwjHo=; b=aJ6hBZVOuemEnaJ0vVYLnzUiaBzyXw6TbpNhefF5Si5kt3ydezA+00ZeScv6a649dX KZcbJpdnNZGLTsGefJhXye5ZmaQHkV7iFVI1klPH0qvsE5GtVgTB6EwVrN9P3eDACpCp uVw2GT+TJPbdot5c9xt2y9VKCP91Ocn1+CE17Qt34kGPSmpR+j2kXmU/Q6V3vIJvUJV1 +t/Y4REIcDy2vUmTk1k0PD8EbCo4ecS2ENgg6x1QGpci97zCZRkdlGnV0yFOjhIAgYB5 8KLYfnaVz/I4+2pnrc69M84JQilDL17WLkIwCU/ERzwxYoLNqZf4yJPsRlhX9N3h+Cbd 49lA== X-Gm-Message-State: AOJu0Yzg3dyuNZfjTMQhH1BXUJzfU2mnv/r3sTN2aiSa3QgI2vVtaXQh klOtJ/dwh683fx+pRkCqQb+oGUJSQO4Q4YKZURwgpXGcYA+P9t278kWi8WdzXLUhxRDduGUxBkY = X-Google-Smtp-Source: AGHT+IEca5uC302dPwhktMiS+3lN7Zfhq+VIX6Ao3dmM86VI2yNsyzKNXrSjMpOvciEoBqpuzN5A0A== X-Received: by 2002:a05:600c:4ed0:b0:41b:d973:253e with SMTP id 5b1f17b1804b1-41fead7a0b5mr172951345e9.41.1716191365694; Mon, 20 May 2024 00:49:25 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41f88111033sm446892175e9.34.2024.05.20.00.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 00:49:25 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 18/30] ada: Apply restriction No_Implementation_Attributes to source nodes only Date: Mon, 20 May 2024 09:48:44 +0200 Message-ID: <20240520074858.222435-18-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240520074858.222435-1-poulhies@adacore.com> References: <20240520074858.222435-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.9 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 List-Id: From: Piotr Trojanek Restriction No_Implementation_Attributes must not be applied to nodes that come from expansion. In particular, it must not be applied to Object_Size, which is implementation-defined attribute before Ada 2022, but appears in expansion of tagged types since Ada 95. gcc/ada/ * sem_attr.adb (Analyze_Attribute): Move IF statement that checks restriction No_Implementation_Attributes for Ada 2005, 2012 and Ada 2022 attributes inside Comes_From_Source condition that checks the same restriction for Ada 83 attributes. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_attr.adb | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 6c32d201c55..414224e86b6 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3221,9 +3221,10 @@ package body Sem_Attr is Check_Restriction_No_Use_Of_Attribute (N); - -- Deal with Ada 83 issues - if Comes_From_Source (N) then + + -- Deal with Ada 83 issues + if not Attribute_83 (Attr_Id) then if Ada_Version = Ada_83 then Error_Msg_Name_1 := Aname; @@ -3234,19 +3235,19 @@ package body Sem_Attr is Check_Restriction (No_Implementation_Attributes, N); end if; end if; - end if; - -- Deal with Ada 2005 attributes that are implementation attributes - -- because they appear in a version of Ada before Ada 2005, ditto for - -- Ada 2012 and Ada 2022 attributes appearing in an earlier version. + -- Deal with Ada 2005 attributes that are implementation attributes + -- because they appear in a version of Ada before Ada 2005, ditto for + -- Ada 2012 and Ada 2022 attributes appearing in an earlier version. - if (Attribute_05 (Attr_Id) and then Ada_Version < Ada_2005) - or else - (Attribute_12 (Attr_Id) and then Ada_Version < Ada_2012) - or else - (Attribute_22 (Attr_Id) and then Ada_Version < Ada_2022) - then - Check_Restriction (No_Implementation_Attributes, N); + if (Attribute_05 (Attr_Id) and then Ada_Version < Ada_2005) + or else + (Attribute_12 (Attr_Id) and then Ada_Version < Ada_2012) + or else + (Attribute_22 (Attr_Id) and then Ada_Version < Ada_2022) + then + Check_Restriction (No_Implementation_Attributes, N); + end if; end if; -- Remote access to subprogram type access attribute reference needs -- 2.43.2