[Ada] Wrong column in sloc of "expect name" error for loop variant
This patch corrects error messages printed when using the pragma Loop_Variant without a named argument from having an incorrect column number in some cases. 2018-01-11 Justin Squirek <squirek@adacore.com> gcc/ada/ * sem_prag.adb (Analyze_Pragma:Pragma_Loop_Variant): Modify error message to be printed on the pragma argument identifier. gcc/testsuite/ * gnat.dg/loopvar.adb: New testcase. From-SVN: r256484
This commit is contained in:
parent
51f3e4e157
commit
c8f258171c
|
@ -1,3 +1,8 @@
|
|||
2018-01-11 Justin Squirek <squirek@adacore.com>
|
||||
|
||||
* sem_prag.adb (Analyze_Pragma:Pragma_Loop_Variant): Modify error
|
||||
message to be printed on the pragma argument identifier.
|
||||
|
||||
2018-01-11 Hristian Kirtchev <kirtchev@adacore.com>
|
||||
|
||||
* exp_util.adb (Build_Invariant_Procedure_Declaration): Set the last
|
||||
|
|
|
@ -18297,7 +18297,7 @@ package body Sem_Prag is
|
|||
Variant := First (Pragma_Argument_Associations (N));
|
||||
while Present (Variant) loop
|
||||
if Chars (Variant) = No_Name then
|
||||
Error_Pragma_Arg ("expect name `Increases`", Variant);
|
||||
Error_Pragma_Arg_Ident ("expect name `Increases`", Variant);
|
||||
|
||||
elsif not Nam_In (Chars (Variant), Name_Decreases,
|
||||
Name_Increases)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2018-01-11 Justin Squirek <squirek@adacore.com>
|
||||
|
||||
* gnat.dg/loopvar.adb: New testcase.
|
||||
|
||||
2018-01-10 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
PR middle-end/83189
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
-- { dg-do compile }
|
||||
|
||||
procedure Loopvar (S : String) is
|
||||
J : Integer := S'First;
|
||||
begin
|
||||
while J < S'Last loop
|
||||
pragma Loop_Variant (J); -- { dg-error "expect name \"Increases\"" }
|
||||
pragma Loop_Variant (Increasing => J); -- { dg-error "expect name \"Increases\"" }
|
||||
pragma Loop_Variant (J + 1); -- { dg-error "expect name \"Increases\"" }
|
||||
pragma Loop_Variant (incr => -J + 1); -- { dg-error "expect name \"Increases\"" }
|
||||
pragma Loop_Variant (decr => -J + 1); -- { dg-error "expect name \"Decreases\"" }
|
||||
pragma Loop_Variant (foof => -J + 1); -- { dg-error "expect name \"Increases\" or \"Decreases\"" }
|
||||
J := J + 2;
|
||||
end loop;
|
||||
end Loopvar;
|
Loading…
Reference in New Issue