From: Arnd Bergmann <arnd@kernel.org>
To: Robert Moore <robert.moore@intel.com>,
Erik Kaneda <erik.kaneda@intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Len Brown <lenb@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-acpi@vger.kernel.org, devel@acpica.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] acpi: avoid -Wempty-body warnings
Date: Mon, 22 Mar 2021 11:58:00 +0100 [thread overview]
Message-ID: <20210322105805.1498602-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
The acpi drivers produce a number of avoidable warnings for empty macros
when building with 'make W=1':
drivers/acpi/acpi_processor.c: In function 'acpi_processor_errata_piix4':
drivers/acpi/acpi_processor.c:133:95: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
133 | "Bus master activity detection (BM-IDE) erratum enabled\n"));
| ^
drivers/acpi/acpi_processor.c:136:82: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
136 | "Type-F DMA livelock erratum (C3 disabled)\n"));
| ^
drivers/acpi/acpi_processor.c: In function 'acpi_processor_get_info':
drivers/acpi/acpi_processor.c:251:77: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
251 | "No bus mastering arbitration control\n"));
| ^
drivers/acpi/processor_pdc.c: In function 'acpi_processor_eval_pdc':
drivers/acpi/processor_pdc.c:136:79: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
136 | "Could not evaluate _PDC, using legacy perf. control.\n"));
| ^
I tried making these call no_printk() instead, which would add proper
format string checking, but that turned out to be a rather invasive
change, so just shut up the warning by turning the macros into empty
"do {} while (0)" statements.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/acpi/acoutput.h | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 1538a6853822..b5484ef31f27 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -433,23 +433,23 @@
* This is the non-debug case -- make everything go away,
* leaving no executable debug code!
*/
-#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)
+#define ACPI_DEBUG_PRINT(pl) do { } while (0)
+#define ACPI_DEBUG_PRINT_RAW(pl) do { } while (0)
+#define ACPI_DEBUG_EXEC(a) do { } while (0)
+#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while (0)
+#define ACPI_FUNCTION_NAME(a) do { } while (0)
+#define ACPI_FUNCTION_TRACE(a) do { } while (0)
+#define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while (0)
+#define ACPI_FUNCTION_TRACE_U32(a, b) do { } while (0)
+#define ACPI_FUNCTION_TRACE_STR(a, b) do { } while (0)
+#define ACPI_FUNCTION_ENTRY() do { } while (0)
+#define ACPI_DUMP_STACK_ENTRY(a) do { } while (0)
+#define ACPI_DUMP_OPERANDS(a, b, c) do { } while (0)
+#define ACPI_DUMP_ENTRY(a, b) do { } while (0)
+#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while (0)
+#define ACPI_DUMP_BUFFER(a, b) do { } while (0)
#define ACPI_IS_DEBUG_ENABLED(level, component) 0
-#define ACPI_TRACE_POINT(a, b, c, d)
+#define ACPI_TRACE_POINT(a, b, c, d) do { } while (0)
/* Return macros must have a return statement at the minimum */
--
2.29.2
next reply other threads:[~2021-03-22 10:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 10:58 Arnd Bergmann [this message]
2021-03-22 13:27 ` [PATCH] acpi: avoid -Wempty-body warnings Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210322105805.1498602-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=devel@acpica.org \
--cc=erik.kaneda@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox