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

[C++] unused-variable warnings #39387

Closed
huberylee opened this issue Dec 29, 2023 · 2 comments · Fixed by #39389
Closed

[C++] unused-variable warnings #39387

huberylee opened this issue Dec 29, 2023 · 2 comments · Fixed by #39389
Assignees
Milestone

Comments

@huberylee
Copy link
Contributor

Describe the bug, including details regarding any error messages, version, and platform.

In file included from /workspace/arrow/cpp/src/arrow/array/array_base.h:26:
/workspace/arrow/cpp/src/arrow/array/data.h:452:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
/workspace/arrow/cpp/src/arrow/array/data.h:467:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
2 warnings generated.

Component(s)

C++

@huberylee huberylee changed the title Fix compile warning Compile warning Dec 29, 2023
@mapleFU
Copy link
Member

mapleFU commented Dec 29, 2023

@pitrou @felipecrv

Would you think we can enable more compile options like unused-variable?

@kou kou changed the title Compile warning [C++] Compile warning Dec 29, 2023
@kou kou changed the title [C++] Compile warning [C++] unused-variable warnings Dec 29, 2023
@felipecrv
Copy link
Contributor

felipecrv commented Jan 1, 2024

@pitrou @felipecrv

Would you think we can enable more compile options like unused-variable?

It is enabled. This is only an issue on non-debug builds because the variable is only used for an assert. I can send a fix (I have a commit with a fix from days ago on my computer).

felipecrv pushed a commit that referenced this issue Jan 2, 2024
### Rationale for this change

Fix compile warning:
```bash
In file included from /workspace/arrow/cpp/src/arrow/array/array_base.h:26:
/workspace/arrow/cpp/src/arrow/array/data.h:452:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
/workspace/arrow/cpp/src/arrow/array/data.h:467:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
2 warnings generated.
```

### What changes are included in this PR?

### Are these changes tested?

### Are there any user-facing changes?

* Closes: #39387

Authored-by: shibei <shibei.lh@gmail.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
@felipecrv felipecrv added this to the 15.0.0 milestone Jan 2, 2024
clayburn pushed a commit to clayburn/arrow that referenced this issue Jan 23, 2024
### Rationale for this change

Fix compile warning:
```bash
In file included from /workspace/arrow/cpp/src/arrow/array/array_base.h:26:
/workspace/arrow/cpp/src/arrow/array/data.h:452:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
/workspace/arrow/cpp/src/arrow/array/data.h:467:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
2 warnings generated.
```

### What changes are included in this PR?

### Are these changes tested?

### Are there any user-facing changes?

* Closes: apache#39387

Authored-by: shibei <shibei.lh@gmail.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
### Rationale for this change

Fix compile warning:
```bash
In file included from /workspace/arrow/cpp/src/arrow/array/array_base.h:26:
/workspace/arrow/cpp/src/arrow/array/data.h:452:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
/workspace/arrow/cpp/src/arrow/array/data.h:467:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
2 warnings generated.
```

### What changes are included in this PR?

### Are these changes tested?

### Are there any user-facing changes?

* Closes: apache#39387

Authored-by: shibei <shibei.lh@gmail.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
zanmato1984 pushed a commit to zanmato1984/arrow that referenced this issue Feb 28, 2024
### Rationale for this change

Fix compile warning:
```bash
In file included from /workspace/arrow/cpp/src/arrow/array/array_base.h:26:
/workspace/arrow/cpp/src/arrow/array/data.h:452:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
/workspace/arrow/cpp/src/arrow/array/data.h:467:19: warning: unused variable 'buffer_length' [-Wunused-variable]
    const int64_t buffer_length = buffers[i].size / static_cast<int64_t>(sizeof(T));
                  ^
2 warnings generated.
```

### What changes are included in this PR?

### Are these changes tested?

### Are there any user-facing changes?

* Closes: apache#39387

Authored-by: shibei <shibei.lh@gmail.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants