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

[nodejs binding] Fix building in latest clang #23146

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Dec 18, 2024

Description

This change fixes the build break for Node.js binding on latest AppleClang:

...tensor_helper.cc:65:5 error: integer value -1 is outside of the valid range of values [0,15] for the enumeration type 'napi_typedarray_type' [-Wenum-constexpr-conversion]

Use the underlying type of enum napi_typedarray_type for DATA_TYPE_TYPEDARRAY_MAP to solve this issue.

Because the underlying type is implementation defined (it's int for MSVC and unsigned int for Clang), we use std::underlying_type_t to get the correct type.

@fs-eire fs-eire merged commit 7807350 into main Dec 19, 2024
93 checks passed
@fs-eire fs-eire deleted the fs-eire/fix-nodejs-binding-compiling-err branch December 19, 2024 18:23
guschmue pushed a commit that referenced this pull request Dec 20, 2024
### Description

This change fixes the build break for Node.js binding on latest
AppleClang:

```
...tensor_helper.cc:65:5 error: integer value -1 is outside of the valid range of values [0,15] for the enumeration type 'napi_typedarray_type' [-Wenum-constexpr-conversion]

```

Use the underlying type of enum `napi_typedarray_type` for
`DATA_TYPE_TYPEDARRAY_MAP` to solve this issue.

Because the underlying type is implementation defined (it's `int` for
MSVC and `unsigned int` for Clang), we use `std::underlying_type_t` to
get the correct type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants