diff options
author | Måns Rullgård <mans@mansr.com> | 2015-11-06 12:44:01 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-11-09 18:19:40 -0500 |
commit | 44d0677a90f82eb2b01dd5150ca8e0115453d7d3 (patch) | |
tree | 8969401f9071502bcae5a86323aacaf79ce1217e /arch/m68k | |
parent | e490ad25eb3dc4f075ed33b4b00b1f97071fcf3d (diff) | |
download | u-boot-imx-44d0677a90f82eb2b01dd5150ca8e0115453d7d3.zip u-boot-imx-44d0677a90f82eb2b01dd5150ca8e0115453d7d3.tar.gz u-boot-imx-44d0677a90f82eb2b01dd5150ca8e0115453d7d3.tar.bz2 |
Replace "extern inline" with "static inline"
A number of headers define functions as "extern inline" which is
causing problems with gcc5. The reason is that starting with
version 5.1, gcc defaults to the standard C99 semantics for the
inline keyword.
Under the traditional GNU inline semantics, an "extern inline"
function would never create an external definition, the same
as inline *without* extern in C99. In C99, and "extern inline"
definition is simply an external definition with an inline hint.
In short, the meanings of inline with and without extern are
swapped between GNU and C99.
The upshot is that all these definitions in header files create
an external definition wherever those headers are included,
resulting in multiple definition errors at link time.
Changing all these functions to "static inline" fixes the problem
since this works as desired in all gcc versions. Although the
semantics are slightly different (a static inline definition may
result in an actual function being emitted), it works as intended
in practice.
This patch also removes extern prototype declarations for the
changed functions where they existed.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/include/asm/bitops.h | 5 | ||||
-rw-r--r-- | arch/m68k/include/asm/byteorder.h | 8 | ||||
-rw-r--r-- | arch/m68k/include/asm/io.h | 40 |
3 files changed, 26 insertions, 27 deletions
diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index 69ea26a..4a3f6b9 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -14,21 +14,20 @@ extern void set_bit(int nr, volatile void *addr); extern void clear_bit(int nr, volatile void *addr); extern void change_bit(int nr, volatile void *addr); -extern int test_and_set_bit(int nr, volatile void *addr); extern int test_and_clear_bit(int nr, volatile void *addr); extern int test_and_change_bit(int nr, volatile void *addr); #ifdef __KERNEL__ -extern inline int test_bit(int nr, __const__ volatile void *addr) +static inline int test_bit(int nr, __const__ volatile void *addr) { __const__ unsigned int *p = (__const__ unsigned int *) addr; return (p[nr >> 5] & (1UL << (nr & 31))) != 0; } -extern inline int test_and_set_bit(int nr, volatile void *vaddr) +static inline int test_and_set_bit(int nr, volatile void *vaddr) { char retval; diff --git a/arch/m68k/include/asm/byteorder.h b/arch/m68k/include/asm/byteorder.h index 908a99b..7244b75 100644 --- a/arch/m68k/include/asm/byteorder.h +++ b/arch/m68k/include/asm/byteorder.h @@ -22,25 +22,25 @@ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ (((__u32)(x)) >> 24) )) -extern __inline__ unsigned ld_le16(const volatile unsigned short *addr) +static __inline__ unsigned ld_le16(const volatile unsigned short *addr) { unsigned result = *addr; return __sw16(result); } -extern __inline__ void st_le16(volatile unsigned short *addr, +static __inline__ void st_le16(volatile unsigned short *addr, const unsigned val) { *addr = __sw16(val); } -extern __inline__ unsigned ld_le32(const volatile unsigned *addr) +static __inline__ unsigned ld_le32(const volatile unsigned *addr) { unsigned result = *addr; return __sw32(result); } -extern __inline__ void st_le32(volatile unsigned *addr, const unsigned val) +static __inline__ void st_le32(volatile unsigned *addr, const unsigned val) { *addr = __sw32(val); } diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index 2d2a519..384308b 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -67,28 +67,28 @@ #define mb() __asm__ __volatile__ ("" : : : "memory") -extern inline void _insb(volatile u8 * port, void *buf, int ns) +static inline void _insb(volatile u8 * port, void *buf, int ns) { u8 *data = (u8 *) buf; while (ns--) *data++ = *port; } -extern inline void _outsb(volatile u8 * port, const void *buf, int ns) +static inline void _outsb(volatile u8 * port, const void *buf, int ns) { u8 *data = (u8 *) buf; while (ns--) *port = *data++; } -extern inline void _insw(volatile u16 * port, void *buf, int ns) +static inline void _insw(volatile u16 * port, void *buf, int ns) { u16 *data = (u16 *) buf; while (ns--) *data++ = __sw16(*port); } -extern inline void _outsw(volatile u16 * port, const void *buf, int ns) +static inline void _outsw(volatile u16 * port, const void *buf, int ns) { u16 *data = (u16 *) buf; while (ns--) { @@ -97,14 +97,14 @@ extern inline void _outsw(volatile u16 * port, const void *buf, int ns) } } -extern inline void _insl(volatile u32 * port, void *buf, int nl) +static inline void _insl(volatile u32 * port, void *buf, int nl) { u32 *data = (u32 *) buf; while (nl--) *data++ = __sw32(*port); } -extern inline void _outsl(volatile u32 * port, const void *buf, int nl) +static inline void _outsl(volatile u32 * port, const void *buf, int nl) { u32 *data = (u32 *) buf; while (nl--) { @@ -113,14 +113,14 @@ extern inline void _outsl(volatile u32 * port, const void *buf, int nl) } } -extern inline void _insw_ns(volatile u16 * port, void *buf, int ns) +static inline void _insw_ns(volatile u16 * port, void *buf, int ns) { u16 *data = (u16 *) buf; while (ns--) *data++ = *port; } -extern inline void _outsw_ns(volatile u16 * port, const void *buf, int ns) +static inline void _outsw_ns(volatile u16 * port, const void *buf, int ns) { u16 *data = (u16 *) buf; while (ns--) { @@ -128,14 +128,14 @@ extern inline void _outsw_ns(volatile u16 * port, const void *buf, int ns) } } -extern inline void _insl_ns(volatile u32 * port, void *buf, int nl) +static inline void _insl_ns(volatile u32 * port, void *buf, int nl) { u32 *data = (u32 *) buf; while (nl--) *data++ = *port; } -extern inline void _outsl_ns(volatile u32 * port, const void *buf, int nl) +static inline void _outsl_ns(volatile u32 * port, const void *buf, int nl) { u32 *data = (u32 *) buf; while (nl--) { @@ -159,52 +159,52 @@ extern inline void _outsl_ns(volatile u32 * port, const void *buf, int nl) /* * 8, 16 and 32 bit, big and little endian I/O operations, with barrier. */ -extern inline int in_8(volatile u8 * addr) +static inline int in_8(volatile u8 * addr) { return (int)*addr; } -extern inline void out_8(volatile u8 * addr, int val) +static inline void out_8(volatile u8 * addr, int val) { *addr = (u8) val; } -extern inline int in_le16(volatile u16 * addr) +static inline int in_le16(volatile u16 * addr) { return __sw16(*addr); } -extern inline int in_be16(volatile u16 * addr) +static inline int in_be16(volatile u16 * addr) { return (*addr & 0xFFFF); } -extern inline void out_le16(volatile u16 * addr, int val) +static inline void out_le16(volatile u16 * addr, int val) { *addr = __sw16(val); } -extern inline void out_be16(volatile u16 * addr, int val) +static inline void out_be16(volatile u16 * addr, int val) { *addr = (u16) val; } -extern inline unsigned in_le32(volatile u32 * addr) +static inline unsigned in_le32(volatile u32 * addr) { return __sw32(*addr); } -extern inline unsigned in_be32(volatile u32 * addr) +static inline unsigned in_be32(volatile u32 * addr) { return (*addr); } -extern inline void out_le32(volatile unsigned *addr, int val) +static inline void out_le32(volatile unsigned *addr, int val) { *addr = __sw32(val); } -extern inline void out_be32(volatile unsigned *addr, int val) +static inline void out_be32(volatile unsigned *addr, int val) { *addr = val; } |