public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/4] module_param: bool params should still work with #include <stdbool.h>
@ 2009-02-09  9:33 Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2009-02-09  9:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arjan van de Ven

On Monday 09 February 2009 18:22:26 Rusty Russell wrote:
> 
> Code such as "module_param(foo, bool, 0400)" no longer compiles if one
> includes stdbool.h: the ISO standard requires that this "#define bool
> _Bool".

Of course, better fix is not to use stdbool.h, but leave it to the
typedef in kernel/types.h.

Forget this patch...
Rusty.

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH 1/4] module_param: bool params should still work with #include <stdbool.h>
@ 2009-02-09  7:52 Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2009-02-09  7:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arjan van de Ven


Code such as "module_param(foo, bool, 0400)" no longer compiles if one
includes stdbool.h: the ISO standard requires that this "#define bool
_Bool".

The fix is simple: define those as well.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -180,6 +180,11 @@ extern int param_get_bool(char *buffer, 
 extern int param_get_bool(char *buffer, struct kernel_param *kp);
 #define param_check_bool(name, p) __param_check(name, p, int)
 
+/* #include <stdbool.h> transforms module_param(foo, bool, 0). */
+#define param_set__Bool param_set_bool
+#define param_get__Bool param_get_bool
+#define param_check__Bool param_check_bool
+
 extern int param_set_invbool(const char *val, struct kernel_param *kp);
 extern int param_get_invbool(char *buffer, struct kernel_param *kp);
 #define param_check_invbool(name, p) __param_check(name, p, int)


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

end of thread, other threads:[~2009-02-09  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-09  9:33 [PATCH 1/4] module_param: bool params should still work with #include <stdbool.h> Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2009-02-09  7:52 Rusty Russell

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