Skip to content

coreHTTP: remove redundant lower-bound assert for parsing state#205

Merged
archigup merged 1 commit intoFreeRTOS:mainfrom
TomasGalbickaNXP:fix/iar-always-true-assert
Apr 10, 2026
Merged

coreHTTP: remove redundant lower-bound assert for parsing state#205
archigup merged 1 commit intoFreeRTOS:mainfrom
TomasGalbickaNXP:fix/iar-always-true-assert

Conversation

@TomasGalbickaNXP
Copy link
Copy Markdown
Contributor

@TomasGalbickaNXP TomasGalbickaNXP commented Mar 25, 2026

Description

This PR removes a redundant lower-bound assertion in getFinalResponseStatus():

assert( parsingState >= HTTP_PARSING_NONE &&
        parsingState <= HTTP_PARSING_COMPLETE );

HTTP_PARSING_NONE is 0. Some compilers (observed with IAR EWARM) perform enum range analysis and flag parsingState >= 0 as an always-true / pointless comparison, which breaks builds when warnings are treated as errors.

The upper-bound assert is preserved:

assert( parsingState <= HTTP_PARSING_COMPLETE );

No functional behavior change is intended; this is a build/diagnostic robustness improvement.

Test Steps

Build any project that compiles source/core_http_client.c using IAR EWARM with warnings treated as errors (Werror).
Before this change, IAR reports a “pointless comparison / always true” diagnostic on the lower-bound check (>= HTTP_PARSING_NONE).
After this change, source/core_http_client.c compiles cleanly.

Environment

Toolchain: IAR EWARM (e.g. 9.70.x)
Build mode: warnings-as-errors enabled

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request. (Not applicable; assert-only diagnostic fix.)

Related Issue

N/A (build diagnostic issue observed with IAR when warnings are treated as errors).

Some toolchains (e.g. IAR with warnings-as-errors) treat the enum range as constrained, so parsingState >= HTTP_PARSING_NONE (0) is always true and triggers a diagnostic. Keep the upper-bound assert.

Signed-off-by: Tomas Galbicka <tomas.galbicka@nxp.com>
@archigup archigup force-pushed the fix/iar-always-true-assert branch from 370668f to 2ab2d3c Compare April 10, 2026 22:21
@archigup archigup merged commit 281a624 into FreeRTOS:main Apr 10, 2026
11 checks passed
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