public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Spurious warning about hiding in generic instantiation
@ 2021-10-01  6:14 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-10-01  6:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: Gary Dismukes

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

Warnings about declarations being hidden can be issued in some cases
when compiling a generic instantiation, but such warnings aren't correct
(hiding can be flagged in a generic, but shouldn't be in an instance).
The warning is now suppressed within instances.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_util.adb (Enter_Name): Suppress hiding warning when in an
	instance.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 476 bytes --]

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -8656,6 +8656,10 @@ package body Sem_Util is
         and then Comes_From_Source (C)
         and then Comes_From_Source (Def_Id)
 
+        --  Don't warn within a generic instantiation
+
+        and then not In_Instance
+
         --  Don't warn unless entity in question is in extended main source
 
         and then In_Extended_Main_Source_Unit (Def_Id)



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-01  6:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01  6:14 [Ada] Spurious warning about hiding in generic instantiation Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).