From: Justin Squirek Date: Thu, 24 May 2018 13:05:20 +0000 (+0000) Subject: [Ada] Ineffective use warning is suppressed when performing verification X-Git-Tag: basepoints/gcc-10~6541 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36e7d49f8afc9bde0ef5691fc5a3ce4330fd3063;p=thirdparty%2Fgcc.git [Ada] Ineffective use warning is suppressed when performing verification 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 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ae9c071bb26f..6707a1aef043 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-05-24 Justin Squirek + + * 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 * doc/gnat_rm/the_gnat_library.rst: Fix typos. diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index e7ee70e6ed17..f6caccc53624 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -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; -------------------