]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Ineffective use warning is suppressed when performing verification
authorJustin Squirek <squirek@adacore.com>
Thu, 24 May 2018 13:05:20 +0000 (13:05 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 24 May 2018 13:05:20 +0000 (13:05 +0000)
This patch fixes an issue whereby the compiler incorrectly marked use clauses
as effective due to code generated for verification referencing certain types
leading to missing use clause warnings.

No reasonably small testcase available.

2018-05-24  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* sem_res.adb (Resolve_Entity_Name): Add guard to protect against
marking use clauses as effective when the reference appears within
generated code.

From-SVN: r260652

gcc/ada/ChangeLog
gcc/ada/sem_res.adb

index ae9c071bb26f9a7331de64627dee0f79d107b80d..6707a1aef0431514422ea3f8b3d7e63b50f61ba9 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-24  Justin Squirek  <squirek@adacore.com>
+
+       * sem_res.adb (Resolve_Entity_Name): Add guard to protect against
+       marking use clauses as effective when the reference appears within
+       generated code.
+
 2018-05-24  Cyrille Comar  <comar@adacore.com>
 
        * doc/gnat_rm/the_gnat_library.rst: Fix typos.
index e7ee70e6ed17542c20525a50ba709800e174d787..f6caccc536243dfcfff752f44f4267e55cb3decd 100644 (file)
@@ -7293,7 +7293,13 @@ package body Sem_Res is
          end if;
       end if;
 
-      Mark_Use_Clauses (E);
+      --  We may be resolving an entity within expanded code, so a reference
+      --  to an entity should be ignored when calculating effective use clauses
+      --  to avoid inappropriate marking.
+
+      if Comes_From_Source (N) then
+         Mark_Use_Clauses (E);
+      end if;
    end Resolve_Entity_Name;
 
    -------------------