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,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!26g2000yqv.googlegroups.com!not-for-mail From: Julian Leyh Newsgroups: comp.lang.ada Subject: Warnings about hiding Date: Fri, 8 Oct 2010 05:47:05 -0700 (PDT) Organization: http://groups.google.com Message-ID: <44e7dff1-04f5-46ad-8521-e4fe030c9c29@26g2000yqv.googlegroups.com> NNTP-Posting-Host: 194.156.172.86 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1286564433 12955 127.0.0.1 (8 Oct 2010 19:00:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 8 Oct 2010 19:00:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 26g2000yqv.googlegroups.com; posting-host=194.156.172.86; posting-account=4IMjSwoAAABghF4GBOy5ozdaZM8EkGwR User-Agent: G2/1.0 X-HTTP-Via: 1.0 localhost (squid/3.1.3) X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14438 Date: 2010-10-08T05:47:05-07:00 List-Id: 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 $ The only way i see to solve this, is using pragma Warnings (Off); like this: $ cat bar.ads with Ada.Finalization; package bar is type Barfoo is new Ada.Finalization.Controlled with null record; pragma Warnings(Off); function "=" (L,R : in Barfoo) return Boolean; pragma Warnings(On); private procedure 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