From patchwork Fri Mar 2 08:22:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10253615 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 93E8A6037D for ; Fri, 2 Mar 2018 08:24:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D948288C6 for ; Fri, 2 Mar 2018 08:24:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 722AB288CD; Fri, 2 Mar 2018 08:24:40 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 9E7DB288C6 for ; Fri, 2 Mar 2018 08:24:39 +0000 (UTC) Received: from localhost ([::1]:33305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erfza-0008UX-CY for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Mar 2018 03:24:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erfyu-0008Bn-Hw for qemu-devel@nongnu.org; Fri, 02 Mar 2018 03:23:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erfyq-0003rr-Jl for qemu-devel@nongnu.org; Fri, 02 Mar 2018 03:23:56 -0500 Received: from smtp55.i.mail.ru ([217.69.128.35]:54002) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erfyq-0003oq-3n for qemu-devel@nongnu.org; Fri, 02 Mar 2018 03:23:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=tS0wcH7wXeU+WvWM9O84MbeSgtp+CFVPr7sdGL4SKGw=; b=cpgiqZUD352skAQSrn75FSpfjwiSOScO9ixK0usRiXTAnhNygcV1lRlcTlsSgYPWSTUEVy3/1CcxOHpcsHUYQvJ4A9aaIh3aunEh3L9jjixEyvrORaUqdL6PN11LEGqx2suE6cIEmoV44yDMthprAUJ9CJq2jsbP/d2mI2H4eRg=; Received: by smtp55.i.mail.ru with esmtpa (envelope-from ) id 1erfyl-0001dv-GD; Fri, 02 Mar 2018 11:23:47 +0300 To: qemu-devel@nongnu.org, Stefan Hajnoczi Date: Fri, 2 Mar 2018 11:22:45 +0300 Message-Id: <1519978965-16865-1-git-send-email-jusual@mail.ru> X-Mailer: git-send-email 2.1.4 Authentication-Results: smtp55.i.mail.ru; auth=pass smtp.auth=jusual@mail.ru smtp.mailfrom=jusual@mail.ru X-7FA49CB5: 0D63561A33F958A5D595E4EFB35A8E1923EE44A6573E3F842654C9FC2C598A68725E5C173C3A84C3B0CCA5D702FF13BEF9B9C40B21F63CC8026D3A1080F4EF5CC4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0FF045C6A0F83C8214574AF45C6390F7469DAA53EE0834AAEE X-Mailru-Sender: E03EFFB74E926B2DFC3B87178F5C03BEB146ADFD4AA1B79962B77EDD91DBE9DF0E8F58CB380BC13F7C4160E8B47E48163DDE9B364B0DF2898CB68AF7A628805D594FB4C9F0DBF412AE208404248635DF X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 217.69.128.35 Subject: [Qemu-devel] [PATCH] checkpatch: add a warning for basename/dirname 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: , X-Patchwork-Original-From: Julia Suvorova via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: Julia Suvorova Cc: Jim Mussared , Cornelia Huck , Joel Stanley , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Julia Suvorova Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Julia Suvorova --- scripts/checkpatch.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1b4b812..6c4fb42 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2584,6 +2584,11 @@ sub process { ERROR("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); } +# recommend g_path_get_* over basename(3) and dirname(3) + if ($line =~ /\b(basename|dirname)\s*\(/) { + WARN("consider using g_path_get_$1 in preference to $1(3)\n" . $herecurr); + } + # recommend qemu_strto* over strto* for numeric conversions if ($line =~ /\b(strto[^kd].*?)\s*\(/) { ERROR("consider using qemu_$1 in preference to $1\n" . $herecurr);