From patchwork Tue Feb 9 15:25:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 8263111 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 698D99F4DD for ; Tue, 9 Feb 2016 15:57:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C523320254 for ; Tue, 9 Feb 2016 15:57:04 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 18AC820251 for ; Tue, 9 Feb 2016 15:57:04 +0000 (UTC) Received: from localhost ([::1]:57382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTAf1-000707-5M for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Feb 2016 10:57:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTAb9-0000X2-NT for qemu-devel@nongnu.org; Tue, 09 Feb 2016 10:53:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTAb4-00076S-Ox for qemu-devel@nongnu.org; Tue, 09 Feb 2016 10:53:03 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:57247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTAb4-00076J-IM for qemu-devel@nongnu.org; Tue, 09 Feb 2016 10:52:58 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.84) (envelope-from ) id 1aTAAC-0006BR-Js; Tue, 09 Feb 2016 15:25:12 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 9 Feb 2016 15:25:11 +0000 Message-Id: <1455031511-23684-15-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455031511-23684-1-git-send-email-peter.maydell@linaro.org> References: <1455031511-23684-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::1 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH 14/14] oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The right place for "work around issues with system headers" code is osdep.h. Move the workaround for OSX's stdlib.h emitting a deprecation warning for daemon() to that header. This also fixes a problem where running clean-includes on oslib-posix.c would erroneously remove the #include from it, breaking the workaround. Signed-off-by: Peter Maydell --- include/qemu/osdep.h | 11 +++++++++++ util/oslib-posix.c | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 59a7f8d..cc055c9 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -27,6 +27,17 @@ #include "config-host.h" #include "qemu/compiler.h" + +/* The following block of code temporarily renames the daemon() function so the + * compiler does not see the warning associated with it in stdlib.h on OSX + */ +#ifdef __APPLE__ +#define daemon qemu_fake_daemon_function +#include +#undef daemon +extern int daemon(int, int); +#endif + #include #include #include diff --git a/util/oslib-posix.c b/util/oslib-posix.c index d844387..7615be4 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -26,15 +26,6 @@ * THE SOFTWARE. */ -/* The following block of code temporarily renames the daemon() function so the - compiler does not see the warning associated with it in stdlib.h on OSX */ -#ifdef __APPLE__ -#define daemon qemu_fake_daemon_function -#include -#undef daemon -extern int daemon(int, int); -#endif - #if defined(__linux__) && (defined(__x86_64__) || defined(__arm__)) /* Use 2 MiB alignment so transparent hugepages can be used by KVM. Valgrind does not support alignments larger than 1 MiB,