From patchwork Wed Sep 21 15:27:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 9343731 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 A29C3607D4 for ; Wed, 21 Sep 2016 15:28:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0A1C2A782 for ; Wed, 21 Sep 2016 15:28:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A54CD2A784; Wed, 21 Sep 2016 15:28:45 +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 35E5C2A782 for ; Wed, 21 Sep 2016 15:28:45 +0000 (UTC) Received: from localhost ([::1]:43195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjS0-00061y-8J for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Sep 2016 11:28:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjRV-0005vp-52 for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:28:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmjRQ-0005tZ-5k for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:28:12 -0400 Received: from [62.254.189.133] (port=43003 helo=centos.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjRP-0005ic-R1 for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:28:08 -0400 Received: by centos.localdomain (Postfix, from userid 500) id 1B4AC9FBEC; Wed, 21 Sep 2016 16:27:51 +0100 (BST) From: Felipe Franciosi To: Pavel Dovgalyuk , Eric Blake , "Daniel P. Berrange" Date: Wed, 21 Sep 2016 16:27:02 +0100 Message-Id: <1474471622-12802-2-git-send-email-felipe@nutanix.com> X-Mailer: git-send-email 1.9.5 In-Reply-To: <1474471622-12802-1-git-send-email-felipe@nutanix.com> References: <1474471622-12802-1-git-send-email-felipe@nutanix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Mac OS X [generic] X-Received-From: 62.254.189.133 Subject: [Qemu-devel] [PATCH 2/2] replay: Ignore the return value of fwrite() 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 If building with GCC 3.4 or newer (and using -Werror=unused-result), replay-internal.c will fail to compile due to a call to fwrite() where the return value is not used. Since fwrite() is declared with WUR in glibc, callers should check the return value or find other ways to ignore it. The error message in this specific case is: replay/replay-internal.c: In function ‘replay_put_array’: replay/replay-internal.c:68:15: error: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result [-Werror=unused-result] fwrite(buf, 1, size, replay_file); ^ This commit wraps the fwrite() call with the ignore_value() macro, which currently suppresses the error for existing GCC versions. Signed-off-by: Felipe Franciosi --- replay/replay-internal. | 0 replay/replay-internal.c | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 replay/replay-internal. diff --git a/replay/replay-internal. b/replay/replay-internal. new file mode 100644 index 0000000..e69de29 diff --git a/replay/replay-internal.c b/replay/replay-internal.c index 5835e8d..61de8f9 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -65,7 +65,7 @@ void replay_put_array(const uint8_t *buf, size_t size) { if (replay_file) { replay_put_dword(size); - fwrite(buf, 1, size, replay_file); + ignore_value(fwrite(buf, 1, size, replay_file)); } }