From patchwork Mon Oct 7 09:45:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 2995321 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DBECABF924 for ; Mon, 7 Oct 2013 09:45:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C43BB201CE for ; Mon, 7 Oct 2013 09:45:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8505C201C7 for ; Mon, 7 Oct 2013 09:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754854Ab3JGJpJ (ORCPT ); Mon, 7 Oct 2013 05:45:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:37671 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752895Ab3JGJpI (ORCPT ); Mon, 7 Oct 2013 05:45:08 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 47BEFA4EB7; Mon, 7 Oct 2013 11:45:05 +0200 (CEST) Date: Mon, 7 Oct 2013 11:45:01 +0200 From: Jean Delvare To: linux-acpi@vger.kernel.org Cc: Len Brown , "Rafael J. Wysocki" Subject: [PATCH] ACPICA: Silent warnings about empty body in if/else statement Message-ID: <20131007114501.1519f7dd@endymion.delvare> Organization: Suse Linux X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.18; x86_64-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Len Brown Cc: "Rafael J. Wysocki" --- 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 */