* [U-Boot] [PATCH 1/1] compiler_gcc: do not redefine __gnu_attributes
@ 2013-08-10 15:16 Jeroen Hofstee
2013-09-06 21:24 ` [U-Boot] [U-Boot, " Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Jeroen Hofstee @ 2013-08-10 15:16 UTC (permalink / raw)
To: u-boot
gcc allows extensions to be non compiler specific by defining
__* macros for the attributes supported by gcc. Having a
different definition causes many warnings during the build
(cdefs.h on FreeBSD uses __attribute((__pure__)) where u-boot
uses __attribute__((pure)) for example). Do not redefine
these macros to suppress these warnings.
This patch ignores the checkpatch warning:
WARNING: __packed is preferred over __attribute__((packed))
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
include/linux/compiler-gcc.h | 12 +++++++++---
include/linux/compiler-gcc4.h | 4 +++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 73dcf80..9896e54 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -50,7 +50,9 @@
#endif
#define __deprecated __attribute__((deprecated))
-#define __packed __attribute__((packed))
+#ifndef __packed
+# define __packed __attribute__((packed))
+#endif
#define __weak __attribute__((weak))
/*
@@ -73,8 +75,12 @@
* would be.
* [...]
*/
-#define __pure __attribute__((pure))
-#define __aligned(x) __attribute__((aligned(x)))
+#ifndef __pure
+# define __pure __attribute__((pure))
+#endif
+#ifndef __aligned
+# define __aligned(x) __attribute__((aligned(x)))
+#endif
#define __printf(a,b) __attribute__((format(printf,a,b)))
#define noinline __attribute__((noinline))
#define __attribute_const__ __attribute__((__const__))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 94dea3f..27d11ca 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -12,7 +12,9 @@
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
-#define __always_inline inline __attribute__((always_inline))
+#ifndef __always_inline
+# define __always_inline inline __attribute__((always_inline))
+#endif
/*
* A trick to suppress uninitialized variable warning without generating any
--
1.8.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [U-Boot, 1/1] compiler_gcc: do not redefine __gnu_attributes
2013-08-10 15:16 [U-Boot] [PATCH 1/1] compiler_gcc: do not redefine __gnu_attributes Jeroen Hofstee
@ 2013-09-06 21:24 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2013-09-06 21:24 UTC (permalink / raw)
To: u-boot
On Sat, Aug 10, 2013 at 05:16:50PM +0200, Jeroen Hofstee wrote:
> gcc allows extensions to be non compiler specific by defining
> __* macros for the attributes supported by gcc. Having a
> different definition causes many warnings during the build
> (cdefs.h on FreeBSD uses __attribute((__pure__)) where u-boot
> uses __attribute__((pure)) for example). Do not redefine
> these macros to suppress these warnings.
>
> This patch ignores the checkpatch warning:
> WARNING: __packed is preferred over __attribute__((packed))
>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130906/bb029396/attachment.pgp>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-06 21:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-10 15:16 [U-Boot] [PATCH 1/1] compiler_gcc: do not redefine __gnu_attributes Jeroen Hofstee
2013-09-06 21:24 ` [U-Boot] [U-Boot, " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.