Skip to content

Fix compilation warnings from GCC in netsocket/network tests #11473

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

Merged
merged 1 commit into from
Sep 19, 2019

Conversation

michalpasztamobica
Copy link
Contributor

Description

Four kinds of warnings were occurring:

  • singed vs unsigned comparison
  • multiline comments (a backslash \ at the end of a comment line renders this)
  • unused variables
  • usage of deprecated wait function

Warnings only occurred in the test code.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@AnttiKauppila
@VeijoPesonen
@SeppoTakalo

@ciarmcom
Copy link
Member

@michalpasztamobica, thank you for your changes.
@AnttiKauppila @VeijoPesonen @SeppoTakalo @ARMmbed/mbed-os-test @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested a review from a team September 12, 2019 15:00
!defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \
!defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) &&
// !defined(MBED_CONF_APP_AP_MAC_UNSECURE) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't these be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@0xc0170 , I don't think so. This is the closing #endif for the #define from lines 41-45. I think it makes sense to leave it as close as possible to the opening one.
What we can do is decrease the number of lines, by putting multiple checks into one line, but this will decrease readability...

Copy link
Contributor Author

@michalpasztamobica michalpasztamobica Sep 16, 2019

Choose a reason for hiding this comment

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

The warning that I am addressing here is that the "comment was multiline". The compiler interprets the "" at the end of the line as a continuation of the comment, rather than a continuation of a macro. After we remove the ""s we need to add the new comment indicators at the beginning of each line.

An example of what causes a warning:

// comment line 1 \
comment line 2 \
comment line 3

Instead we need to go:

// comment line 1
// comment line 2
// comment line 3

!defined(TARGET_MTB_UBLOX_ODIN_W2) && \
!defined(TARGET_UNO_91H)
#endif // (MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI) &&
// !defined(TARGET_UBLOX_EVK_ODIN_W2) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

also these not removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is acceptable, but quite ugly.. maybe just #endif // INTERFACE==WIFI && TARGET_*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good, idea. I amended the commit to follow this.

Copy link
Contributor

@SeppoTakalo SeppoTakalo left a comment

Choose a reason for hiding this comment

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

Looks better now.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 18, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Sep 18, 2019

Test run: SUCCESS

Summary: 4 of 4 test jobs passed
Build number : 1
Build artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants