Skip to content

Commit

Permalink
alpha: fix compile failures with gcc-4.3 (bug #10438)
Browse files Browse the repository at this point in the history
Vast majority of these build failures are gcc-4.3 warnings
about static functions and objects being referenced from
non-static (read: "extern inline") functions, in conjunction
with our -Werror.

We cannot just convert "extern inline" to "static inline",
as people keep suggesting all the time, because "extern inline"
logic is crucial for generic kernel build.
So
- just make sure that all callees of critical "extern inline"
  functions are also "extern inline";
- use "static inline", wherever it's possible.

traps.c: work around gcc-4.3 being too smart about array
bounds-checking.

TODO: add "gnu_inline" attribute to all our "extern inline"
functions to ensure desired behaviour with future compilers.

Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Ivan Kokshaysky authored and Linus Torvalds committed Jun 20, 2008
1 parent ede4269 commit d559d4a
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 23 deletions.
2 changes: 2 additions & 0 deletions arch/alpha/kernel/core_t2.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
# define DBG(args)
#endif

DEFINE_SPINLOCK(t2_hae_lock);

static volatile unsigned int t2_mcheck_any_expected;
static volatile unsigned int t2_mcheck_last_taken;

Expand Down
3 changes: 2 additions & 1 deletion arch/alpha/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ struct unaligned_stat {


/* Macro for exception fixup code to access integer registers. */
#define una_reg(r) (regs->regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])
#define una_reg(r) (_regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])


asmlinkage void
Expand All @@ -456,6 +456,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
{
long error, tmp1, tmp2, tmp3, tmp4;
unsigned long pc = regs->pc - 4;
unsigned long *_regs = regs->regs;
const struct exception_table_entry *fixup;

unaligned[0].count++;
Expand Down
2 changes: 1 addition & 1 deletion include/asm-alpha/core_mcpcia.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ struct el_MCPCIA_uncorrected_frame_mcheck {
}
#endif

static inline int __mcpcia_is_mmio(unsigned long addr)
extern inline int __mcpcia_is_mmio(unsigned long addr)
{
return (addr & 0x80000000UL) == 0;
}
Expand Down
14 changes: 7 additions & 7 deletions include/asm-alpha/core_t2.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@ struct el_t2_frame_corrected {
#define vip volatile int *
#define vuip volatile unsigned int *

static inline u8 t2_inb(unsigned long addr)
extern inline u8 t2_inb(unsigned long addr)
{
long result = *(vip) ((addr << 5) + T2_IO + 0x00);
return __kernel_extbl(result, addr & 3);
}

static inline void t2_outb(u8 b, unsigned long addr)
extern inline void t2_outb(u8 b, unsigned long addr)
{
unsigned long w;

Expand All @@ -371,13 +371,13 @@ static inline void t2_outb(u8 b, unsigned long addr)
mb();
}

static inline u16 t2_inw(unsigned long addr)
extern inline u16 t2_inw(unsigned long addr)
{
long result = *(vip) ((addr << 5) + T2_IO + 0x08);
return __kernel_extwl(result, addr & 3);
}

static inline void t2_outw(u16 b, unsigned long addr)
extern inline void t2_outw(u16 b, unsigned long addr)
{
unsigned long w;

Expand All @@ -386,12 +386,12 @@ static inline void t2_outw(u16 b, unsigned long addr)
mb();
}

static inline u32 t2_inl(unsigned long addr)
extern inline u32 t2_inl(unsigned long addr)
{
return *(vuip) ((addr << 5) + T2_IO + 0x18);
}

static inline void t2_outl(u32 b, unsigned long addr)
extern inline void t2_outl(u32 b, unsigned long addr)
{
*(vuip) ((addr << 5) + T2_IO + 0x18) = b;
mb();
Expand Down Expand Up @@ -435,7 +435,7 @@ static inline void t2_outl(u32 b, unsigned long addr)
set_hae(msb); \
}

static DEFINE_SPINLOCK(t2_hae_lock);
extern spinlock_t t2_hae_lock;

/*
* NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since
Expand Down
6 changes: 3 additions & 3 deletions include/asm-alpha/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* register not being up-to-date with respect to the hardware
* value.
*/
static inline void __set_hae(unsigned long new_hae)
extern inline void __set_hae(unsigned long new_hae)
{
unsigned long flags;
local_irq_save(flags);
Expand All @@ -49,7 +49,7 @@ static inline void __set_hae(unsigned long new_hae)
local_irq_restore(flags);
}

static inline void set_hae(unsigned long new_hae)
extern inline void set_hae(unsigned long new_hae)
{
if (new_hae != alpha_mv.hae_cache)
__set_hae(new_hae);
Expand Down Expand Up @@ -176,7 +176,7 @@ REMAP2(u64, writeq, volatile)
#undef REMAP1
#undef REMAP2

static inline void __iomem *generic_ioportmap(unsigned long a)
extern inline void __iomem *generic_ioportmap(unsigned long a)
{
return alpha_mv.mv_ioportmap(a);
}
Expand Down
6 changes: 3 additions & 3 deletions include/asm-alpha/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#endif


extern inline unsigned long
static inline unsigned long
__reload_thread(struct pcb_struct *pcb)
{
register unsigned long a0 __asm__("$16");
Expand Down Expand Up @@ -114,7 +114,7 @@ extern unsigned long last_asn;
#define __MMU_EXTERN_INLINE
#endif

static inline unsigned long
extern inline unsigned long
__get_new_mm_context(struct mm_struct *mm, long cpu)
{
unsigned long asn = cpu_last_asn(cpu);
Expand Down Expand Up @@ -226,7 +226,7 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
# endif
#endif

extern inline int
static inline int
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
int i;
Expand Down
10 changes: 5 additions & 5 deletions include/asm-alpha/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ enum amask_enum {
__amask; })

#define __CALL_PAL_R0(NAME, TYPE) \
static inline TYPE NAME(void) \
extern inline TYPE NAME(void) \
{ \
register TYPE __r0 __asm__("$0"); \
__asm__ __volatile__( \
Expand All @@ -196,7 +196,7 @@ static inline TYPE NAME(void) \
}

#define __CALL_PAL_W1(NAME, TYPE0) \
static inline void NAME(TYPE0 arg0) \
extern inline void NAME(TYPE0 arg0) \
{ \
register TYPE0 __r16 __asm__("$16") = arg0; \
__asm__ __volatile__( \
Expand All @@ -207,7 +207,7 @@ static inline void NAME(TYPE0 arg0) \
}

#define __CALL_PAL_W2(NAME, TYPE0, TYPE1) \
static inline void NAME(TYPE0 arg0, TYPE1 arg1) \
extern inline void NAME(TYPE0 arg0, TYPE1 arg1) \
{ \
register TYPE0 __r16 __asm__("$16") = arg0; \
register TYPE1 __r17 __asm__("$17") = arg1; \
Expand All @@ -219,7 +219,7 @@ static inline void NAME(TYPE0 arg0, TYPE1 arg1) \
}

#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0) \
static inline RTYPE NAME(TYPE0 arg0) \
extern inline RTYPE NAME(TYPE0 arg0) \
{ \
register RTYPE __r0 __asm__("$0"); \
register TYPE0 __r16 __asm__("$16") = arg0; \
Expand All @@ -232,7 +232,7 @@ static inline RTYPE NAME(TYPE0 arg0) \
}

#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1) \
static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \
extern inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \
{ \
register RTYPE __r0 __asm__("$0"); \
register TYPE0 __r16 __asm__("$16") = arg0; \
Expand Down
6 changes: 3 additions & 3 deletions include/asm-alpha/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
#define VT_BUF_HAVE_MEMSETW
#define VT_BUF_HAVE_MEMCPYW

extern inline void scr_writew(u16 val, volatile u16 *addr)
static inline void scr_writew(u16 val, volatile u16 *addr)
{
if (__is_ioaddr(addr))
__raw_writew(val, (volatile u16 __iomem *) addr);
else
*addr = val;
}

extern inline u16 scr_readw(volatile const u16 *addr)
static inline u16 scr_readw(volatile const u16 *addr)
{
if (__is_ioaddr(addr))
return __raw_readw((volatile const u16 __iomem *) addr);
else
return *addr;
}

extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
{
if (__is_ioaddr(s))
memsetw_io((u16 __iomem *) s, c, count);
Expand Down

0 comments on commit d559d4a

Please sign in to comment.