Skip to content

Fails to generate correct code when UINT64_C is used #3200

Open
@Kriskras99

Description

@Kriskras99

I understand that getting the correct integer type from #define is very difficult, however using UINT64_C should clarify to bindgen that it's a 64-bit integer. Currently the macro parser fails on UINT64_C and the Clang macro fallback is needed, but that still generates a 32-bit integer.

Header:

#include <stdint.h>
#define SOMETHING UINT64_C(1)

Without --clang-macro-fallback:

bindgen --allowlist-item SOMETHING header.h

Output:

/* automatically generated by rust-bindgen 0.71.1 */


With --clang-macro-fallback:

bindgen --clang-macro-fallback --allowlist-item SOMETHING header.h

Output:

/* automatically generated by rust-bindgen 0.71.1 */

pub const SOMETHING: u32 = 1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions