From patchwork Fri Nov 24 10:32:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Hiler X-Patchwork-Id: 10073931 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 33A026037F for ; Fri, 24 Nov 2017 10:32:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25E8F2A393 for ; Fri, 24 Nov 2017 10:32:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1847D2A395; Fri, 24 Nov 2017 10:32:17 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A7ADA2A393 for ; Fri, 24 Nov 2017 10:32:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 532676E911; Fri, 24 Nov 2017 10:32:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id E1FD56E911 for ; Fri, 24 Nov 2017 10:32:14 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Nov 2017 02:32:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,446,1505804400"; d="scan'208";a="6494136" Received: from ahiler-desk1.fi.intel.com ([10.237.68.151]) by fmsmga001.fm.intel.com with ESMTP; 24 Nov 2017 02:32:13 -0800 From: Arkadiusz Hiler To: intel-gfx@lists.freedesktop.org Date: Fri, 24 Nov 2017 12:32:07 +0200 Message-Id: <20171124103207.19233-1-arkadiusz.hiler@intel.com> X-Mailer: git-send-email 2.13.6 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH i-g-t] lib/igt_core: Move write_stderr out of LIBUNWIND ifdef X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP write_stderr() and __write_stderr() are defined behind ifdef on HAVE_LIBUNWIND, but do no depend on the lib in any way. fatal_sig_handler() uses those helpers unconditionally. This patch just moves the code couple of lines up, so the helpers are always available and do not break build on systems without libunwind. Cc: Tvrtko Ursulin Signed-off-by: Arkadiusz Hiler Reviewed-by: Tvrtko Ursulin --- lib/igt_core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index 4fe48c97..6ce83bec 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -1231,6 +1231,16 @@ static bool run_under_gdb(void) strncmp(basename(buf), "gdb", 3) == 0); } +static void __write_stderr(const char *str, size_t len) +{ + igt_ignore_warn(write(STDERR_FILENO, str, len)); +} + +static void write_stderr(const char *str) +{ + __write_stderr(str, strlen(str)); +} + #ifdef HAVE_LIBUNWIND #define UNW_LOCAL_ONLY #include @@ -1407,16 +1417,6 @@ xprintf(const char *fmt, ...) va_end(ap); } -static void __write_stderr(const char *str, size_t len) -{ - igt_ignore_warn(write(STDERR_FILENO, str, len)); -} - -static void write_stderr(const char *str) -{ - __write_stderr(str, strlen(str)); -} - static void print_backtrace_sig_safe(void) { unw_cursor_t cursor;