mirror of https://lore.kernel.org/lkml/
 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
  2011-12-18 23:50 ` [tip:x86/cleanups] x86: Use "do { } while(0)" " tip-bot for Jesper Juhl
  0 siblings, 2 replies; 4+ 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 ‘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>
---
 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] 4+ 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
  2011-12-18 23:50 ` [tip:x86/cleanups] x86: Use "do { } while(0)" " tip-bot for Jesper Juhl
  1 sibling, 1 reply; 4+ 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.

^ permalink raw reply	[flat|nested] 4+ 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; 4+ 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] 4+ messages in thread

* [tip:x86/cleanups] x86: 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 23:50 ` tip-bot for Jesper Juhl
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Jesper Juhl @ 2011-12-18 23:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, eric.dumazet, mel, hannes, hughd, riel,
	jj, aarcange, tglx, kamezawa.hiroyu, walken, mingo

Commit-ID:  2ac13462b6d242684996e88a07fbed6dec6af622
Gitweb:     http://git.kernel.org/tip/2ac13462b6d242684996e88a07fbed6dec6af622
Author:     Jesper Juhl <jj@chaosbits.net>
AuthorDate: Sun, 18 Dec 2011 01:32:09 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 18 Dec 2011 09:14:18 +0100

x86: Use "do { } while(0)" for empty flush_tlb_fix_spurious_fault() macro

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>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: linux-mm@kvack.org
Cc: Michel Lespinasse <walken@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Link: http://lkml.kernel.org/r/alpine.LNX.2.00.1112180128070.21784@swampdragon.chaosbits.net
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 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..49afb3f 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))
 

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

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

Thread overview: 4+ 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
2011-12-18 23:50 ` [tip:x86/cleanups] x86: Use "do { } while(0)" " tip-bot for Jesper Juhl

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

Powered by JetHome