From: Arnaud Charlet Date: Tue, 8 Sep 2020 20:09:16 +0000 (-0400) Subject: [Ada] Improve error on missing with clause X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1ab538527f9a67d2af427d1d65015611f4c46a6d;p=gcc.git [Ada] Improve error on missing with clause gcc/ada/ * sem_ch8.adb (Find_Direct_Name.Undefined): Handle known unit names with 3 selectors. --- diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 35c6f60d75d..69430a69375 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -5551,9 +5551,25 @@ package body Sem_Ch8 is and then N = Prefix (Parent (N)) and then Is_Known_Unit (Parent (N)) then - Error_Msg_Node_2 := Selector_Name (Parent (N)); - Error_Msg_N -- CODEFIX - ("\\missing `WITH &.&;`", Prefix (Parent (N))); + declare + P : Node_Id := Parent (N); + begin + Error_Msg_Name_1 := Chars (N); + Error_Msg_Name_2 := Chars (Selector_Name (P)); + + if Nkind (Parent (P)) = N_Selected_Component + and then Is_Known_Unit (Parent (P)) + then + P := Parent (P); + Error_Msg_Name_3 := Chars (Selector_Name (P)); + Error_Msg_N -- CODEFIX + ("\\missing `WITH %.%.%;`", N); + + else + Error_Msg_N -- CODEFIX + ("\\missing `WITH %.%;`", N); + end if; + end; end if; -- Now check for possible misspellings