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!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: [AdaControl] Limiting where objects of a specific type can be declared Date: Tue, 14 Mar 2017 14:24:04 +0100 Organization: JSA Research & Innovation Message-ID: <87varcq9e3.fsf@adaheads.consafe1.org> NNTP-Posting-Host: 109.56.117.183.mobile.3.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: franka.jacob-sparre.dk 1489497844 9990 109.56.117.183 (14 Mar 2017 13:24:04 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 14 Mar 2017 13:24:04 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:/VqJMjfP5bERs7ZdS0Dez/7CABQ= Xref: news.eternal-september.org comp.lang.ada:31663 Date: 2017-03-14T14:24:04+01:00 List-Id: On a project I'm working on, we have a type with some ugly C backing, which means that declaring local variables of the type results in memory leaks. The solution to this is to remember to declare variables of this type as global variables in a package. The fast way to check for this with this AdaControl rule: check entities (local SQL.Statement_Type); This looks good until AdaControl finds a clever programmer writing: procedure Something (...) is Stmt : SQL.Statement_Type renames Global_Stmt; begin Since this declaration doesn't leak memory, I don't want to stop the programmer from using it. The next interesting declaration AdaControl finds is a main program, which declares a global variable for later use: procedure Main is Stmt : SQL.Statement_Type; begin [...] end Main; In this case the solution may simply be to ignore this group of utility programs, when running AdaControl, but a modification to the rule would be nice, as that would reduce the amount of thinking involved in deciding which units to check and which not to check. What do we do? (Besides phasing out the problematic library.) Greetings, Jacob -- CAUTION BLADE EXTREMELY SHARP KEEP OUT OF CHILDREN