* [PATCH] ACPICA: Silent warnings about empty body in if/else statement
@ 2013-10-07 9:45 Jean Delvare
2013-10-07 12:11 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2013-10-07 9:45 UTC (permalink / raw)
To: linux-acpi; +Cc: Len Brown, Rafael J. Wysocki
When ACPI debugging is disabled, I see warnings like this one:
drivers/i2c/busses/i2c-scmi.c: In function "acpi_smbus_cmi_add_cap":
drivers/i2c/busses/i2c-scmi.c:328:39: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
drivers/i2c/busses/i2c-scmi.c:338:12: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
It is caused by ACPI_DEBUG_PRINT (or other similar macros) to resolve
to nothing. Make them resolve to the classic "do {} while (0)" construct
instead when the compiler likes that, to silent all such warnings.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Len Brown <lenb@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
---
include/acpi/acoutput.h | 40 +++++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 15 deletions(-)
--- linux-3.12-rc4.orig/include/acpi/acoutput.h 2013-09-24 00:41:09.000000000 +0200
+++ linux-3.12-rc4/include/acpi/acoutput.h 2013-10-07 11:23:57.928436503 +0200
@@ -427,22 +427,32 @@
/*
* This is the non-debug case -- make everything go away,
* leaving no executable debug code!
+ *
+ * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from
+ * complaining about these constructs. On other compilers the do...while
+ * adds some extra code, so this feature is optional.
*/
-#define ACPI_DEBUG_PRINT(pl)
-#define ACPI_DEBUG_PRINT_RAW(pl)
-#define ACPI_DEBUG_EXEC(a)
-#define ACPI_DEBUG_ONLY_MEMBERS(a)
-#define ACPI_FUNCTION_NAME(a)
-#define ACPI_FUNCTION_TRACE(a)
-#define ACPI_FUNCTION_TRACE_PTR(a, b)
-#define ACPI_FUNCTION_TRACE_U32(a, b)
-#define ACPI_FUNCTION_TRACE_STR(a, b)
-#define ACPI_FUNCTION_ENTRY()
-#define ACPI_DUMP_STACK_ENTRY(a)
-#define ACPI_DUMP_OPERANDS(a, b, c)
-#define ACPI_DUMP_ENTRY(a, b)
-#define ACPI_DUMP_PATHNAME(a, b, c, d)
-#define ACPI_DUMP_BUFFER(a, b)
+#ifdef ACPI_USE_DO_WHILE_0
+#define ACPI_DO_WHILE0 do {} while (0)
+#else
+#define ACPI_DO_WHILE0
+#endif
+
+#define ACPI_DEBUG_PRINT(pl) ACPI_DO_WHILE0
+#define ACPI_DEBUG_PRINT_RAW(pl) ACPI_DO_WHILE0
+#define ACPI_DEBUG_EXEC(a) ACPI_DO_WHILE0
+#define ACPI_DEBUG_ONLY_MEMBERS(a) ACPI_DO_WHILE0
+#define ACPI_FUNCTION_NAME(a) ACPI_DO_WHILE0
+#define ACPI_FUNCTION_TRACE(a) ACPI_DO_WHILE0
+#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_DO_WHILE0
+#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_DO_WHILE0
+#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_DO_WHILE0
+#define ACPI_FUNCTION_ENTRY() ACPI_DO_WHILE0
+#define ACPI_DUMP_STACK_ENTRY(a) ACPI_DO_WHILE0
+#define ACPI_DUMP_OPERANDS(a, b, c) ACPI_DO_WHILE0
+#define ACPI_DUMP_ENTRY(a, b) ACPI_DO_WHILE0
+#define ACPI_DUMP_PATHNAME(a, b, c, d) ACPI_DO_WHILE0
+#define ACPI_DUMP_BUFFER(a, b) ACPI_DO_WHILE0
#define ACPI_IS_DEBUG_ENABLED(level, component) 0
/* Return macros must have a return statement at the minimum */
--
Jean Delvare
Suse L3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPICA: Silent warnings about empty body in if/else statement
2013-10-07 9:45 [PATCH] ACPICA: Silent warnings about empty body in if/else statement Jean Delvare
@ 2013-10-07 12:11 ` Rafael J. Wysocki
2013-10-07 17:08 ` Jean Delvare
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-10-07 12:11 UTC (permalink / raw)
To: Jean Delvare; +Cc: linux-acpi, Len Brown, Lv Zheng, Moore, Robert
On Monday, October 07, 2013 11:45:01 AM Jean Delvare wrote:
> When ACPI debugging is disabled, I see warnings like this one:
>
> drivers/i2c/busses/i2c-scmi.c: In function "acpi_smbus_cmi_add_cap":
> drivers/i2c/busses/i2c-scmi.c:328:39: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
> drivers/i2c/busses/i2c-scmi.c:338:12: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
>
> It is caused by ACPI_DEBUG_PRINT (or other similar macros) to resolve
> to nothing. Make them resolve to the classic "do {} while (0)" construct
> instead when the compiler likes that, to silent all such warnings.
The rule is that ACPICA patches need to go via upstream ACPICA, so I CCed
the ACPICA maintainers.
Thanks!
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> Cc: Len Brown <lenb@kernel.org>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> ---
> include/acpi/acoutput.h | 40 +++++++++++++++++++++++++---------------
> 1 file changed, 25 insertions(+), 15 deletions(-)
>
> --- linux-3.12-rc4.orig/include/acpi/acoutput.h 2013-09-24 00:41:09.000000000 +0200
> +++ linux-3.12-rc4/include/acpi/acoutput.h 2013-10-07 11:23:57.928436503 +0200
> @@ -427,22 +427,32 @@
> /*
> * This is the non-debug case -- make everything go away,
> * leaving no executable debug code!
> + *
> + * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from
> + * complaining about these constructs. On other compilers the do...while
> + * adds some extra code, so this feature is optional.
> */
> -#define ACPI_DEBUG_PRINT(pl)
> -#define ACPI_DEBUG_PRINT_RAW(pl)
> -#define ACPI_DEBUG_EXEC(a)
> -#define ACPI_DEBUG_ONLY_MEMBERS(a)
> -#define ACPI_FUNCTION_NAME(a)
> -#define ACPI_FUNCTION_TRACE(a)
> -#define ACPI_FUNCTION_TRACE_PTR(a, b)
> -#define ACPI_FUNCTION_TRACE_U32(a, b)
> -#define ACPI_FUNCTION_TRACE_STR(a, b)
> -#define ACPI_FUNCTION_ENTRY()
> -#define ACPI_DUMP_STACK_ENTRY(a)
> -#define ACPI_DUMP_OPERANDS(a, b, c)
> -#define ACPI_DUMP_ENTRY(a, b)
> -#define ACPI_DUMP_PATHNAME(a, b, c, d)
> -#define ACPI_DUMP_BUFFER(a, b)
> +#ifdef ACPI_USE_DO_WHILE_0
> +#define ACPI_DO_WHILE0 do {} while (0)
> +#else
> +#define ACPI_DO_WHILE0
> +#endif
> +
> +#define ACPI_DEBUG_PRINT(pl) ACPI_DO_WHILE0
> +#define ACPI_DEBUG_PRINT_RAW(pl) ACPI_DO_WHILE0
> +#define ACPI_DEBUG_EXEC(a) ACPI_DO_WHILE0
> +#define ACPI_DEBUG_ONLY_MEMBERS(a) ACPI_DO_WHILE0
> +#define ACPI_FUNCTION_NAME(a) ACPI_DO_WHILE0
> +#define ACPI_FUNCTION_TRACE(a) ACPI_DO_WHILE0
> +#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_DO_WHILE0
> +#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_DO_WHILE0
> +#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_DO_WHILE0
> +#define ACPI_FUNCTION_ENTRY() ACPI_DO_WHILE0
> +#define ACPI_DUMP_STACK_ENTRY(a) ACPI_DO_WHILE0
> +#define ACPI_DUMP_OPERANDS(a, b, c) ACPI_DO_WHILE0
> +#define ACPI_DUMP_ENTRY(a, b) ACPI_DO_WHILE0
> +#define ACPI_DUMP_PATHNAME(a, b, c, d) ACPI_DO_WHILE0
> +#define ACPI_DUMP_BUFFER(a, b) ACPI_DO_WHILE0
> #define ACPI_IS_DEBUG_ENABLED(level, component) 0
>
> /* Return macros must have a return statement at the minimum */
>
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPICA: Silent warnings about empty body in if/else statement
2013-10-07 12:11 ` Rafael J. Wysocki
@ 2013-10-07 17:08 ` Jean Delvare
2013-10-07 19:39 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2013-10-07 17:08 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-acpi, Len Brown, Lv Zheng, Moore, Robert
Le Monday 07 October 2013 à 14:11 +0200, Rafael J. Wysocki a écrit :
> On Monday, October 07, 2013 11:45:01 AM Jean Delvare wrote:
> > When ACPI debugging is disabled, I see warnings like this one:
> >
> > drivers/i2c/busses/i2c-scmi.c: In function "acpi_smbus_cmi_add_cap":
> > drivers/i2c/busses/i2c-scmi.c:328:39: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
> > drivers/i2c/busses/i2c-scmi.c:338:12: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
> >
> > It is caused by ACPI_DEBUG_PRINT (or other similar macros) to resolve
> > to nothing. Make them resolve to the classic "do {} while (0)" construct
> > instead when the compiler likes that, to silent all such warnings.
>
> The rule is that ACPICA patches need to go via upstream ACPICA, so I CCed
> the ACPICA maintainers.
Thanks Rafael. Maybe MAINTAINERS should be adjusted accordingly.
Contributors can't guess.
Thanks,
--
Jean Delvare
Suse L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPICA: Silent warnings about empty body in if/else statement
2013-10-07 17:08 ` Jean Delvare
@ 2013-10-07 19:39 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-10-07 19:39 UTC (permalink / raw)
To: Jean Delvare; +Cc: linux-acpi, Len Brown, Lv Zheng, Moore, Robert
On Monday, October 07, 2013 07:08:00 PM Jean Delvare wrote:
> Le Monday 07 October 2013 à 14:11 +0200, Rafael J. Wysocki a écrit :
> > On Monday, October 07, 2013 11:45:01 AM Jean Delvare wrote:
> > > When ACPI debugging is disabled, I see warnings like this one:
> > >
> > > drivers/i2c/busses/i2c-scmi.c: In function "acpi_smbus_cmi_add_cap":
> > > drivers/i2c/busses/i2c-scmi.c:328:39: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
> > > drivers/i2c/busses/i2c-scmi.c:338:12: warning: suggest braces around empty body in an "else" statement [-Wempty-body]
> > >
> > > It is caused by ACPI_DEBUG_PRINT (or other similar macros) to resolve
> > > to nothing. Make them resolve to the classic "do {} while (0)" construct
> > > instead when the compiler likes that, to silent all such warnings.
> >
> > The rule is that ACPICA patches need to go via upstream ACPICA, so I CCed
> > the ACPICA maintainers.
>
> Thanks Rafael. Maybe MAINTAINERS should be adjusted accordingly.
> Contributors can't guess.
That actually is a good idea. I think we'll do that.
Thanks!
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-07 19:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-07 9:45 [PATCH] ACPICA: Silent warnings about empty body in if/else statement Jean Delvare
2013-10-07 12:11 ` Rafael J. Wysocki
2013-10-07 17:08 ` Jean Delvare
2013-10-07 19:39 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.