diff options
author | Yannick Moy <moy@adacore.com> | 2020-10-20 12:53:08 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-11-26 03:39:39 -0500 |
commit | 96ccfec0296a20558942e034b9b7e64573b8b56a (patch) | |
tree | e5b3a487a3633b1d3d47e26f411c1a36c8ae410b /gcc | |
parent | e3946607a681a1bbbc50befcabcfc78a86f42f45 (diff) | |
download | gcc-96ccfec0296a20558942e034b9b7e64573b8b56a.zip gcc-96ccfec0296a20558942e034b9b7e64573b8b56a.tar.gz gcc-96ccfec0296a20558942e034b9b7e64573b8b56a.tar.bz2 |
[Ada] Issue advice for error regarding Old/Loop_Entry on unevaluated expr.
gcc/ada/
* sem_attr.adb (Analyze_Attribute): Issue a continuation message
to give proper recommendation here.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_attr.adb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 42e9844..18b4eea 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -420,9 +420,11 @@ package body Sem_Attr is -- no arguments is used when the caller has already generated the -- required error messages. - procedure Error_Attr_P (Msg : String); + procedure Error_Attr_P (Msg : String; Msg_Cont : String := ""); pragma No_Return (Error_Attr_P); - -- Like Error_Attr, but error is posted at the start of the prefix + -- Like Error_Attr, but error is posted at the start of the prefix. The + -- second message Msg_Cont is useful to issue a continuation message + -- before raising Bad_Attribute. procedure Legal_Formal_Attribute; -- Common processing for attributes Definite and Has_Discriminants. @@ -2690,10 +2692,13 @@ package body Sem_Attr is -- Error_Attr_P -- ------------------ - procedure Error_Attr_P (Msg : String) is + procedure Error_Attr_P (Msg : String; Msg_Cont : String := "") is begin Error_Msg_Name_1 := Aname; Error_Msg_F (Msg, P); + if Msg_Cont /= "" then + Error_Msg_F (Msg_Cont, P); + end if; Error_Attr; end Error_Attr_P; @@ -2842,7 +2847,10 @@ package body Sem_Attr is and then Attr_Id = Attribute_Old then " or be eligible for conditional evaluation" & " (RM 6.1.1 (27))" - else "")); + else ""), + Msg_Cont => + "\using pragma Unevaluated_Use_Of_Old (Allow) will make " + & "this legal"); when 'W' => Error_Msg_Name_1 := Aname; |