Issue #21: New static analyser merged into main development branch
Summary
Topics: New static analyser and Porting (to new SA) and future-proofing code
New static analyser was merged into devel
branch.
This is a pretty big change.
New static analyser
Expect your code to stop compiling.
New static analyser has been merged into devel
branch and
is considered ready to use.
It is not bug-free, however, and so you can expect some false positives (the SA
errs on the side of caution) and, possibly, a bit of fighting with the analyser.
If it will be too much of a PITA you can either slap [[no_sa]]
attribute on
a function, or pass --no-sa
flag to the assembler when compiling a problematic
unit.
The new static analyser does pretty much everything that the old one was doing, but adds additional details to error reports and performs some extra checks.
One big addition is compile-time type checking and type inference which means that some classes of errors are either completely eliminated or will now surface during compilation (e.g. executing an instruction with an invalid operand type should no longer happen). Type checking and inference works only on instructions, and only on function-by-function basis, which means that every function is analysed in isolation and function calls are not type-checked (this will be implemented in the future).
Porting (to new SA) and future-proofing code
A few notes on the topic of porting your code to new SA, and future proofing it.
Explicit register sets
Always use explicit register sets. This will prevent many SA errors, and also make your code future-proof as using implicit register sets is a deprecated practice.
"Current" register set
Do not use "current" register set. This pseudo-register-set is deprecated and will be removed.
OO instructions
Do not use OO instructions (
class
,
register
,
new
,
prototype
,
msg
).
I have doubts as to the quality of their design and implementation.
They will most probably be either removed or reworked, and SA was not implemented for them.
This lack of support means that code using OO instructions will most probably fail to
compile with errors about unused values, using empty registers, or overwriting of unused
values.
The solution to this is to use [[no_sa]]
in source code, or
passing the --no-sa
flag when compiling units using OO instructions.