| Message ID | 20260602084541.3829876-16-poulhies@adacore.com |
|---|---|
| State | Committed |
| Commit | a5e6571ead09734d89346d23b7f39cd5486959c6 |
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 230CA4BA2E39 for <patchwork@sourceware.org>; Tue, 2 Jun 2026 08:54:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 230CA4BA2E39 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=lGcBS8Yp X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id F12424BA2E3F for <gcc-patches@gcc.gnu.org>; Tue, 2 Jun 2026 08:46:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F12424BA2E3F 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 F12424BA2E3F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780389971; cv=none; b=oLlRlE6D19A4poT4l7iagDOqc239OwDKhOOs47nQQYGQYinWyqess1fJ70PpvD1xwIyV86u1I6wG156P6bbiYH931PwUsHVIJZQZJdThmqUw90JrfPZCVMuP22j3KRXutXYpja6Z5zk2VZbC5rRlnWxXBoPnPv5aogJ4AMuoZBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780389971; c=relaxed/simple; bh=vZpnn8eLhXK9Qv/MAFk6Fcb5ZtsE0wArdYA2DZ+omvc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ayVM+W3FD76YbdOKh62D7qpTpamaHkSFtUv9GUsriIGT4nmfwgUk0aSNDnhNJq/Jqw5nLynwsATnkM1yGE2TH3Wg852CJWipXOHfpMp58fZrJc4uStpIQuhsbbJPzvx6B+DsyH0mNr4CkroYb9EELYWzBa2yVgSZgYt7Efo7kMw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=lGcBS8Yp DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F12424BA2E3F Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4909e3fa4b2so39352005e9.0 for <gcc-patches@gcc.gnu.org>; Tue, 02 Jun 2026 01:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1780389970; x=1780994770; 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=9B9io6HTTA8UbBUMROzTw4Lclzc1ncgbjx3cZH1GTz4=; b=lGcBS8YptjmW4U0U+1K3nZGqOi3BzxiIntV26RLCtlwKj3bjSH4UWV6mL41b+HLse2 eFqXGx+PhZ7BIKOMgfrESNiG1ax1+r3EixNRXfTVrxO2GWnOfHjmtyvodEFZeIL2DQV3 CLunf3Y+u9B0aYFz8YcR1s6guICuGTsu6qyOYn7v/ml6ExiSdIKZzSjVy2zFmEeSTfmz y1jMjYV52ldufwpSNEBM+rClR/CSuXYJ0N6deVAa16gHoOV5YHc+AZHASytsgxfV8gzH dEqmMvMleXFxWH+Pj7Xqt3OapBnLxsA2hoh3MUskL+c6IsHDPWDqdOSjrdY9aTKH1xMq LasQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780389970; x=1780994770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9B9io6HTTA8UbBUMROzTw4Lclzc1ncgbjx3cZH1GTz4=; b=SX8Hi75FH223wb43GfCyeUQuVo1kCyAnaDtNkcmZesQslQ6g/OtqUNI81/2JleT2uJ yqFzCXwJ5Kxm3tMtrtu6UKNW/ZS7er2+Ro0Bhv8GoUGM4dJFFRZlriWlV5SofO8NG0kl T/rJhGo25UETY5NdcI+FOIsF/smneoDRxUG/kY1FC2EtLFnPLxrCOxasBodLI1nbmtfF x+GhoRqbUioaIe9LJAPb6pjZLWX/uxFO7sIUpb/gRJpoGReH8AU4r6DuIp1oYSbnEayj MJ0YSdFEjGdNmoYQkDLxjakU7lKzOsGWQdskFtYRVnCe9U5qq7eOimOG8aausba5/KzR Q4KA== X-Gm-Message-State: AOJu0Yz13on1ybLyLQ1CVWOPA+M+nzuJOrcdxGYoAJKVxGpQpftnPu7E dRw7AJ6r8CD4Dyt2erIgZLACLH02JIkM9kaaX9zL/we5TeOEmRh59A97xbTtZ8fh+5LHiRCzHFL ACWo= X-Gm-Gg: Acq92OESdL43afyQOrdN/kXcRMeooxrxZa2qognjSZTIThHdF2L1/ODeJ7cfn273xkI QNmAfp97ZBxmyhsPJyy6LGLIY7TE3QtkQB5vZDOOacZsrvSHS+zB5ZLkr6McV7i5iDftYJyHBoK cc0SZw2ENKzSE8rJKRg5frm/JQ03ufYVCipoqOTXtYPnmjMTEYBGcckuCKt0ohQWHQnk929KE/W l7HtFVdGPM0pmIU7lwzlbedpLF4NG/bMVpiDTAdUclvzQBEpnSeXzNOSW1SafUxw7ce5yspnhg+ 0p6KMsdhb/IIQWZq3EU2ysQCukH6Jqrtp6XuEvdvg+lPk85GCAWOP3aZXrDSfs5gEPqRk+/I5c1 S8kzBHgsS9aERM/IbIeVFw6gcpvVjVYFkPKxvnxM7LximT0UM4YrTaqEINWjrq1XYyyRwSzLOa8 0+x8+NDJogPWT3801KSPUKfIUrkIqDCgOp/V4ieDKoq1IUQLrBwQK4RM/C4gLA16xF7FwtmkHn0 XmU/6MIEEf4CsNmGq7sKV41ixAb+KpnJVFWjT4kZw== X-Received: by 2002:a05:600c:8508:b0:489:c57:7836 with SMTP id 5b1f17b1804b1-490a2952644mr236905895e9.27.1780389969883; Tue, 02 Jun 2026 01:46:09 -0700 (PDT) Received: from mecano.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ab55d39csm33907625e9.35.2026.06.02.01.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 01:46:08 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Viljar Indus <indus@adacore.com> Subject: [COMMITTED 16/51] ada: Improve error message for incorrect call arguments Date: Tue, 2 Jun 2026 10:45:04 +0200 Message-ID: <20260602084541.3829876-16-poulhies@adacore.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260602084541.3829876-1-poulhies@adacore.com> References: <20260602084541.3829876-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_BLOCKED, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series |
[COMMITTED,01/51] ada: Rename Private_Component function
|
|
Commit Message
Marc Poulhiès
June 2, 2026, 8:45 a.m. UTC
From: Viljar Indus <indus@adacore.com>
Enumeration literals are considered as zero argument functions.
This is not obvious for most users and can create confusing error
messages when an enumeration literal is referred to as a call. For
example if there are indices applied to it.
Instead create a dedicated error message for this scenario.
gcc/ada/ChangeLog:
* sem_util.adb (Normalize_Actuals): Improve error message.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_util.adb | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 89060c31acd..1745accfe59 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -25981,7 +25981,19 @@ package body Sem_Util is if Reporting then if Is_Entity_Name (Name (N)) then - Error_Msg_N ("too many arguments in call to&", Name (N)); + if Ekind (S) = E_Enumeration_Literal then + Error_Msg_N ("cannot index enumeration literal &", Name (N)); + if Present (Homonym (S)) + and then Sloc (Homonym (S)) = Standard_Location + then + Error_Msg_NE + ("\\did you mean & in Standard'?", + Name (N), + Homonym (S)); + end if; + else + Error_Msg_N ("too many arguments in call to&", Name (N)); + end if; else Error_Msg_N ("too many arguments in call", N); end if;