appleseedlab / maki

A tool for analyzing syntactic and semantic properties of C Preprocessor macros in C programs
8 stars 3 forks source link

Add property to check for macro definitions in non-global scope #38

Closed SilverMight closed 2 months ago

SilverMight commented 2 months ago

Maki does not currently have a property to distinguish between macros defined in a global scope and non-global scope (i.e inside of a struct or function). This makes it difficult for translation tools to know what can be easily translated in place, and cannot be easily translated in place.

Example case:

struct A {
    int a;
    int b;
// Declared inside struct. Direction translation to variable or enum will break program.
#define C 10
};

int main() {
    int a = C;
}