public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/c++-modules] [Ada] Add second warning for convention C_Variadic_n
Date: Mon, 29 Jun 2020 21:04:03 +0000 (GMT)	[thread overview]
Message-ID: <20200629210403.3ABD0389040A@sourceware.org> (raw)

https://gcc.gnu.org/g:0c32ab8232a40d8bb982c0ac13864d2290dc9336

commit 0c32ab8232a40d8bb982c0ac13864d2290dc9336
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Apr 23 14:26:48 2020 +0200

    [Ada] Add second warning for convention C_Variadic_n
    
    2020-06-18  Eric Botcazou  <ebotcazou@adacore.com>
    
    gcc/ada/
    
            * sem_prag.adb (Process_Convention): Give a warning on C_Variadic_n
            being applied to a subprogram with exactly n parameters.

Diff:
---
 gcc/ada/sem_prag.adb | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 689c7282947..e9cfb13a830 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -8323,11 +8323,21 @@ package body Sem_Prag is
                      Next_Formal (Formal);
                   end loop;
 
+                  --  Error out if the number of parameters is lower than n
+
                   if Count < Minimum then
                      Error_Msg_Uint_1 := UI_From_Int (Minimum);
                      Error_Pragma_Arg
                        ("argument of pragma% must have at least"
                         & "^ parameters", Arg2);
+
+                  --  But warn if it is exactly n because this is useless
+
+                  elsif Count = Minimum then
+                     Error_Msg_Uint_1 := UI_From_Int (Minimum + 1);
+                     Error_Msg_N
+                       ("??subprogram should have at least ^ parameters",
+                        Get_Pragma_Arg (Arg2));
                   end if;
                end;
             end if;


                 reply	other threads:[~2020-06-29 21:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200629210403.3ABD0389040A@sourceware.org \
    --to=nathan@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).