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 for checking if an invocation expands where a constant expression is required #44

Closed PappasBrent closed 2 months ago

PappasBrent commented 2 months ago

Maki only reports if a macro invocation appears where an integral constant expression is required, but not where a constant expression in general is required.

For instance, in the following code snippet:

#define PI 3.14

#define R 5

float radius = R;

int main(void) {
    static double circumference = 2 * PI * R;
    return 0;
}

Maki should report that both PI and R are expanded where constant expressions are required, because they appear in the initializers of variables with global and static storage.