From patchwork Sat Jul 16 09:48:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 649087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rs4W54VG3z9sR9 for ; Sat, 16 Jul 2016 19:53:04 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bOMDb-00077x-EW; Sat, 16 Jul 2016 09:49:07 +0000 Received: from down.free-electrons.com ([37.187.137.238] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bOMDZ-00077E-3M for linux-mtd@lists.infradead.org; Sat, 16 Jul 2016 09:49:06 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id F1A2E42E; Sat, 16 Jul 2016 11:48:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (132.230.147.77.rev.sfr.net [77.147.230.132]) by mail.free-electrons.com (Postfix) with ESMTPSA id 9E69821D; Sat, 16 Jul 2016 11:48:43 +0200 (CEST) From: Thomas Petazzoni To: linux-mtd@lists.infradead.org Subject: [PATCH mtd-utils] integck: only use execinfo.h when INTEGCK_DEBUG is enabled Date: Sat, 16 Jul 2016 11:48:41 +0200 Message-Id: <1468662521-17780-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160716_024905_316192_9CD78FD9 X-CRM114-Status: GOOD ( 10.22 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [37.187.137.238 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Brian Norris MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Guard the usage of execinfo.h by INTEGCK_DEBUG so that by defaut, integck builds properly on systems without (uClibc and musl based systems). As stated in the code, the backtrace() functionality of will anyway only work properly when INTEGCK_DEBUG is defined (it makes all functions non-static, which is needed for backtrace to provide some useful information). Signed-off-by: Thomas Petazzoni --- tests/fs-tests/integrity/integck.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c index 8badd1f..6ef817e 100644 --- a/tests/fs-tests/integrity/integck.c +++ b/tests/fs-tests/integrity/integck.c @@ -31,7 +31,9 @@ #include #include #include +#ifdef INTEGCK_DEBUG #include +#endif #include #include #include @@ -248,14 +250,18 @@ static char *random_name_buf; static void check_failed(const char *cond, const char *func, const char *file, int line) { - int error = errno, count; + int error = errno; +#ifdef INTEGCK_DEBUG + int count; void *addresses[128]; +#endif fflush(stdout); fflush(stderr); errmsg("condition '%s' failed in %s() at %s:%d", cond, func, file, line); normsg("error %d (%s)", error, strerror(error)); +#ifdef INTEGCK_DEBUG /* * Note, to make this work well you need: * 1. Make all functions non-static - add "#define static' @@ -264,6 +270,7 @@ static void check_failed(const char *cond, const char *func, const char *file, */ count = backtrace(addresses, 128); backtrace_symbols_fd(addresses, count, fileno(stdout)); +#endif exit(EXIT_FAILURE); }