Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge cases encountered while generating bindings for Hwloc #401

Open
JBlaschke opened this issue Nov 26, 2022 · 1 comment
Open

Edge cases encountered while generating bindings for Hwloc #401

JBlaschke opened this issue Nov 26, 2022 · 1 comment
Labels

Comments

@JBlaschke
Copy link

I am generating the bindings for Hwloc_jll, and I encountered a few edge cases that I thought you might like to know about -- all of these have straightforward workarounds, so this isn't urgent here.

  • hwloc.h uses INT_MAX:
#define HWLOC_TYPE_UNORDERED INT_MAX

requiring the inclusion of something like:

const INT_MAX = typemax(Int64)
  • hwloc.h defines:
#define HWLOC_UNKNOWN_INDEX (unsigned)-1

which Clang.jl translated to:

const HWLOC_UNKNOWN_INDEX = unsigned - 1 

I replaced this line with:

const HWLOC_UNKNOWN_INDEX = INT_MAX

instead.

  • Clang.jl also generated lines like:
const __HWLOC_HAVE_ATTRIBUTE_UNUSED = GXX_ABOVE_3_4 || GCC_ABOVE_2_95

However the constants on the RHS are defined as integers, eg:

const GXX_ABOVE_3_4 = 0
const GCC_ABOVE_2_95 = 1

and so on. A quick fix was to replace || with |.

@Gnimuc
Copy link
Member

Gnimuc commented Nov 27, 2022

Thanks for the issue. Let's keep collecting those failure cases, so we can fix them in the next round of refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants