From 1ab538527f9a67d2af427d1d65015611f4c46a6d Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 8 Sep 2020 16:09:16 -0400 Subject: [PATCH] [Ada] Improve error on missing with clause gcc/ada/ * sem_ch8.adb (Find_Direct_Name.Undefined): Handle known unit names with 3 selectors. --- gcc/ada/sem_ch8.adb | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 35c6f60..69430a6 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 -- 2.7.4