From patchwork Thu Apr 23 22:12:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rg_Krause?= X-Patchwork-Id: 464074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 044AF140077 for ; Fri, 24 Apr 2015 08:15:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlPNK-0001Qh-DX; Thu, 23 Apr 2015 22:13:38 +0000 Received: from mx02.posteo.de ([89.146.194.165]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlPNF-0001OB-2T for linux-mtd@lists.infradead.org; Thu, 23 Apr 2015 22:13:33 +0000 Received: from dovecot03.posteo.de (unknown [185.67.36.28]) by mx02.posteo.de (Postfix) with ESMTPS id 5987F1F46584 for ; Fri, 24 Apr 2015 00:12:57 +0200 (CEST) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3lXtDT4jR0z5vMr for ; Fri, 24 Apr 2015 00:12:57 +0200 (CEST) Received: from nzxt.fritz.box (nzxt.localdomain [192.168.178.46]) (Authenticated sender: joerg.krause@embedded.rocks) by embedded.rocks (Postfix) with ESMTPSA id 2854D980096; Fri, 24 Apr 2015 00:12:57 +0200 (CEST) From: =?UTF-8?q?J=C3=B6rg=20Krause?= To: linux-mtd@lists.infradead.org Subject: [PATCH 1/3] include/common.h: fix build against musl Date: Fri, 24 Apr 2015 00:12:51 +0200 Message-Id: <1429827173-1739-1-git-send-email-joerg.krause@embedded.rocks> X-Mailer: git-send-email 2.3.6 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150423_151333_307827_485F8F44 X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [89.146.194.165 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [89.146.194.165 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: =?UTF-8?q?J=C3=B6rg=20Krause?= X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Like uClibc version older than (not yet released) 0.9.34 musl does not have a rpmatch() implementation. uClibc defines both __UCLIBC__ and __GLIBC__. So first check for uCibc and its version and then for a non glibc implementation (like musl). Note, musl does not define __MUSL__. Signed-off-by: Jörg Krause --- include/common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/common.h b/include/common.h index 9b8804a..fb0ca83 100644 --- a/include/common.h +++ b/include/common.h @@ -117,11 +117,12 @@ extern "C" { fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ } while(0) -#if defined(__UCLIBC__) -/* uClibc versions before 0.9.34 don't have rpmatch() */ -#if __UCLIBC_MAJOR__ == 0 && \ +/* uClibc versions before 0.9.34 and musl don't have rpmatch() */ +#if defined(__UCLIBC__) && \ + (__UCLIBC_MAJOR__ == 0 && \ (__UCLIBC_MINOR__ < 9 || \ - (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 34)) + (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 34))) || \ + !defined(__GLIBC__) #undef rpmatch #define rpmatch __rpmatch static inline int __rpmatch(const char *resp) @@ -130,7 +131,6 @@ static inline int __rpmatch(const char *resp) (resp[0] == 'n' || resp[0] == 'N') ? 0 : -1; } #endif -#endif /** * prompt the user for confirmation