iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.36k stars 3.86k forks source link

libbpf-tools: enforce missing-field-initializers warning and error on… #4975

Closed chantra closed 5 months ago

chantra commented 5 months ago

… warnings

In an internal build where missing-field-initializers would be enforce, libbpf-tools would fail to build with an error similar to:

tcptop.c:75:9: error: missing initializer for field 'group' of 'const struct argp_option' [-Werror=missing-field-initializers]
   75 |         { "nosummary", 'S', NULL, 0, "Skip system summary line"},
      |         ^
In file included from tcptop.c:10:
/usr/include/argp.h:73:7: note: 'group' declared here
   73 |   int group;
      |       ^~~~~

This change tacks the default group value of 0 to all struct argp_option used in libbpf-tools.

At the same time, I am taking the opportunity to promote warnings to error in order to prevent regressions from making it in.