Skip to content

Bindgen fails to parse math.h  #2596

Closed
Closed
@CGMossa

Description

@CGMossa

Input C/C++ Header

#include <math.h>

Bindgen Invocation

$ bindgen test.h -o test.rs

Actual Results

error[E0428]: the name `FP_INT_UPWARD` is defined multiple times
   --> src/bindings/R_ext/Arith.rs:167:1
    |
151 | pub const FP_INT_UPWARD: u32 = 0;
    | --------------------------------- previous definition of the value `FP_INT_UPWARD` here
...
167 | pub const FP_INT_UPWARD: _bindgen_ty_1 = _bindgen_ty_1::FP_INT_UPWARD;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `FP_INT_UPWARD` redefined here
    |
    = note: `FP_INT_UPWARD` must be defined only once in the value namespace of this module

This was on wsl, ubuntu, jammy, and using Ubuntu clang version 14.0.0-1ubuntu1.1.
I tried with clang-15, same result.

The issue is that this gets generated in the same file:

pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
pub const FP_INT_UPWARD: u32 = 0;
pub const FP_INT_UPWARD: _bindgen_ty_1 = 0;

Expected Results

If I run the same on my Windows installation, I don't get whatever is going on here. In fact, I don't get these
things at all.

clang version 16.0.6

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