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.
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;