From patchwork Wed Sep 21 15:27:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 9343733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 39322607D4 for ; Wed, 21 Sep 2016 15:29:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46B1D2A780 for ; Wed, 21 Sep 2016 15:29:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B3962A783; Wed, 21 Sep 2016 15:29:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C329E2A780 for ; Wed, 21 Sep 2016 15:29:00 +0000 (UTC) Received: from localhost ([::1]:43196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjSF-0006JB-IS for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Sep 2016 11:28:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjRV-0005vq-5K for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:28:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmjRQ-0005tT-5C for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:28:12 -0400 Received: from [62.254.189.133] (port=18416 helo=centos.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjRP-0005iV-Qt for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:28:08 -0400 Received: by centos.localdomain (Postfix, from userid 500) id ACC829FBDC; Wed, 21 Sep 2016 16:27:50 +0100 (BST) From: Felipe Franciosi To: Pavel Dovgalyuk , Eric Blake , "Daniel P. Berrange" Date: Wed, 21 Sep 2016 16:27:01 +0100 Message-Id: <1474471622-12802-1-git-send-email-felipe@nutanix.com> X-Mailer: git-send-email 1.9.5 X-detected-operating-system: by eggs.gnu.org: Mac OS X [generic] X-Received-From: 62.254.189.133 Subject: [Qemu-devel] [PATCH 1/2] compiler: add ignore_value() macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Franciosi , Markus Armbruster , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On GCC versions 3.4 and newer, simply using (void) in front of a function that has been declared with WUR will no longer suppress a compilation warning. This commit brings the ignore_value() macro from GNULIB's ignore_value.h, licensed under the terms of LGPLv2+. See the link below for the original author's comment: https://lists.nongnu.org/archive/html/qemu-devel/2016-09/msg05148.html Signed-off-by: Felipe Franciosi Reviewed-by: Eric Blake --- include/qemu/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 338d3a6..655d0c7 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -26,6 +26,14 @@ #define QEMU_WARN_UNUSED_RESULT #endif +/* The ignore_value() macro comes from GNULIB's LGPLv2+ ignore-value.h */ +#if QEMU_GNUC_PREREQ(3, 4) +# define ignore_value(x) \ + (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; })) +#else +# define ignore_value(x) ((void) (x)) +#endif + #if QEMU_GNUC_PREREQ(4, 0) #define QEMU_SENTINEL __attribute__((sentinel)) #else