Skip to content

Don't ignore clang-tidy failures#259

Merged
serprex merged 1 commit into
binary-cfrom
clang-tidy
May 28, 2026
Merged

Don't ignore clang-tidy failures#259
serprex merged 1 commit into
binary-cfrom
clang-tidy

Conversation

@theory
Copy link
Copy Markdown
Collaborator

@theory theory commented May 28, 2026

Not sure why we had || true after clang-tidy, but it caused it to always pass. Remove it and fix the issue it reports, notably:

  • Change {0} to {} to eliminate "The value '0' provided to the cast expression is not in the valid range of values for 'xxx'" warnings.
  • Switch from atoi to strtol to eliminate "'atoi' used to convert a string to an integer value, but function will not report conversion errors; consider using 'strtol' instead" warning.
  • Protect against dims[level] garbage in flatten_nested_array's recursion (clang-tidy can't prove level < slot->ndim across recursive calls). Zero-initialize dims & lbs; worst case benign slot->len != 0 returns false.
  • scratch oid was uninitialized, so recursive read_value reading *valtype in CHC_JSON/CHC_OBJECT case tripped garbage-value warning. Set scratch to slot->item_type as canonical pg OID.

@theory theory force-pushed the clang-tidy branch 2 times, most recently from 65176ea to 6fae76b Compare May 28, 2026 14:34
Not sure why we had ` || true` after `clang-tidy`, but it caused it to always
pass. Remove it and fix the issue it reports, notably:

*   Change `{0}` to `{}` to eliminate "The value '0' provided to the
    cast expression is not in the valid range of values for 'xxx'"
    warnings.
*   Switch from `atoi` to `strtol` to eliminate  "'atoi' used to convert
    a string to an integer value, but function will not report
    conversion errors; consider using 'strtol' instead" warning.
*   Protect against dims[level] garbage in flatten_nested_array's recursion
    (clang-tidy can't prove level < slot->ndim across recursive calls).
    Zero-initialize dims & lbs; worst case benign slot->len != 0 returns false.
*   `scratch` oid was uninitialized, so recursive read_value reading *valtype in
    CHC_JSON/CHC_OBJECT case tripped garbage-value warning. Set scratch to
    slot->item_type as canonical pg OID.
@serprex serprex merged commit 9d6234b into binary-c May 28, 2026
21 checks passed
@serprex serprex deleted the clang-tidy branch May 28, 2026 15:55
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