Skip to content

Conversation

@dingxiangfei2009
Copy link

Fix #923.

This patch introduce a new generator flag --macro-const-use-ctypes, which resolves the macro definition expression to a precise type advised by Clang if activated.

A macro expansion result adapter is introduced to maintain compatibility with cexpr, which has a limited capacity to resolve to a precise C type.

Upon activating the `--macro-const-use-ctypes` flag, `bindgen` should
generate bindings with precise type resolution to the exact C types.

This flag implies `--clang-macro-fallback` as its pre-requisite.

Signed-off-by: Xiangfei Ding <dingxiangfei2009@protonmail.ch>
@dingxiangfei2009
Copy link
Author

Apparently the clang fallback has race condition. If I set thread number to 1, we don't have truncated output anymore.

@dingxiangfei2009
Copy link
Author

I have a theory about the test setup leading to the racing. The test setup uses the fallback translation unit backed by a file, which is located in ./.macro_eval.c by default. If the tests run concurrently, they are racing on this shared file. That probably explains why I get evaluation failure "randomly."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Macro defining a constant with unsigned long suffix generates unsigned integer

1 participant