Re: [PATCH] Put braces around potentially empty 'if' body in handle_pte_fault()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 18 Dec 2011 04:18:28 +0300
Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:

> On Sun, Dec 18, 2011 at 12:34:19AM +0000, Al Viro wrote:
> > On Sun, Dec 18, 2011 at 01:18:55AM +0100, Eric Dumazet wrote:
> > > Thats should be fixed in the reverse way :
> > > 
> > > #define flush_tlb_fix_spurious_fault(vma, address) do { } while (0)
> > 
> > There's a better way to do that -
> > #define f(a) do { } while(0)
> > does not work as a function returning void -
> > 	f(1), g();
> > won't work.  OTOH
> > #define f(a) ((void)0)
> > works just fine.
> 
> Two words: static inline.

Amen.  How often must we teach ourselves this lesson?


It gets a bit messy because of:

#ifndef flush_tlb_fix_spurious_fault
#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
#endif

But that can be handled with

static inline void flush_tlb_fix_spurious_fault(...)
{
	...
}
#define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault

and

#ifndef flush_tlb_fix_spurious_fault
static inline void flush_tlb_fix_spurious_fault(...)
{
}
#define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault
#endif

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]