From patchwork Tue Nov 21 00:00:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Davis X-Patchwork-Id: 10067527 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 1B92360224 for ; Tue, 21 Nov 2017 00:01:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D60829194 for ; Tue, 21 Nov 2017 00:01:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 022272923B; Tue, 21 Nov 2017 00:01:38 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 892C029194 for ; Tue, 21 Nov 2017 00:01:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbdKUAAz (ORCPT ); Mon, 20 Nov 2017 19:00:55 -0500 Received: from mail-io0-f178.google.com ([209.85.223.178]:43246 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751863AbdKUAAv (ORCPT ); Mon, 20 Nov 2017 19:00:51 -0500 Received: by mail-io0-f178.google.com with SMTP id s37so6673153ioe.10; Mon, 20 Nov 2017 16:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NylsyB0bBfm3iOZKJZoFl/L/XgiiBzEtRvzjmpxnej0=; b=D2KG6pFc0I+8D8pEN8PsBpT3FrcD4GYrt/2wAgB0Q+mIGYeyiyQTHroJlEWuaHiJi7 +F1r368pyQiLNp+gTZEqFGuJ0xNxwttSp4DzXbynx6+MavxZxsuzFi3RqS2OimdFsoSI aFefRz7VeSB7qEbn3HYM4mp5WzgEaMt8SoNADh0E6naZNF5STAM7WzJQTvA9EgOejzYn Xs/JZtHiuuAC82Ale3B0rcra6sh6QqgA8XJf5dteVnEgZ0QeX+djy25nw1KQQ3/0GYqI qJS8fgJFEyIqsg4q8M1VdFCCyPALYq0Czcswz1P1ims6h/Z6hrFS6hDUlUxHCcsrUKSX mHSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NylsyB0bBfm3iOZKJZoFl/L/XgiiBzEtRvzjmpxnej0=; b=OJxQV/kbwgmiIZps18O8TQ0vZQ9sWUvlI8kRv8BzEabhTIyfm2CXGzbqpNMcr9/leZ pMN8xH9waRxUJVE+1VMzymYV5/ul+5dIubotbnVCMu4GjaiYDWHIDtyMfuD9TqIhiodP 1JcBjGcCsmjXcLPzrBRxy+sAyC4WWxsnmyN104S53GCpigLnSfoFfmtp8WGg+rlBMCxz 3u24Gb/9wj8/ivsOFQptRNTW0IQBrxiX82Vu28Qt7W1uXkNgGpp+J+etuhfsLc0YoIDg Dbq2nnyVh9wv5ImOQ/NYJr9fbYTJcyqkg0l4kASbDsatLI65eqgvF/gf55JoLArCSb0C iYxg== X-Gm-Message-State: AJaThX7+s4Trcf6Eq71eHmEH473EB5jzWeMb9X81JoQzVyvDOfg2r6WY GFvNPKSahaezlswfkWUelOysdi3x6Z80fcysqKs= X-Google-Smtp-Source: AGs4zMZ3aXNPWU5vj2cQ54MfjFu2Y6ePAJBID6PHrOwEHzP6R0KGnYCtehfvgPB+LWV4rUgzTQcxvmf00Sn3iviILGM= X-Received: by 10.107.132.19 with SMTP id g19mr15185666iod.47.1511222449588; Mon, 20 Nov 2017 16:00:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.76.85 with HTTP; Mon, 20 Nov 2017 16:00:48 -0800 (PST) In-Reply-To: <20171120212251.k4uvdstfhg6qtrag@ltop.local> References: <716fa938a4ab0ad66490b72e2ed750cd6583728f.1510840787.git-series.knut.omang@oracle.com> <20171120200827.726yhebihjhrhted@ltop.local> <1511212212.4822.66.camel@oracle.com> <20171120212251.k4uvdstfhg6qtrag@ltop.local> From: Jim Davis Date: Mon, 20 Nov 2017 17:00:48 -0700 Message-ID: Subject: Re: [PATCH 2/7] kbuild: Add P= command line flag to run checkpatch To: Luc Van Oostenryck Cc: Knut Omang , Masahiro Yamada , Linux Kernel Mailing List , Michal Marek , Linux Kbuild mailing list Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Nov 20, 2017 at 2:22 PM, Luc Van Oostenryck wrote: > Should it be possible to somehow keep the distinction between > the flags coming from KBUILD_CFLAGS and the pure CHECKFLAGS? Well, the practical problem seems to be that $(CHECK) is called in scripts/Makefile.build with both $(CHECKFLAGS) and $(c_flags) as arguments, regardless of what $(CHECK) is. That can be hacked around with something inelegant like and then if I run scripts/checkpatch.pl as $CHECK and pass --quiet --file as before it works -- until checkpatch returns with a non-zero exit code, which causes the Makefile to bail at that point. So maybe a wrapper script, with an exit 0 fixup to keep on keeping on in case of checkpatch warnings or errors, would be better after all. diff --git a/scripts/Makefile.build b/scripts/Makefile.build index bb831d49bcfd..102194f9afb9 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -98,14 +98,20 @@ __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ $(subdir-ym) $(always) @: -# Linus' kernel sanity checking tool +# Linus' kernel sanity checking tool, or $CHECK program of choice +ifneq ($(KBUILD_CHECKSRC),) + add_to_checkflags = + ifeq ($(CHECK),sparse) + add_to_checkflags = $(c_flags) + endif +endif ifneq ($(KBUILD_CHECKSRC),0) ifeq ($(KBUILD_CHECKSRC),2) quiet_cmd_force_checksrc = CHECK $< - cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(add_to_checkflags) $< ; else quiet_cmd_checksrc = CHECK $< - cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(add_to_checkflags) $< ; endif endif