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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a37:85c2:: with SMTP id h185mr29579056qkd.446.1587031672060; Thu, 16 Apr 2020 03:07:52 -0700 (PDT) X-Received: by 2002:a9d:6315:: with SMTP id q21mr26583803otk.16.1587031671893; Thu, 16 Apr 2020 03:07:51 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 16 Apr 2020 03:07:51 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4544:3750:c821:582d:7e7b:cedc; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 2a02:1206:4544:3750:c821:582d:7e7b:cedc User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8afdbc7f-7089-437e-8be9-9abdb9a94a46@googlegroups.com> Subject: Detect arithmetic operator usage for user-defined integer type From: gautier_niouzes@hotmail.com Injection-Date: Thu, 16 Apr 2020 10:07:52 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58369 Date: 2020-04-16T03:07:51-07:00 List-Id: In a project I'm reworking, there is a type type Opcode is range 0 .. 79; associated with values: k_Load_Address : constant :=3D 0; k_Push_Value : constant :=3D 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, arithmeti= c operations on Opcode values (ouch!). Is there a tool able to list those o= perations for the custom type Opcode, other than defining Opcode as enumera= ted and let the compiler find the arithmetic operations to be removed? Prob= ably it's what I'll do ultimately, but maybe such a detection could be usef= ul in another context. TIA _________________________=20 Gautier's Ada programming=20 http://gautiersblog.blogspot.com/search/label/Ada=20 NB: follow the above link for a valid e-mail address=20