Skip to content

flash_image.c: fix clang build#1045

Open
trofi wants to merge 1 commit intoNuand:masterfrom
trofi:clang-fix
Open

flash_image.c: fix clang build#1045
trofi wants to merge 1 commit intoNuand:masterfrom
trofi:clang-fix

Conversation

@trofi
Copy link
Copy Markdown

@trofi trofi commented Nov 15, 2025

Without the change the build fails on `clang as:

/build/bladeRF/host/utilities/bladeRF-cli/src/cmd/flash_image.c:71:35:
  error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
   71 |                 if (val[i] >= 'a' || val[i] <= 'f') {
      |                     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

I think it flags real error. Let's use && to catch the range.

Without the change the build fails on `clang as:

    /build/bladeRF/host/utilities/bladeRF-cli/src/cmd/flash_image.c:71:35:
      error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
       71 |                 if (val[i] >= 'a' || val[i] <= 'f') {
          |                     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

I think it flags real error. Let's use `&&` to catch the range.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 15, 2025

CLA assistant check
All committers have signed the CLA.

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Mar 13, 2026
With clang 21 comms/bladerf fails to build, with errors similar to:

    /wrkdirs/usr/ports/comms/bladerf/work/bladeRF-2025.10/host/utilities/bladeRF-cli/src/cmd/flash_image.c:71:35: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
       71 |                 if (val[i] >= 'a' || val[i] <= 'f') {
          |                     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

This is a logic error: the logical operator should be `&&` here. It has
been proposed as an upstream pull request:
Nuand/bladeRF#1045, but it is not yet merged.

PR:		293393
Approved by:	maintainer timeout (2 weeks)
MFH:		2026Q1
BSDKaffee pushed a commit to freebsd/freebsd-ports-kde that referenced this pull request Mar 22, 2026
With clang 21 comms/bladerf fails to build, with errors similar to:

    /wrkdirs/usr/ports/comms/bladerf/work/bladeRF-2025.10/host/utilities/bladeRF-cli/src/cmd/flash_image.c:71:35: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
       71 |                 if (val[i] >= 'a' || val[i] <= 'f') {
          |                     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

This is a logic error: the logical operator should be `&&` here. It has
been proposed as an upstream pull request:
Nuand/bladeRF#1045, but it is not yet merged.

PR:		293393
Approved by:	maintainer timeout (2 weeks)
MFH:		2026Q1
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