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

hurd: Avoid warnings #1268

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Commits on Feb 5, 2024

  1. hurd: Avoid warnings

    The warning for line 37 was:
    (With clang version 11.0.1)
    ------------------------------------------------------------------------
    ./pcap-hurd.c:196:35: warning: expression does not compute the number of
    elements in this array; element type is 'struct bpf_insn', not 'short'
    [-Wsizeof-array-div]
                              (filter_array_t_filter, FILTER_COUNT);
                                                      ^~~~~~~~~~~~
    
    ./pcap-hurd.c:37:38: note: expanded from macro 'FILTER_COUNT'
    #define FILTER_COUNT (sizeof(filter) / sizeof(short))
                                 ~~~~~~  ^
    ./pcap-hurd.c:32:24: note: array 'filter' declared here
    static struct bpf_insn filter[] = {
                           ^
    ./pcap-hurd.c:196:35: note: place parentheses around the 'sizeof(short)'
    expression to silence this warning
                                   (filter_array_t)filter, FILTER_COUNT);
                                                           ^
    ./pcap-hurd.c:37:38: note: expanded from macro 'FILTER_COUNT'
    #define FILTER_COUNT (sizeof(filter) / sizeof(short))
                                         ^
    ------------------------------------------------------------------------
    
    But device_set_filter really does want the size in units of shorts.
    sthibaul authored and fxlb committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    1d954c3 View commit details
    Browse the repository at this point in the history