Skip to content

[openthread] Fix compiler format warning#14030

Merged
swoboda1337 merged 1 commit intoesphome:devfrom
schdro:fix-ot-gcc-warning
Feb 17, 2026
Merged

[openthread] Fix compiler format warning#14030
swoboda1337 merged 1 commit intoesphome:devfrom
schdro:fix-ot-gcc-warning

Conversation

@schdro
Copy link
Contributor

@schdro schdro commented Feb 17, 2026

What does this implement/fix?

ESPHome Version: e.g. 2026.2.0b3

openthread module raises gcc format warning (or error if enforced via -Werror) if configured as MTD with DEBUG logging.

--> Try to compile provided yaml below

In file included from src/esphome/core/component.h:9,
                 from src/esphome/core/automation.h:3,
                 from src/esphome/components/mdns/mdns_component.h:5,
                 from src/esphome/components/openthread/openthread.h:5,
                 from src/esphome/components/openthread/openthread_esp.cpp:4:
src/esphome/components/openthread/openthread_esp.cpp: In member function 'void esphome::openthread::OpenThreadComponent::ot_main()':
src/esphome/components/openthread/openthread_esp.cpp:118:19: error: format '%d' expects argument of type 'int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  118 |     ESP_LOGD(TAG, "Link Polling Period: %d", link_polling_period);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~

End user impact: Likely none on wrong arg interpretation, in worst case bad output. Here only signed vs unsigned.

Developer impact: Slightly annoying if to compile tree with strict warnings for enforcing QA.

Format fix is obvious.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Developer breaking change (an API change that could break external components)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • fixes N/A

Pull request in esphome-docs with documentation (if applicable):

  • esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • LN882x
  • nRF52840

Example entry for config.yaml:

esphome:
  name: compileerror
  platformio_options:
    build_flags:
      - -Wall -Werror

esp32:
  variant: esp32c6

network:
  enable_ipv6: true

openthread:
  device_type: MTD
  tlv: ""  # Required, but irrelevant

logger:
  level: DEBUG

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@github-actions
Copy link
Contributor

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://pr#14030
    components: [openthread]
    refresh: 1h

(Added by the PR bot)

@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.08%. Comparing base (4cd3f6c) to head (d07647f).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #14030   +/-   ##
=======================================
  Coverage   74.08%   74.08%           
=======================================
  Files          55       55           
  Lines       11588    11588           
  Branches     1577     1577           
=======================================
  Hits         8585     8585           
  Misses       2600     2600           
  Partials      403      403           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

Memory Impact Analysis

Components: openthread
Platform: esp32-c6-idf

Metric Target Branch This PR Change
RAM 36,308 bytes 36,308 bytes ➡️ +0 bytes (0.00%)
Flash 617,584 bytes 617,584 bytes ➡️ +0 bytes (0.00%)

Note: This analysis measures static RAM and Flash usage only (compile-time allocation).
Dynamic memory (heap) cannot be measured automatically.
⚠️ You must test this PR on a real device to measure free heap and ensure no runtime memory issues.

This analysis runs automatically when components change. Memory usage is measured from a representative test configuration.

@schdro schdro marked this pull request as ready for review February 17, 2026 10:44
@github-actions
Copy link
Contributor

👋 Hi there! This PR modifies 1 file(s) with codeowners.

@mrene - As codeowner(s) of the affected files, your review would be appreciated! 🙏

Note: Automatic review request may have failed, but you're still welcome to review.

@swoboda1337 swoboda1337 merged commit e826d71 into esphome:dev Feb 17, 2026
43 checks passed
@swoboda1337
Copy link
Member

Thanks

@swoboda1337 swoboda1337 added this to the 2026.2.0b4 milestone Feb 17, 2026
@schdro schdro deleted the fix-ot-gcc-warning branch February 17, 2026 15:56
@jesserockz jesserockz mentioned this pull request Feb 17, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants