How to deal with Postgres macros?
This is more of a question than an issue.
Postgres is full of C macros, for example,
#define HeapTupleIsValid(tuple) PointerIsValid(tuple), which references
#define PointerIsValid(pointer) ((const void*)(pointer) != NULL), which references
#define NULL ((void *)0).
How do you deal with this in Rust? These macros can change from pg version to version, so you probably want to use them somehow, but I don't see any reference to them in pgx-pg-sys, and bindgen doesn't seem to do anything with them.
Just bypass them and do tuple.is_null()?
https://github.com/zombodb/pgx/tree/master/pgx-pg-sys/cshim
Some have been wrapped as C functions. Others I’ve hand-ported to Rust.
In general tho, we don’t have a good solution here. I’ve often wondered how hard it would be to write something to programmatically convert the simple ones from C to Rust. Kinda a bindgen but for (simple) C macros.
This isn't "really" bindgen related... but it's also bindgen related (specifically regarding how bindgen is not quite enough for our needs). See https://github.com/tcdi/pgx/issues/798 and #730 for other examples of that. So, tagging until a better tag comes up.