Skip to content

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

Open
TomasGalbickaNXP wants to merge 1 commit intoFreeRTOS:mainfrom
TomasGalbickaNXP:fix/iar-always-true-assert
Open

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

Conversation

@TomasGalbickaNXP
Copy link
Copy Markdown

@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>
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.

1 participant