Skip to content

--clang-macro-fallback interaction with -Wp,-MMD,file.d #3070

Closed
@ojeda

Description

@ojeda

--clang-macro-fallback, when asking the preprocessor to generate a dependencies file, changes behavior.

For instance, given a header that would benefit from --clang-macro-fallback, such as:

#define F(n) n
#define N F(4)

Then

bindgen x.h -- -Wp,-MMD,file.d

would generate a dependencies file like:

x.o: x.h

However, if we pass --clang-macro-fallback, e.g.

bindgen x.h --clang-macro-fallback -- -Wp,-MMD,file.d

then it generates something like:

macro_eval.o: ...abspath.../x-precompile.h ...abspath.../x.h .macro_eval.c

This was reduced from trying to use the --clang-macro-fallback feature in the Linux kernel (mailing list post including a kernel patch to test/debug the feature).

A possible workaround may be to run bindgen twice.

Cc @jbaublitz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions