Skip to content

bindgen generates a static mut where a const is expected #1316

@alex

Description

@alex

Input C/C++ Header

#define __GFP_IO                0x40u
#define GFP_KERNEL (__GFP_IO)

const unsigned BINDING_GFP_KERNEL = GFP_KERNEL;

Bindgen Invocation

$ bindgen t.h

Actual Results

/* automatically generated by rust-bindgen */

pub const __GFP_IO: u32 = 64;
pub const GFP_KERNEL: u32 = 64;
extern "C" {
    #[link_name = "\u{1}BINDING_GFP_KERNEL"]
    pub static mut BINDING_GFP_KERNEL: ::std::os::raw::c_uint;
}

Expected Results

I expected BINDING_GFP_KERNEL to be generated as pub const BINDING_GFP_KERNEL = ...

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