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

Handle implicity conversions #496

Merged
merged 12 commits into from
Sep 4, 2024
Merged

Conversation

daniloegea
Copy link
Collaborator

@daniloegea daniloegea commented Aug 6, 2024

Description

Fix some type conversions and make some implicit conversions explicit.
It's a requirement to add the TIOBE analysis to our CI as it will build the project with -Wconversion.

I'd recommend to use interactive rebase to step through each commit individually starting from the first one and call meson compile with -j1 so you can see what compiler errors each commit fixes. I didn't want to paste the error to the commit messages...

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

@daniloegea daniloegea marked this pull request as ready for review August 6, 2024 15:46
@daniloegea daniloegea requested a review from slyon August 6, 2024 15:46
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

Thank you very much for working on this, this is tedious work!

I left a bunch of remarks inline that need clarification. Furthermore, I think we should try compiling this branch on some additional architectures (i386, armhf, s390x, maybe more from Debian buildd?) to make sure it does not trigger any side-effects of types having different size on non-64bit architectures.

src/nm.c Show resolved Hide resolved
src/openvswitch.c Outdated Show resolved Hide resolved
src/parse-nm.c Outdated Show resolved Hide resolved
src/parse.c Outdated Show resolved Hide resolved
src/parse.c Outdated Show resolved Hide resolved
src/parse.c Show resolved Hide resolved
tests/ctests/test_netplan_parser.c Show resolved Hide resolved
tests/ctests/test_netplan_parser.c Outdated Show resolved Hide resolved
src/yaml-helpers.h Outdated Show resolved Hide resolved
src/util.c Show resolved Hide resolved
This flag will make the compiler to issue a warning for all the
dangerous implicit type conversions.
wifi_get_freq24 and wifi_get_freq5 are used with ap->channel values,
which are guint. Change these functions to take guint as argument.
Here we probably should make _netplan_state_get_vf_count_for_def return
a unsigned int, but as it is a public interface (even though only used
inside netplan) I'll add some safety checks and cast the return value to
int.
@daniloegea
Copy link
Collaborator Author

Thanks Lukas. I think I addressed your comments.

In particular, there was a problem with 32-bit. It happened on armhf. I added the compiler error to one of my replies.

I created a package from this branch and tested it with autopkgtest on all the archs supported by Ubuntu and it looks good.

@daniloegea daniloegea requested a review from slyon August 28, 2024 16:28
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

Thanks a lot for addressing my remarks, the deep investigations and running those extra cross-architecture tests!

LGTM! I left one tiny inline comment, but I think it's fine to be merged as-is.

@daniloegea daniloegea merged commit 1156dc7 into canonical:main Sep 4, 2024
16 checks passed
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.

2 participants