From: Viljar Indus <[email protected]>

gcc/ada/ChangeLog:

        * rtsfind.adb (Maybe_Add_With): Fix skipping implicit
        withs when only an ignored implicit with exists.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/rtsfind.adb | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 14d32372c80..77f3d3766f0 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -1292,7 +1292,17 @@ package body Rtsfind is
       begin
          Clause := U.First_Implicit_With;
          while Present (Clause) loop
-            if Parent (Clause) = Cunit (Current_Sem_Unit) then
+
+            if Parent (Clause) = Cunit (Current_Sem_Unit)
+              and then
+                --  Skip when there is a non-ignored with clause already
+                (not Is_Ignored_Ghost_Node (Clause)
+                 or else
+                   --  Skip if we are going to add a ignored with clause when
+                   --  we already have an ignored with clause.
+                   (Is_Ignored_Ghost_Node (Clause)
+                    and then Ghost_Config.Ghost_Mode = Ignore))
+            then
                return;
             end if;
 
-- 
2.53.0

Reply via email to