Clang.jl
Clang.jl copied to clipboard
Edge cases encountered while generating bindings for Hwloc
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
usesINT_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 |
.
Thanks for the issue. Let's keep collecting those failure cases, so we can fix them in the next round of refactoring.