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

fix: Improve limit check for unsigned input #233

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

WillAyd
Copy link
Contributor

@WillAyd WillAyd commented Jun 13, 2023

value within this function is a uint64_t, so using the CHECK_RANGE macro yields warnings/errors like:

/home/willayd/clones/arrow-adbc/c/vendor/nanoarrow/nanoarrow.h:192:31: error: comparison of unsigned expression in>= 0’ is always true [-Werror=type-limits]
  192 |   NANOARROW_RETURN_NOT_OK((x_ >= min_ && x_ <= max_) ? NANOARROW_OK : EINVAL)
      |                               ^
/home/willayd/clones/arrow-adbc/c/vendor/nanoarrow/nanoarrow.h:187:23: note: in definition of macro ‘_NANOARROW_RETURN_NOT_OK_IMPL’
  187 |     const int NAME = (EXPR);                      \
      |                       ^~~~
/home/willayd/clones/arrow-adbc/c/vendor/nanoarrow/nanoarrow.h:192:3: note: in expansion of macro ‘NANOARROW_RETURN_NOT_OK’
  192 |   NANOARROW_RETURN_NOT_OK((x_ >= min_ && x_ <= max_) ? NANOARROW_OK : EINVAL)
      |   ^~~~~~~~~~~~~~~~~~~~~~~
/home/willayd/clones/arrow-adbc/c/vendor/nanoarrow/nanoarrow.h:2606:7: note: in expansion of macro ‘_NANOARROW_CHECK_RANGE’
 2606 |       _NANOARROW_CHECK_RANGE(value, 0, UINT8_MAX);

@codecov-commenter
Copy link

Codecov Report

Merging #233 (171c3fc) into main (bfb004a) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #233   +/-   ##
=======================================
  Coverage   87.64%   87.64%           
=======================================
  Files          60       60           
  Lines        9447     9447           
=======================================
  Hits         8280     8280           
  Misses       1167     1167           
Impacted Files Coverage Δ
src/nanoarrow/nanoarrow_types.h 92.75% <ø> (ø)
src/nanoarrow/array_inline.h 89.72% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@paleolimbot
Copy link
Member

Thank you!

@paleolimbot paleolimbot changed the title Fix UINT Comparison Macro fix: Improve limit check for unsigned input Jun 14, 2023
@paleolimbot paleolimbot merged commit 75dc807 into apache:main Jun 14, 2023
@WillAyd WillAyd deleted the uint-limit-warnings branch June 14, 2023 15:57
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.

3 participants