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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.3d73Ybk3C5U4I2t8lv+lAQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Detect arithmetic operator usage for user-defined integer type Date: Thu, 16 Apr 2020 12:38:40 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <8afdbc7f-7089-437e-8be9-9abdb9a94a46@googlegroups.com> NNTP-Posting-Host: 3d73Ybk3C5U4I2t8lv+lAQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:58370 Date: 2020-04-16T12:38:40+02:00 List-Id: On 2020-04-16 12:07, gautier_niouzes@hotmail.com wrote: > In a project I'm reworking, there is a type > > type Opcode is range 0 .. 79; > > associated with values: > > k_Load_Address : constant := 0; > k_Push_Value : constant := 1; > ... > > I'd like to define Opcode as an enumerated type: > > type Opcode is (k_Load_Address, k_Push_Value, ...); > > The problem is that there are, in some places in the legacy code, arithmetic operations on Opcode values (ouch!). Is there a tool able to list those operations for the custom type Opcode, other than defining Opcode as enumerated and let the compiler find the arithmetic operations to be removed? Probably it's what I'll do ultimately, but maybe such a detection could be useful in another context. You could define your own "+" on Opcode, recompile in GPS, and then "find all references" on "+". That should list it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de