From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!l6SSJpCTNdcdYkpTNEWC9Q.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Safe to ignore warnings about function mistaken as primitive? Date: Sun, 10 Jul 2022 12:19:11 +0200 Organization: Aioe.org NNTP Server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gioia.aioe.org; logging-data="31126"; posting-host="l6SSJpCTNdcdYkpTNEWC9Q.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:64088 List-Id: On 2022-07-10 10:45, G.B. wrote: > GNAT warns about primitive operations appearing too late in the text. > In the following example, though, F is not meant to be a primitive > operation of A.Some_Tagged, but instead one of type B.Plain. > > Can I ignore the warning? > > gcc -gnatl -c rt_warn.ads > > GNAT 11.2.0 > Copyright 1992-2021, Free Software Foundation, Inc. > cannot generate code for file rt_warn.ads (package spec) > > > Compiling: rt_warn.ads > Source file time stamp: 2022-07-10 08:34:32 > Compiled at: 2022-07-10 10:34:39 > >      1. package Rt_Warn is >      2. >      3.     package A is >      4. >      5.         type Some_Tagged is interface; >      6. >      7.     end A; >      8. >      9.     package B is >     10. >     11.         type Plain is private; >     12. >     13.         function F (Param : A.Some_Tagged) return Plain; >                          | >         >>> warning: declaration of "F" is too late >         >>> warning: spec should appear immediately after declaration > of "Some_Tagged" Some_Tagged is an interface, it cannot have implementations anyway. Should be an error rather than just warning to me. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de