Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: Adopt __packed from kernel sources

To have a more compact way to ask the compiler to not insert alignment
paddings in a struct, making tools/ look more like kernel source code.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-byp46nr7hsxvvyc9oupfb40q@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+5 -2
+2
tools/include/linux/compiler-gcc.h
··· 22 22 23 23 #define noinline __attribute__((noinline)) 24 24 25 + #define __packed __attribute__((packed)) 26 + 25 27 #define __noreturn __attribute__((noreturn)) 26 28 27 29 #define __printf(a, b) __attribute__((format(printf, a, b)))
+3 -2
tools/perf/util/genelf_debug.c
··· 11 11 * @remark Copyright 2007 OProfile authors 12 12 * @author Philippe Elie 13 13 */ 14 + #include <linux/compiler.h> 14 15 #include <sys/types.h> 15 16 #include <stdio.h> 16 17 #include <getopt.h> ··· 126 125 * and filesize, last entry is followed by en empty string. 127 126 */ 128 127 /* follow the first program statement */ 129 - } __attribute__((packed)); 128 + } __packed; 130 129 131 130 /* DWARF 2 spec talk only about one possible compilation unit header while 132 131 * binutils can handle two flavours of dwarf 2, 32 and 64 bits, this is not ··· 139 138 uhalf version; 140 139 uword debug_abbrev_offset; 141 140 ubyte pointer_size; 142 - } __attribute__((packed)); 141 + } __packed; 143 142 144 143 #define DW_LNS_num_opcode (DW_LNS_set_isa + 1) 145 144