(no title)
ahgamut | 2 years ago
From what I understand, this appears to a be separate binary from GCC/Clang that does static analysis and outputs C99.
Can this be a GCC plugin? I know we can write plugins that are activated when a specific macro is provided, and the GCC plugin event list allows intercepting the AST at every function declaration/definition. Unless you're rewriting the AST substantially, I feel this could be a compiler plugin. I'd like to know a bit more about what kinds of AST transformations/checks are run as part of Cake.
thradams|2 years ago
Inside visual studio for instance, we can have on external tools
C:\Program Files (x86)\cake\cake.exe $(ItemPath) -msvc-output -no-output -analyze -nullchecks
The main annotations are qualifiers (similar to const). C23 attributes were considered instead of qualifiers, but qualifiers have better integration with the type system. In any case, macros are used to be declared as empty when necessary.
The qualifiers and the rules can be applied to any compiler. Something harder to specify (but not impossible) is the flow analysis.
Sample of rule for compilers.
int * owner a; int * b; a = b;
we cannot assign view to an owner object. this kind of rule does not require flow analysis.