comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Unreferenced parameters
Date: Wed, 3 Feb 2021 21:12:15 -0600	[thread overview]
Message-ID: <rvfomg$svi$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: lyim79c8ti.fsf@pushface.org

We (the ARG) recently added an allowance for aspect specifications on 
parameters and a few other constructs. The reason in part was because we 
didn't want to restrict where implementation-defined aspects can be placed, 
and the motivating case was aspect Unreferenced.

So I'd guess that you can put the aspect directly on the parameters in the 
usual way (but that may require a compiler not available yet; the change was 
approved in Sept [AI12-0395-1] and Oct [AI12-0398-1]). So, I'd expect the 
following to work (eventually):

 overriding function Expand_Tabs
     (This   : Dummy_Editor_Buffer with Unreferenced;
      Line   : Editable_Line_Type with Unreferenced;
      Column : Character_Offset_Type with Unreferenced) return 
Visible_Column_Type is (0);

                             Randy.




"Simon Wright" <simon@pushface.org> wrote in message 
news:lyim79c8ti.fsf@pushface.org...
> In gps-editors.ads:1492, in GNAT Studio, I have
>
>   overriding function Expand_Tabs
>     (This   : Dummy_Editor_Buffer;
>      Line   : Editable_Line_Type;
>      Column : Character_Offset_Type) return Visible_Column_Type is (0);
>
> and FSF GCC 10.1.0 says
>
> gps-editors.ads:1494:07: warning: formal parameter "Line" is not 
> referenced
> gps-editors.ads:1495:07: warning: formal parameter "Column" is not 
> referenced
>
> which is clearly the case (how does it know that it's OK not to
> reference This? it must check the context).
>
> The compilation is set to treat warnings as errors (-gnatwe) so I need
> to suppress these warnings.
>
> I could do so with pragma Warnings (Off, "formal*not referenced");
>
> I have done so by renaming the parameters Dummy_Line, Dummy_Column.
>
> But is there a way of using aspect or pragma Unreferenced? Putting
> pragma Unreferenced after the function definition doesn't work.
> 


  parent reply	other threads:[~2021-02-04  3:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 18:20 Unreferenced parameters Simon Wright
2021-02-03 18:50 ` Egil H H
2021-02-03 18:53   ` Egil H H
2021-02-03 19:29     ` Dmitry A. Kazakov
2021-02-04 10:48       ` Simon Wright
2021-02-03 19:32     ` Simon Wright
2021-02-03 22:27       ` Shark8
2021-02-04  3:12 ` Randy Brukardt [this message]
2021-02-04 10:27   ` Simon Wright
2021-02-09 11:16     ` Egil H H
2021-02-09 18:54       ` Stephen Leake
2021-02-09 21:20         ` Simon Wright
2021-02-11  3:20         ` Randy Brukardt
2021-02-11 20:18           ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox