From: Jacob Sparre Andersen <jacob@jacob-sparre.dk>
Subject: [AdaControl] Limiting where objects of a specific type can be declared
Date: Tue, 14 Mar 2017 14:24:04 +0100
Date: 2017-03-14T14:24:04+01:00 [thread overview]
Message-ID: <87varcq9e3.fsf@adaheads.consafe1.org> (raw)
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
next reply other threads:[~2017-03-14 13:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 13:24 Jacob Sparre Andersen [this message]
2017-03-14 13:47 ` [AdaControl] Limiting where objects of a specific type can be declared J-P. Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox