From: Justin Squirek Date: Thu, 11 Jan 2018 08:50:25 +0000 (+0000) Subject: [Ada] Wrong column in sloc of "expect name" error for loop variant X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c8f258171c90b52a45c6884138df740b2ef88c27;p=gcc.git [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 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 88e2ee24737..aff841e18c2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-01-11 Justin Squirek + + * sem_prag.adb (Analyze_Pragma:Pragma_Loop_Variant): Modify error + message to be printed on the pragma argument identifier. + 2018-01-11 Hristian Kirtchev * exp_util.adb (Build_Invariant_Procedure_Declaration): Set the last diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 6bf66ad84a8..4f55db145e7 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 917370960c4..1792495e035 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-01-11 Justin Squirek + + * gnat.dg/loopvar.adb: New testcase. + 2018-01-10 Jan Hubicka PR middle-end/83189 diff --git a/gcc/testsuite/gnat.dg/loopvar.adb b/gcc/testsuite/gnat.dg/loopvar.adb new file mode 100644 index 00000000000..f85402adc1d --- /dev/null +++ b/gcc/testsuite/gnat.dg/loopvar.adb @@ -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;