rust-lang / rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.
https://rust-lang.github.io/rust-bindgen/
BSD 3-Clause "New" or "Revised" License
4.34k stars 687 forks source link

bad type recognition, despite explicit suffix #1875

Open joseluis opened 4 years ago

joseluis commented 4 years ago

This code:

#define CELL_WIDEASIAN_MASK     0x8000000000000000ull
#define CELL_NOBACKGROUND_MASK  0x0400000000000000ull

results in:

pub const CELL_WIDEASIAN_MASK: i64 = -9223372036854775808;
pub const CELL_NOBACKGROUND_MASK: u64 = 288230376151711744;

It seems bindgen just notices the leftmost bit on, and decides to turn it into an i64 despite the ull suffix that clearly indicates it should be a u64.

emilio commented 4 years ago

This is probably an issue in https://github.com/jethrogb/rust-cexpr, which only gives us i64s to begin with.

I wonder if #1782 fixes this.

burakemir commented 1 month ago

Seems related: #923