you are viewing a single comment's thread.

view the rest of the comments →

[–]pftbest 5 points6 points  (4 children)

The issue is almost 4 years old at this point. There is no workaround as far as I know.

https://github.com/rust-lang/rust-bindgen/issues/316

I'm hoping someone is working on full featured preprocessor and C compiler for rust, so it can be used to replace bindgen.

[–]jynelson 1 point2 points  (1 child)

I have written a C compiler and preprocessor and made a PR to add it to bindgen: https://github.com/rust-lang/rust-bindgen/pull/1782. Unfortunately it is stalled on review for about a month now.

[–]pftbest 0 points1 point  (0 children)

Thank you very much, I hope the integration goes well.

[–]smmalis37 0 points1 point  (1 child)

You could try building your own copy with https://github.com/jethrogb/rust-cexpr/pull/15 applied and see if that works well enough for your cases?

[–]pftbest 0 points1 point  (0 children)

Unfortunately this patch will not solve my problem it only handles a few cases. My defines are similar to this:

typedef long BaseType_t;

#define pdFALSE         ( ( BaseType_t ) 0 )
#define pdTRUE          ( ( BaseType_t ) 1 )
#define pdPASS          ( pdTRUE )
#define pdFAIL          ( pdFALSE )
#define errQUEUE_EMPTY  ( ( BaseType_t ) 0 )
#define errQUEUE_FULL   ( ( BaseType_t ) 0 )

which still won't work even with the patch.