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

Wrong formatting / argument type in log traces generate warnings #150

Closed
21 tasks
guillaumeVolery opened this issue Oct 4, 2023 · 6 comments
Closed
21 tasks

Comments

@guillaumeVolery
Copy link

guillaumeVolery commented Oct 4, 2023

Problem

By building the library with arm-none-eabi-gcc compiler and setting the flag -Werror, the library is producing the following warnings (errors) due to the use of wrong format specifier in the log traces... We have the goal to deliver a warning-free software for our next firmware release.

PS: Thank for your job and for this library, you are awsome 👍

The correction is very simple, use %lu instead of %u, use %ld instead of %d.

Awaited result

New release of the library implementing the correction above and no more warning generated.

List of reported errors:

  • cellular_common.c:602:20 error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'}
  • cellular_common.c:655:25: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_common_api.c:110:25: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_common_api.c:126:25: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_common.c:919:25: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_3gpp_api.c:492:21: error: format '%d' expects argument of type 'int', but argument 2 has type 'int32_t' {aka 'long int'} [-Werror=format=]
  • cellular_pktio.c:145:17: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pkthandler.c:823:29: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:177:17: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pkthandler.c:823:29: error: format '%d' expects argument of type 'int', but argument 3 has type 'int32_t' {aka 'long int'} [-Werror=format=]
  • cellular_pktio.c:186:17: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
  • cellular_pkthandler.c:839:25: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:549:17: error: format '%d' expects argument of type 'int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:620:25: error: format '%d' expects argument of type 'int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:673:21: error: format '%d' expects argument of type 'int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:673:21: error: format '%d' expects argument of type 'int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:673:21: error: format '%d' expects argument of type 'int', but argument 6 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:888:25: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:888:25: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:1029:21: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  • cellular_pktio.c:1430:17: error: format '%d' expects argument of type 'int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
@guillaumeVolery
Copy link
Author

I have a correction ready to be pushed on freshly created branch called "150". Unfortunately, I don't have to right to push to the repo... Would it be a possibility to get the rights ?

@moninom1
Copy link
Member

moninom1 commented Oct 4, 2023

Hi @guillaumeVolery ,

Thank you so much for reporting the issue. That would be great if you want to contribute.

Unfortunately, I don't have to right to push to the repo... Would it be a possibility to get the rights ?

If the changes are in your branch, you should be able to create a PR to the main branch. Can you please let me know what issue you are facing.

@guillaumeVolery
Copy link
Author

guillaumeVolery commented Oct 5, 2023

Hi @moninom1

Thank you for your reply.

This is actually my problem:

git push --set-upstream origin Issue150
remote: Permission to FreeRTOS/FreeRTOS-Cellular-Interface.git denied to guillaumeVolery.
fatal: unable to access 'https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface.git/': The requested URL returned error: 403

I cannot push my new branch on the remote.

@moninom1
Copy link
Member

moninom1 commented Oct 5, 2023

Hi @guillaumeVolery

You need to create a fork of the repo and then push the changes to your branch in your forked repo. After that you will be able to create a PR to main branch. Please check the following steps :

1: Fork the FreeRTOS-Cellular-Interface repo
2: Clone the forked FreeRTOS-Cellular-Interface repo.
3: Add changes locally and commit it on branch Issue150.
4: Push the changes to your own forked GitHub repo branch Issue150.
5: Create a pull request from forked FreeRTOS-Cellular-Interface repo branch Issue150 to FreeRTOS main.

Let me know if this works.

@guillaumeVolery
Copy link
Author

guillaumeVolery commented Oct 5, 2023

Hi @moninom1

Thank you for your insights. I have completed the process and you will find the pull request here.

👍

@chinglee-iot
Copy link
Member

PR #154 is merged. We will close this issue. Feel free to reopen this issue if any further problem.

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

No branches or pull requests

3 participants