Skip to content

Commit 6cb9430

Browse files
d-e-s-oborkmann
authored andcommitted
libbpf: Ignore warnings about "inefficient alignment"
Some consumers of libbpf compile the code base with different warnings enabled. In a report for perf, for example, -Wpacked was set which caused warnings about "inefficient alignment" to be emitted on a subset of supported architectures. With this change we silence specifically those warnings, as we intentionally worked with packed structs. This is a similar resolution as in b2f10cd ("perf cpumap: Fix alignment for masks in event encoding"). Fixes: 1eebcb6 ("libbpf: Implement basic zip archive parsing support") Reported-by: Linux Kernel Functional Testing <[email protected]> Signed-off-by: Daniel Müller <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Cc: Ian Rogers <[email protected]> Link: https://lore.kernel.org/bpf/CA+G9fYtBnwxAWXi2+GyNByApxnf_DtP1-6+_zOKAdJKnJBexjg@mail.gmail.com/ Link: https://lore.kernel.org/bpf/[email protected]
1 parent 226efec commit 6cb9430

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/lib/bpf/zip.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#include "libbpf_internal.h"
1717
#include "zip.h"
1818

19+
#pragma GCC diagnostic push
20+
#pragma GCC diagnostic ignored "-Wpacked"
21+
#pragma GCC diagnostic ignored "-Wattributes"
22+
1923
/* Specification of ZIP file format can be found here:
2024
* https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
2125
* For a high level overview of the structure of a ZIP file see
@@ -119,6 +123,8 @@ struct local_file_header {
119123
__u16 extra_field_length;
120124
} __attribute__((packed));
121125

126+
#pragma GCC diagnostic pop
127+
122128
struct zip_archive {
123129
void *data;
124130
__u32 size;

0 commit comments

Comments
 (0)