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

Add GCC conversion warnings #437

Merged
merged 1 commit into from
Nov 22, 2023
Merged

Add GCC conversion warnings #437

merged 1 commit into from
Nov 22, 2023

Conversation

PlagueCZ
Copy link
Contributor

@PlagueCZ PlagueCZ commented Nov 21, 2023

I remember conversion warnings being a problem before all the refactoring, so I tried again. Sign-conversion is a separate problem, but conversion itself, like narrowing uint32_t to uint16_t was doable and actually found a few bugs.

The warning will force us to use more static_asserts before actually doing a hard narrowing cast or re-typing some variables.

There are only a few places (mostly dhcp) that the code looks slightly uglier than before and it's because of the DHCP options parsing and changing them in-place for optimization, so it's to be expected.

I also changed df->nxt_hop from uint8_t to uint16_t. Now that will need one more byte (I left a comment about unused space), but will prevent any checks/masking to be needed when assigning it, which I think is a plus.
Maybe doing the same thing to struct flow_age_ctx can be done, but I do not know if that is space-critical.

There is however a bad return-type (seems like a typo) in one RTE function, which I had to patch.

Checkpatch fails due to also checking the patch to DPDK.

@github-actions github-actions bot added size/XL documentation Improvements or additions to documentation enhancement New feature or request labels Nov 21, 2023
@PlagueCZ PlagueCZ force-pushed the feature/gcc_conversion_warnings branch from 17c13c9 to baec7b9 Compare November 22, 2023 10:33
@PlagueCZ PlagueCZ force-pushed the feature/gcc_conversion_warnings branch from baec7b9 to 83710f9 Compare November 22, 2023 12:00
@PlagueCZ PlagueCZ changed the base branch from main to feature/design_doc November 22, 2023 16:33
@PlagueCZ PlagueCZ changed the base branch from feature/design_doc to main November 22, 2023 16:33
@PlagueCZ PlagueCZ requested a review from guvenc November 22, 2023 16:43
@PlagueCZ PlagueCZ marked this pull request as ready for review November 22, 2023 16:43
Copy link
Collaborator

@guvenc guvenc left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@guvenc guvenc merged commit 83710f9 into main Nov 22, 2023
6 of 7 checks passed
@guvenc guvenc deleted the feature/gcc_conversion_warnings branch November 22, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants