appleseedlab / maki

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

Maki incorrectly reports valid macros as invalid #48

Closed PappasBrent closed 2 months ago

PappasBrent commented 2 months ago

Maki currently reports some macros with valid source locations as having invalid source locations, and does not emit properties for them when the --no-invalid-macros flag is turned on.

For instance, consider the following code:

#if !defined(RL_IM_INSERT)
#define RL_IM_INSERT 1
#define RL_IM_OVERWRITE 0
#
#define RL_IM_DEFAULT RL_IM_INSERT
#endif

int main() {
    int a = RL_IM_DEFAULT;
}

If the --no-invalid-macros is turned on, then Maki emits no properties for the nested invocation of RM_IM_INSERT (which would mostly be unreliable anyway since the macro invocation is nested but that is besides the point). Maki should treat such macro invocations as valid and emit properties for them.