From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,29523eff834b8169 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!postnews.google.com!t5g2000prd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Warnings about hiding Date: Fri, 8 Oct 2010 12:46:33 -0700 (PDT) Organization: http://groups.google.com Message-ID: <86ad4138-6b93-4b1d-a3ba-6ffed2d9d5c0@t5g2000prd.googlegroups.com> References: <44e7dff1-04f5-46ad-8521-e4fe030c9c29@26g2000yqv.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1286567193 9094 127.0.0.1 (8 Oct 2010 19:46:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 8 Oct 2010 19:46:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t5g2000prd.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14449 Date: 2010-10-08T12:46:33-07:00 List-Id: On Oct 8, 5:47=A0am, Julian Leyh wrote: > Hi, > > "-gnatwh" activates warnings on hiding declarations. But sometimes, > hiding is necessary. > > For example, consider this (Controlled type with it's own comparison > operator and finalize procedure, you can reproduce the errors using > these ads files): > > $ cat foo.ads > with Ada.Finalization; > package foo is > =A0 =A0type Foobar is new Ada.Finalization.Controlled with null record; > =A0 =A0function "=3D" (L,R : in Foobar) return Boolean; > private > =A0 =A0procedure Finalize (Object : in out Foobar); > end foo; > $ gnat -gnatwh -gnatc foo.ads > gcc -c -gnatwh -gnatc foo.ads > foo.ads:4:13: warning: declaration of "=3D" hides one in package > Standard > foo.ads:6:14: warning: declaration of "Finalize" hides one at line 3 > $ Well, I was going to suggest using the "overriding" keyword (not a bad idea anyway), but when I tried it, GNAT still displayed the warnings. Now *that* looks like a bug. (I'm using 4.3.3; maybe it's been fixed in a later version) -- Adam > The only way i see to solve this, is using pragma Warnings (Off); like > this: > > $ cat bar.ads > with Ada.Finalization; > package bar is > =A0 =A0type Barfoo is new Ada.Finalization.Controlled with null record; > pragma Warnings(Off); > =A0 =A0function "=3D" (L,R : in Barfoo) return Boolean; > pragma Warnings(On); > private > =A0 =A0procedure Finalize (Object : in out Barfoo); > end bar; > $ gnatmake -gnatc -gnatwh bar.ads > gcc -c -gnatwh -gnatc bar.ads > bar.ads:8:14: warning: declaration of "Finalize" hides one at line 3 > $ > > But that would either remove all warnings between both pragmas, or I > would have to put them around every occurence of the hiding. I don't > like turning all warnings off at once and I don't like adding two > lines of source code just to prevent the warning. Still, I would like > to remove them (without removing -gnatwh). > > Is there a proper way to do this? > > Greetings, > Julian