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

Commits on Mar 16, 2020

  1. bpf: explicitly zero-initialize data field in struct bpf_lpm_trie_key

    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>
    tklauser committed Mar 16, 2020
    Copy the full SHA
    ac236ca View commit details
    Browse the repository at this point in the history
  2. bpf: fix -Wsign-compare warning

    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 committed Mar 16, 2020
    Copy the full SHA
    59e50e8 View commit details
    Browse the repository at this point in the history
  3. bpf: mark all potentially unused parameters with __maybe_unused

    This allows to enable extra warnings/errors with -Wextra when compiling
    bpf programs.
    
    Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
    tklauser committed Mar 16, 2020
    Copy the full SHA
    103f961 View commit details
    Browse the repository at this point in the history