Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Werror=format build error on EFR32, K32W, QPG6100 #7619

Merged
merged 2 commits into from
Jun 14, 2021

Conversation

jmartinez-silabs
Copy link
Member

@jmartinez-silabs jmartinez-silabs commented Jun 14, 2021

Problem

Building EFR32, K32W and QPG6100 fails with -Werror=format= error on master
Not sure how the change that caused those error passed the CI the first time but it now catches them.

Here is the errors on EFR32

../../../examples/lock-app/efr32/third_party/connectedhomeip/src/app/clusters/network-commissioning/network-commissioning.cpp:148:24: error: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Werror=format=]
  148 |     ChipLogDetail(Zcl, "AddThreadNetwork: %d", err);
      |                        ^~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                |
      |                                                long unsigned int

../../../examples/lock-app/efr32/third_party/connectedhomeip/src/app/clusters/network-commissioning/network-commissioning.cpp:206:24: error: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Werror=format=]
  206 |     ChipLogDetail(Zcl, "AddWiFiNetwork: %d", err);
      |                        ^~~~~~~~~~~~~~~~~~~~  ~~~
      |                                              |
      |                                              long unsigned int

Change overview

Replace the print format %d to % PRIu32 and %x to PRIx32 in the errors caught as it is portable to all platforms.

Testing

Running ./gn_build.sh currently fails for me on MAC with some errors in tv-app.
So I did manual builds for
EFR32
./scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app BRD4164A and ran on EFR32MG12 device the newly build firmware
Build K32W with
./scripts/examples/k32w_example.sh
Build QPG6100
scripts/examples/gn_build_example.sh examples/lock-app/qpg6100 out/qpg6100_lock_app

@jmartinez-silabs jmartinez-silabs changed the title Fix print format Fix Werror=format build error on EFR32, K32W, QPG6100 Jun 14, 2021
@mspang mspang added the hotfix urgent fix needed, can bypass review label Jun 14, 2021
Copy link
Contributor

@bzbarsky-apple bzbarsky-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK to unbreak the tree, but those enums should not be 32-bit to start with, so this is going to break again when they stop doing that.... :(

@andy31415 andy31415 merged commit 45c53ea into project-chip:master Jun 14, 2021
@andy31415
Copy link
Contributor

Admin-merged to bypass CI due to unbounded queue increase and hotfix label.

mkardous-silabs pushed a commit to mkardous-silabs/connectedhomeip that referenced this pull request Jun 14, 2021
)

* Fix printing format from %d to % PRIu32

* Fix build errors in K32w and QPG6100 examples
@jmartinez-silabs jmartinez-silabs deleted the fix_print_format branch June 15, 2021 15:48
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
)

* Fix printing format from %d to % PRIu32

* Fix build errors in K32w and QPG6100 examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app examples hotfix urgent fix needed, can bypass review review - pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants