mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86, mc146818rtc.h: use do{}while(0) for empty lock_cmos()/unlock_cmos()
@ 2011-12-18  0:05 Jesper Juhl
  2011-12-18 23:51 ` [tip:x86/cleanups] x86: Use "do { } while(0)" for empty lock_cmos( )/unlock_cmos() macros tip-bot for Jesper Juhl
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-12-18  0:05 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin

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

gcc noticed (when using -Wempty-body) that our use of lock_cmos() and
unlock_cmos() in arch/x86/include/asm/mach_traps.h is potentially
problematic :

  arch/x86/include/asm/mach_traps.h:32:15: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
  arch/x86/include/asm/mach_traps.h:40:16: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

Let's just use the standard 'do {} while (0)' solution. That shuts up
gcc and also prevents future problems if the macros should end up
being used in a similar situation elsewhere.

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

diff --git a/arch/x86/include/asm/mc146818rtc.h b/arch/x86/include/asm/mc146818rtc.h
index 01fdf56..3bb1b14 100644
--- a/arch/x86/include/asm/mc146818rtc.h
+++ b/arch/x86/include/asm/mc146818rtc.h
@@ -81,8 +81,8 @@ static inline unsigned char current_lock_cmos_reg(void)
 #else
 #define lock_cmos_prefix(reg) do {} while (0)
 #define lock_cmos_suffix(reg) do {} while (0)
-#define lock_cmos(reg)
-#define unlock_cmos()
+#define lock_cmos(reg) do {} while (0)
+#define unlock_cmos() do {} while (0)
 #define do_i_have_lock_cmos() 0
 #define current_lock_cmos_reg() 0
 #endif
-- 
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] 2+ messages in thread

* [tip:x86/cleanups] x86: Use "do { } while(0)" for empty lock_cmos( )/unlock_cmos() macros
  2011-12-18  0:05 [PATCH] x86, mc146818rtc.h: use do{}while(0) for empty lock_cmos()/unlock_cmos() Jesper Juhl
@ 2011-12-18 23:51 ` tip-bot for Jesper Juhl
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Jesper Juhl @ 2011-12-18 23:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, jj, tglx, mingo

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

x86: Use "do { } while(0)" for empty lock_cmos()/unlock_cmos() macros

gcc noticed (when using -Wempty-body) that our use of
lock_cmos() and unlock_cmos() in
arch/x86/include/asm/mach_traps.h is potentially problematic :

  arch/x86/include/asm/mach_traps.h:32:15: warning: suggest braces around empty body in an ¡else¢ statement [-Wempty-body]
  arch/x86/include/asm/mach_traps.h:40:16: warning: suggest braces around empty body in an ¡else¢ statement [-Wempty-body]

Let's just use the standard 'do {} while (0)' solution. That
shuts up gcc and also prevents future problems if the macros
should end up being used in a similar situation elsewhere.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Link: http://lkml.kernel.org/r/alpine.LNX.2.00.1112180103130.21784@swampdragon.chaosbits.net
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/include/asm/mc146818rtc.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/mc146818rtc.h b/arch/x86/include/asm/mc146818rtc.h
index 01fdf56..0e8e85b 100644
--- a/arch/x86/include/asm/mc146818rtc.h
+++ b/arch/x86/include/asm/mc146818rtc.h
@@ -81,8 +81,8 @@ static inline unsigned char current_lock_cmos_reg(void)
 #else
 #define lock_cmos_prefix(reg) do {} while (0)
 #define lock_cmos_suffix(reg) do {} while (0)
-#define lock_cmos(reg)
-#define unlock_cmos()
+#define lock_cmos(reg) do { } while (0)
+#define unlock_cmos() do { } while (0)
 #define do_i_have_lock_cmos() 0
 #define current_lock_cmos_reg() 0
 #endif

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-18  0:05 [PATCH] x86, mc146818rtc.h: use do{}while(0) for empty lock_cmos()/unlock_cmos() Jesper Juhl
2011-12-18 23:51 ` [tip:x86/cleanups] x86: Use "do { } while(0)" for empty lock_cmos( )/unlock_cmos() macros 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