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

GH-40882: [C++] Suppress shorten-64-to-32 warnings in CUDA/Skyhook codes #40883

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

kou
Copy link
Member

@kou kou commented Mar 29, 2024

Rationale for this change

cpp/src/arrow/gpu/cuda_memory.cc:497:72: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      ARROW_ASSIGN_OR_RAISE(auto device, arrow::cuda::CudaDevice::Make(device_id));
                                         ~~~~~                         ^~~~~~~~~
cpp/src/arrow/gpu/cuda_memory.cc:508:68: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
  ARROW_ASSIGN_OR_RAISE(auto device, arrow::cuda::CudaDevice::Make(device_id));
                                     ~~~~~                         ^~~~~~~~~
cpp/src/skyhook/protocol/skyhook_protocol.cc:109:69: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
  bl->append(reinterpret_cast<const char*>(buffer->data()), buffer->size());
      ~~~~~~                                                ~~~~~~~~^~~~~~
cpp/src/skyhook/cls/cls_skyhook.cc:87:37: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      cls_cxx_read(hctx_, position, nbytes, bl.get());
      ~~~~~~~~~~~~                  ^~~~~~
cpp/src/skyhook/cls/cls_skyhook.cc:87:27: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      cls_cxx_read(hctx_, position, nbytes, bl.get());
      ~~~~~~~~~~~~        ^~~~~~~~
cpp/src/skyhook/protocol/skyhook_protocol.cc:109:69: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
  bl->append(reinterpret_cast<const char*>(buffer->data()), buffer->size());
      ~~~~~~

What changes are included in this PR?

Add casts explicitly.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

Copy link

⚠️ GitHub issue #40882 has been automatically assigned in GitHub to PR creator.

@kou
Copy link
Member Author

kou commented Apr 1, 2024

+1

@kou kou merged commit 06f305e into apache:main Apr 1, 2024
34 of 35 checks passed
@kou kou deleted the cpp-shorten branch April 1, 2024 21:17
@kou kou removed the awaiting committer review Awaiting committer review label Apr 1, 2024
Copy link

After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit 06f305e.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

tolleybot pushed a commit to tmct/arrow that referenced this pull request May 2, 2024
…ook codes (apache#40883)

### Rationale for this change

```text
cpp/src/arrow/gpu/cuda_memory.cc:497:72: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      ARROW_ASSIGN_OR_RAISE(auto device, arrow::cuda::CudaDevice::Make(device_id));
                                         ~~~~~                         ^~~~~~~~~
```

```text
cpp/src/arrow/gpu/cuda_memory.cc:508:68: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
  ARROW_ASSIGN_OR_RAISE(auto device, arrow::cuda::CudaDevice::Make(device_id));
                                     ~~~~~                         ^~~~~~~~~
```

```text
cpp/src/skyhook/protocol/skyhook_protocol.cc:109:69: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
  bl->append(reinterpret_cast<const char*>(buffer->data()), buffer->size());
      ~~~~~~                                                ~~~~~~~~^~~~~~
```

```text
cpp/src/skyhook/cls/cls_skyhook.cc:87:37: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      cls_cxx_read(hctx_, position, nbytes, bl.get());
      ~~~~~~~~~~~~                  ^~~~~~
cpp/src/skyhook/cls/cls_skyhook.cc:87:27: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      cls_cxx_read(hctx_, position, nbytes, bl.get());
      ~~~~~~~~~~~~        ^~~~~~~~
```

```text
cpp/src/skyhook/protocol/skyhook_protocol.cc:109:69: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
  bl->append(reinterpret_cast<const char*>(buffer->data()), buffer->size());
      ~~~~~~
```

### What changes are included in this PR?

Add casts explicitly.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#40882

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
vibhatha pushed a commit to vibhatha/arrow that referenced this pull request May 25, 2024
…ook codes (apache#40883)

### Rationale for this change

```text
cpp/src/arrow/gpu/cuda_memory.cc:497:72: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      ARROW_ASSIGN_OR_RAISE(auto device, arrow::cuda::CudaDevice::Make(device_id));
                                         ~~~~~                         ^~~~~~~~~
```

```text
cpp/src/arrow/gpu/cuda_memory.cc:508:68: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
  ARROW_ASSIGN_OR_RAISE(auto device, arrow::cuda::CudaDevice::Make(device_id));
                                     ~~~~~                         ^~~~~~~~~
```

```text
cpp/src/skyhook/protocol/skyhook_protocol.cc:109:69: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
  bl->append(reinterpret_cast<const char*>(buffer->data()), buffer->size());
      ~~~~~~                                                ~~~~~~~~^~~~~~
```

```text
cpp/src/skyhook/cls/cls_skyhook.cc:87:37: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      cls_cxx_read(hctx_, position, nbytes, bl.get());
      ~~~~~~~~~~~~                  ^~~~~~
cpp/src/skyhook/cls/cls_skyhook.cc:87:27: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
      cls_cxx_read(hctx_, position, nbytes, bl.get());
      ~~~~~~~~~~~~        ^~~~~~~~
```

```text
cpp/src/skyhook/protocol/skyhook_protocol.cc:109:69: error: implicit conversion loses integer precision: 'int64_t' (aka 'long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
  bl->append(reinterpret_cast<const char*>(buffer->data()), buffer->size());
      ~~~~~~
```

### What changes are included in this PR?

Add casts explicitly.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: apache#40882

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant