linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use 'do {} while (0)' for empty flush_tlb_fix_spurious_fault() macro
@ 2011-12-18  0:32 Jesper Juhl
  2011-12-18  0:43 ` Michel Lespinasse
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2011-12-18  0:32 UTC (permalink / raw)
  To: x86
  Cc: Eric Dumazet, linux-mm, linux-kernel, Andrew Morton,
	Michel Lespinasse, Hugh Dickins, Andrea Arcangeli,
	KAMEZAWA Hiroyuki, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Rik van Riel, Mel Gorman, Johannes Weiner

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1079 bytes --]

If one builds the kernel with -Wempty-body one gets this warning:

  mm/memory.c:3432:46: warning: suggest braces around empty body in an !ifc statement [-Wempty-body]

due to the fact that 'flush_tlb_fix_spurious_fault' is a macro that
can sometimes be defined to nothing.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 arch/x86/include/asm/pgtable.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 18601c8..ebe7e76 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -703,7 +703,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm,
 	pte_update(mm, addr, ptep);
 }
 
-#define flush_tlb_fix_spurious_fault(vma, address)
+#define flush_tlb_fix_spurious_fault(vma, address) do {} while (0)
 
 #define mk_pmd(page, pgprot)   pfn_pmd(page_to_pfn(page), (pgprot))
 
-- 
1.7.8


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Use 'do {} while (0)' for empty flush_tlb_fix_spurious_fault() macro
  2011-12-18  0:32 [PATCH] Use 'do {} while (0)' for empty flush_tlb_fix_spurious_fault() macro Jesper Juhl
@ 2011-12-18  0:43 ` Michel Lespinasse
  2011-12-18  1:00   ` Jesper Juhl
  0 siblings, 1 reply; 3+ messages in thread
From: Michel Lespinasse @ 2011-12-18  0:43 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: x86, Eric Dumazet, linux-mm, linux-kernel, Andrew Morton,
	Hugh Dickins, Andrea Arcangeli, KAMEZAWA Hiroyuki,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Rik van Riel,
	Mel Gorman, Johannes Weiner

On Sat, Dec 17, 2011 at 4:32 PM, Jesper Juhl <jj@chaosbits.net> wrote:
> If one builds the kernel with -Wempty-body one gets this warning:
>
>  mm/memory.c:3432:46: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
>
> due to the fact that 'flush_tlb_fix_spurious_fault' is a macro that
> can sometimes be defined to nothing.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Looks good to me. I'd be happy with either that or Al's alternative suggestion.

Reviewed-by: Michel Lespinasse <walken@google.com>

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Use 'do {} while (0)' for empty flush_tlb_fix_spurious_fault() macro
  2011-12-18  0:43 ` Michel Lespinasse
@ 2011-12-18  1:00   ` Jesper Juhl
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2011-12-18  1:00 UTC (permalink / raw)
  To: Michel Lespinasse
  Cc: x86, Eric Dumazet, linux-mm, linux-kernel, Andrew Morton,
	Hugh Dickins, Andrea Arcangeli, KAMEZAWA Hiroyuki,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Rik van Riel,
	Mel Gorman, Johannes Weiner, Al Viro

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1075 bytes --]

On Sat, 17 Dec 2011, Michel Lespinasse wrote:

> On Sat, Dec 17, 2011 at 4:32 PM, Jesper Juhl <jj@chaosbits.net> wrote:
> > If one builds the kernel with -Wempty-body one gets this warning:
> >
> >  mm/memory.c:3432:46: warning: suggest braces around empty body in an ?if? statement [-Wempty-body]
> >
> > due to the fact that 'flush_tlb_fix_spurious_fault' is a macro that
> > can sometimes be defined to nothing.
> >
> > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> 
> Looks good to me. I'd be happy with either that or Al's alternative suggestion.
> 
> Reviewed-by: Michel Lespinasse <walken@google.com>
> 
Thanks for the review.

I did see Al's suggestion and he does have a point. But since it doesn't 
actually matter much in this specific case I'd say "let's just go with 
this one - it matches what's done nearly everywhere else".
But, If someone disagrees strongly I'll cook up a different patch. :-)

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-18  1:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-18  0:32 [PATCH] Use 'do {} while (0)' for empty flush_tlb_fix_spurious_fault() macro Jesper Juhl
2011-12-18  0:43 ` Michel Lespinasse
2011-12-18  1:00   ` Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox