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

Enable -Wextra when compiling bpf programs #10596

Merged
merged 3 commits into from Mar 17, 2020

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Mar 16, 2020

Enable -Wextra by default and fix all warnings/errors emitted by it. This should help to catch potentially unused variables and parameters (various -Wunused* warnings) in the future, among others.


This change is Reviewable

Fixes the following warning/error when compiling with -Wextra enabled:

lib/eps.h:65:43: error: missing field 'data' initializer [-Werror,-Wmissing-field-initializers]
                .lpm_key = { IPCACHE_PREFIX_LEN(prefix) },
                                                        ^
lib/eps.h:79:43: error: missing field 'data' initializer [-Werror,-Wmissing-field-initializers]
                .lpm_key = { IPCACHE_PREFIX_LEN(prefix) },

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Fix the following warnings by casting ifindex:

include/bpf/ctx/xdp.h:203:14: error: comparison of integers of different signs: 'int' and '__u32' (aka 'unsigned int') [-Werror,-Wsign-compare]
        if (ifindex != ctx->ingress_ifindex)
            ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
@tklauser tklauser added pending-review sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/misc This PR makes changes that have no direct user impact. labels Mar 16, 2020
@tklauser tklauser requested a review from a team March 16, 2020 22:54
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.8.0 Mar 16, 2020
@tklauser
Copy link
Member Author

test-me-please

@coveralls
Copy link

coveralls commented Mar 16, 2020

Coverage Status

Coverage increased (+0.08%) to 45.648% when pulling 103f961 on pr/tklauser/bpf-extra-warnings into beb401b on master.

@tklauser tklauser force-pushed the pr/tklauser/bpf-extra-warnings branch from 02e0b0b to e5cd245 Compare March 16, 2020 23:29
@tklauser
Copy link
Member Author

test-me-please

This allows to enable extra warnings/errors with -Wextra when compiling
bpf programs.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
@tklauser tklauser force-pushed the pr/tklauser/bpf-extra-warnings branch from e5cd245 to 103f961 Compare March 16, 2020 23:44
@tklauser
Copy link
Member Author

test-me-please

@joestringer joestringer merged commit 13b4ff4 into master Mar 17, 2020
1.8.0 automation moved this from In progress to Merged Mar 17, 2020
@joestringer joestringer deleted the pr/tklauser/bpf-extra-warnings branch March 17, 2020 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
No open projects
1.8.0
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

4 participants