aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-04-23 14:26:48 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-18 05:08:28 -0400
commit0c32ab8232a40d8bb982c0ac13864d2290dc9336 (patch)
treef063ad26e9d423fff6b48908188b6931c9926e78
parentc9a56fd316d254f3155e6eb37b4f662c5fbf6960 (diff)
downloadgcc-0c32ab8232a40d8bb982c0ac13864d2290dc9336.zip
gcc-0c32ab8232a40d8bb982c0ac13864d2290dc9336.tar.gz
gcc-0c32ab8232a40d8bb982c0ac13864d2290dc9336.tar.bz2
[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.
-rw-r--r--gcc/ada/sem_prag.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 689c728..e9cfb13 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;