Skip to content

Macro constant referencing an enumerator does not generate a Rust constant #2192

@doctortheemh

Description

@doctortheemh

Hi all. I'm working on an issue with ffmpeg-next and ffmpeg-sys-next, which are rust bindings to ffmpeg. I'm seeing build errors for former crate on macos stemming from missing constants in the generated bindings. Curiously, linux does not seem to have this issue. I whittled down a smaller test case I believe represents the problem, however, both Linux and macos bindgen invocations are now producing the same results. I'm a bit at loss, can anyone advise if the behavior I'm seeing from bindgen makes sense?

Input C/C++ Header

enum AVChannel {
    AV_CHAN_NONE = -1,
    AV_CHAN_FRONT_LEFT,
};

#define AV_CH_FRONT_LEFT             (1ULL << AV_CHAN_FRONT_LEFT           )

Bindgen Invocation

$ bindgen test.h

Actual Results

/* automatically generated by rust-bindgen 0.59.2 */

pub const AVChannel_AV_CHAN_NONE: AVChannel = -1;
pub const AVChannel_AV_CHAN_FRONT_LEFT: AVChannel = 0;
pub type AVChannel = ::std::os::raw::c_int;

Expected Results

I'd expect to see a constant for AV_CH_FRONT_LEFT.

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