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,UTF8 Path: g2news1.google.com!news4.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Warnings about hiding Date: Fri, 08 Oct 2010 21:24:19 +0100 Organization: A noiseless patient Spider Message-ID: References: <44e7dff1-04f5-46ad-8521-e4fe030c9c29@26g2000yqv.googlegroups.com> <86ad4138-6b93-4b1d-a3ba-6ffed2d9d5c0@t5g2000prd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 8 Oct 2010 20:24:22 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="6852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/bC12WrouIWPoDIkMBJf8rmqHuKQGUXdE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:6b6jhjcBYRmU2svkxgZlpSY8DxU= sha1:bZQg7UIEaTW257UoWs2rKkqUrE8= Xref: g2news1.google.com comp.lang.ada:14452 Date: 2010-10-08T21:24:19+01:00 List-Id: Adam Beneschan writes: > On Oct 8, 5:47 am, 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 >>    type Foobar is new Ada.Finalization.Controlled with null record; >>    function "=" (L,R : in Foobar) return Boolean; >> private >>    procedure 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 "=" 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) Still there in GCC 4.5.0 & GNAT GPL 2010.