compiler_gcc: prevent redefining attributes 77/104277/1
authorJeroen Hofstee <jeroen@myspectrum.nl>
Thu, 18 Sep 2014 18:10:27 +0000 (20:10 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 13 Dec 2016 02:16:33 +0000 (11:16 +0900)
commit26314cd880fc20de034c9e78667e984da6cae524
tree626268c7f4e9eb139f58aa026e1abacbc7baea2a
parent4d833cb626a993ad4e050682cf46d8cf39a9a749
compiler_gcc: prevent redefining attributes

The libc headers on FreeBSD and likely related projects as well contain an
header file, cdefs.h which provides similiar functionality as linux/compiler.h.
It provides compiler independent defines like __weak __packed, to allow
compiling with multiple compilers which might have a different syntax for such
extension.

Since that header file is included in multiple standard headers, like stddef.h
and stdarg.h, multiple definitions of those defines will be present if both are
included. When compiling u-boot the compiler will warn about it hundreds of
times since e.g. common.h will include both files indirectly.

commit 7ea50d52849fe8ffa5b5b74c979b60b1045d6fc9 "compiler_gcc: do not redefine
__gnu_attributes" prevented such redefinitions, but this was undone by commit
fb8ffd7cfc68b3dc44e182356a207d784cb30b34 "compiler*.h: sync
include/linux/compiler*.h with Linux 3.16".

Add the checks back where necessary to prevent such warnings.

As the original patch this checkpatch warning is ignored:
"WARNING: Adding new packed members is to be done with care"

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
[backport from u-boot mainline for gcc6]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I510e45c099dc0111a94c10035366675d94abdf3e
include/linux/compiler-gcc.h