public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] [Ada] Add second warning for convention C_Variadic_n
@ 2020-08-22 22:48 Giuliano Belinassi
0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 22:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ffb9303660af5a6befeb2ea53c07a86870874dd6
commit ffb9303660af5a6befeb2ea53c07a86870874dd6
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-22 22:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 22:48 [gcc/devel/autopar_devel] [Ada] Add second warning for convention C_Variadic_n Giuliano Belinassi
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).