From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id C93203882166 for ; Thu, 13 Jun 2024 13:34:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C93203882166 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 C93203882166 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285663; cv=none; b=DqEPUqTO+MVObBLRW4NY6zeB6LU0l40zUD4Yo24MEAyKFKFX+8dVCOK70Ml8uQvxiRT2XtZWUT17QXhR17ZnWllyk87BqCZktBUtuF0BzvrDPm28WJS75EXzXTcYZwCDB3PpD3X+TSCfjPIsEZB2y1fCeOBIfT8Z4gYfFp+mtZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285663; c=relaxed/simple; bh=Gjsc+lKob1VSqLuUZHMIMPmvEkHq6hYxVkzyAg4zhtY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HV2ArC4ijOE0+z76aZVs1YW/PIw/i/LR8utc8koP63GYDQb1E1/a4GpiIc8AkhmSsJDiEUapkXpJa+LbeA08DsHKWoTrp+gX5+pn9+WU23TsQhg2gwmii0e1mT3UrFf+EnVyX6yCTg531/rcm7phg3kndcEeDkLl1toF4Y+gMks= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2ebdfe26217so8901161fa.2 for ; Thu, 13 Jun 2024 06:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718285647; x=1718890447; 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=hIQIKhFeai8J+4t/EMn1vfZRKvdRkNmFT7afo/teKic=; b=A7xwjlKyGGPeVLyMxTFhJTNp1aDaAPSYGu630HsvFkHkeISHx+FdvvNESHDpP88CbB DvT87jassZ9/yPe/SoTjLDY3xhOH5VRH+J45wn5q67oy2EinuC5qVi+xyGM3xep3tVsi V+jiwEakuA9thyktCIJmnrCbyG0SzWM4ASYC1ko4s8pQTUBgzqB/oNpFrLbMNjjHp9zZ 5dJQaVH/JVKOX3i/buVf/5zf0rdJY5FXt9exUv70X2RwVceUdjFWcp8lExMCK5WR20rh ZFjG2RXLxw8IfkL6MEGgOaYv0i/hLU5QbPX5quOKyb1RA4W/2Yoaw66revke594rc8Ed g2cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718285647; x=1718890447; 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=hIQIKhFeai8J+4t/EMn1vfZRKvdRkNmFT7afo/teKic=; b=RFxNk/dRiYamoxa6Q/wBxarTI3cajWJC5o1WN91E1qIssvsna6tajWTpiw/vZVzTLn z6i6FdcYc0cUChM20EhPYqwWVq7mY/UuAccwEp4Qmkksc9GWxsLhjeEGsStwNu9R/QtE EBVbpKpy8x31gFZsWP2KCjb/ApVg294khXpOTIMwXwwDbHXBRavIkoFtDJXXoMGTYZ5z jzjLq/05TIyiPvn4dsc4yt/Q6UaIGQAqmEeroBt8AqHRx+jW0RigV50IfKMEs32oJ1NC NzhQ/roGLolu5hJ5zKb4dwJmQrvSZv3mlH6shtPpPA5yUez6HnDiBzrYWqrxnz198k5x D5Fw== X-Gm-Message-State: AOJu0YwW3doDmtjY1z+H9Irff+t7/inNwl1HXccAXB8/JXWHfzhesLyG FeL7SgAdc4FVlBlQJBYeQBzrW8/NLTWPOhUQbRQCSJTpOwvjgC2gTO0hzUkDbk60Cs0lrWmDts4 = X-Google-Smtp-Source: AGHT+IEL7/sSdIZ54PJnZUbDJkylLqn5MgsVnNZxjL4gX0tHT3wUYXxpsP0MTciKG7rdAtYrTyw2dg== X-Received: by 2002:a05:651c:1a1e:b0:2eb:fbba:cbe6 with SMTP id 38308e7fff4ca-2ebfc8ff55dmr33826261fa.1.1718285647204; Thu, 13 Jun 2024 06:34:07 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9145sm62391955e9.22.2024.06.13.06.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:34:06 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [COMMITTED 22/30] ada: Minor cleanups in generic formal matching Date: Thu, 13 Jun 2024 15:33:28 +0200 Message-ID: <20240613133338.1809385-22-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613133338.1809385-1-poulhies@adacore.com> References: <20240613133338.1809385-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 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,T_SCC_BODY_TEXT_LINE 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: Bob Duff Minor rewording of a warning. Disallow positional notation for <> (but disable this check), and fix resulting errors. Copy use clauses. gcc/ada/ * sem_ch12.adb (Check_Fixed_Point_Actual): Minor rewording; it seems more proper to say "operator" rather than "operation". (Matching_Actual): Give an error for <> in positional notation. This is a syntax error. Disable this for now. (Analyze_Associations): Copy the use clause in all cases. The "mustn't recopy" comment seems wrong, because New_Copy_Tree preserves Slocs. * libgnat/a-ticoau.ads: Fix violation of new postion-box error. * libgnat/a-wtcoau.ads: Likewise. * libgnat/a-ztcoau.ads: Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-ticoau.ads | 2 +- gcc/ada/libgnat/a-wtcoau.ads | 2 +- gcc/ada/libgnat/a-ztcoau.ads | 2 +- gcc/ada/sem_ch12.adb | 28 ++++++++++++++-------------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gcc/ada/libgnat/a-ticoau.ads b/gcc/ada/libgnat/a-ticoau.ads index 223e8237604..58feea3af71 100644 --- a/gcc/ada/libgnat/a-ticoau.ads +++ b/gcc/ada/libgnat/a-ticoau.ads @@ -42,7 +42,7 @@ private generic type Num is digits <>; - with package Aux is new Ada.Text_IO.Float_Aux (Num, <>, <>); + with package Aux is new Ada.Text_IO.Float_Aux (Num, others => <>); package Ada.Text_IO.Complex_Aux is diff --git a/gcc/ada/libgnat/a-wtcoau.ads b/gcc/ada/libgnat/a-wtcoau.ads index 854b7b9fb60..781582dff9b 100644 --- a/gcc/ada/libgnat/a-wtcoau.ads +++ b/gcc/ada/libgnat/a-wtcoau.ads @@ -42,7 +42,7 @@ private generic type Num is digits <>; - with package Aux is new Ada.Wide_Text_IO.Float_Aux (Num, <>, <>); + with package Aux is new Ada.Wide_Text_IO.Float_Aux (Num, others => <>); package Ada.Wide_Text_IO.Complex_Aux is diff --git a/gcc/ada/libgnat/a-ztcoau.ads b/gcc/ada/libgnat/a-ztcoau.ads index 953ed5d9a18..89f19e8e1d3 100644 --- a/gcc/ada/libgnat/a-ztcoau.ads +++ b/gcc/ada/libgnat/a-ztcoau.ads @@ -26,7 +26,7 @@ private generic type Num is digits <>; - with package Aux is new Ada.Wide_Wide_Text_IO.Float_Aux (Num, <>, <>); + with package Aux is new Ada.Wide_Wide_Text_IO.Float_Aux (Num, others => <>); package Ada.Wide_Wide_Text_IO.Complex_Aux is diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 7daa35f7fe1..93e81fd9539 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -1402,8 +1402,8 @@ package body Sem_Ch12 is if No (Formal) then Error_Msg_Sloc := Sloc (Node (Elem)); Error_Msg_NE - ("?instance uses predefined operation, not primitive " - & "operation&#", Actual, Node (Elem)); + ("?instance uses predefined, not primitive, operator&#", + Actual, Node (Elem)); end if; end if; @@ -1490,6 +1490,16 @@ package body Sem_Ch12 is -- Case of positional parameter corresponding to current formal elsif No (Selector_Name (Actual)) then + -- A "<>" without "name =>" is illegal syntax + + if Box_Present (Actual) then + if False then -- ??? + -- Disable this for now, because we have various code that + -- needs to be updated. + Error_Msg_N ("box requires named notation", Actual); + end if; + end if; + Found_Assoc := Actual; Act := Explicit_Generic_Actual_Parameter (Actual); Num_Matched := Num_Matched + 1; @@ -2208,22 +2218,12 @@ package body Sem_Ch12 is end Explicit_Freeze_Check; end if; - -- For use type and use package appearing in the generic part, - -- we have already copied them, so we can just move them where - -- they belong (we mustn't recopy them since this would mess up - -- the Sloc values). + -- Copy use clauses to where they belong when N_Use_Package_Clause | N_Use_Type_Clause => - if Nkind (Original_Node (I_Node)) = - N_Formal_Package_Declaration - then - Append (New_Copy_Tree (Formal), Assoc_List); - else - Remove (Formal); - Append (Formal, Assoc_List); - end if; + Append (New_Copy_Tree (Formal), Assoc_List); when others => raise Program_Error; -- 2.45.1