Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp678728pxa; Wed, 12 Aug 2020 10:49:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmJXsG6Qd/0M740AQJixa7tZ/TWYlYv4vOLoVGjWsvoNHWBU+m5GuOc/TSzxyOuEKuCM/A X-Received: by 2002:aa7:ca0c:: with SMTP id y12mr985123eds.251.1597254594819; Wed, 12 Aug 2020 10:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597254594; cv=none; d=google.com; s=arc-20160816; b=P585Ry9J30W3dGWqdq2lBZPxAHSV5Bw44x7iuP+wjm/99rTkQkOhI/bjGVVsRaLYkf k2ZIdLGTC++RKaKNK6OLCgqcObvEToSM1sFOttqXigFqt5P1ZmMJHNhwfucOvmm69IZW W2+dScdpfIY72wKwNCqt0zaaijzWnnL5mldiBAt9PiN+Um9A3XLpruqZcZzVCkxkDxRe j8pedccgfsHZVHhuptUBCkTSXQS8SuUx0tBdb3yhMawE2DhprTEhDR2wAljbiM1Ck+aX w+BZUleLsZGx8/xnk3JhsjQ/lnAG0Gqak5HAzXlUeE5T/akOU6U+P7Hv/iBVrNJjuM50 EbJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=Ij7DTc0+G5aYQMMUK117Wrc+BtKR/opUoeRVB4ysu5w=; b=UhDUe2KRBmFmiVz7glMfl76dQz0yHtUCzBnvLXy+qiAbh8F2rAljh4PE0oPzdlNqSK tOvIqmWi6+phD/ACfOD9h2TyieU7DcBOIshFsrxj71EI3Y0mKsVa/J1bjvtKe+1JjqpU 0kwdAwf/T8WflS224U0agrKbu4LmDCczOso17kl3OrFFhdVqEizgs4o8sU6B6cShCZbS OjE36AcYkh/jMaealuMIYvVyMMM2kA/n0zl7JSwGPO7ZHlCLpuY/40BmveBZAkYQEWoF JsI6Qb+dGQ8ZvQd33GF9NAZ4TENBcvGCL3QlqmYQNYVGD8JXrKSiyzjEN2mjbP0bU+H3 uuNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=am32WSW9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si2102548edl.307.2020.08.12.10.49.30; Wed, 12 Aug 2020 10:49:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=am32WSW9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbgHLRst (ORCPT + 99 others); Wed, 12 Aug 2020 13:48:49 -0400 Received: from conssluserg-01.nifty.com ([210.131.2.80]:18504 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbgHLRss (ORCPT ); Wed, 12 Aug 2020 13:48:48 -0400 Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com [209.85.217.41]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 07CHmT0v012843; Thu, 13 Aug 2020 02:48:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 07CHmT0v012843 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1597254510; bh=Ij7DTc0+G5aYQMMUK117Wrc+BtKR/opUoeRVB4ysu5w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=am32WSW9rM61TKdiGbvmyS2CXrjpgNA9SaPVnYT1DfLUKrxQguOocWKiKDbtEUMIN +s7O9g3V4MXn4tX0YIlybIsLoKxRON8FpqAlyL9Aavdn9QIiWB6U9sUOCqB8jTwsQp eORlnbjFwAfiXOk+sDkw3nGXrB6zcXa4bmsoM7Cr2azXy1j5S7py4xHJ4I7VC4IagF ck1RmXWGprVNKqFEittzEAlal5wUpv5OBseFLORihFRyDwGdAlLCryFikGMakJr7do mvwIk4OEvKGjfatxTRgkr6JEh8USkS7UFIi73ZamW90TJ3utOs2mV9iJ592/fFHfh/ aHYtrMcsxBGuQ== X-Nifty-SrcIP: [209.85.217.41] Received: by mail-vs1-f41.google.com with SMTP id k25so1525606vsm.11; Wed, 12 Aug 2020 10:48:30 -0700 (PDT) X-Gm-Message-State: AOAM530LvdYc+Z+luQ5pzs7Id90an8aseLleWdr2kDdsR1Lx3w391uCO sK/KPLCCoKph/1Rnr/zovWEFCTBkA+3Os515e9I= X-Received: by 2002:a67:7c11:: with SMTP id x17mr254093vsc.155.1597254509215; Wed, 12 Aug 2020 10:48:29 -0700 (PDT) MIME-Version: 1.0 References: <20200728004736.3590053-1-nhuck@google.com> In-Reply-To: From: Masahiro Yamada Date: Thu, 13 Aug 2020 02:47:52 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7] Makefile: Add clang-tidy and static analyzer support to makefile To: Nathan Huckleberry Cc: Michal Marek , Linux Kbuild mailing list , Linux Kernel Mailing List , clang-built-linux , Pirama Arumuga Nainar , Bill Wendling Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 12, 2020 at 10:24 AM 'Nathan Huckleberry' via Clang Built Linux wrote: > > Sounds good. Do you think this patch is ready to land then? I do not think so. I pointed out the CC=clang check was not working. I see false positive errors from GCC commands. This patch does not use the benefit of Makefile. Makefile is used to describe the dependency between a target and its prerequisites, and how to update the target. Make compares the timestamps between the targets and prerequisites, then determines which targets need updating. See your code. clang-tidy: ifdef CONFIG_CC_IS_CLANG $(PYTHON3) scripts/clang-tools/gen_compile_commands.py $(PYTHON3) scripts/clang-tools/run-clang-tools.py clang-tidy compile_commands.json else $(error clang-tidy requires CC=clang) endif This always runs two commands sequentially. It rebuilds compile_commands.json even if nothing in the source tree has been changed. If you do this, there is no strong reason to use Make, and actually you can rewrite it in a shell script: clang_tidy () { if [ "$CONFIG_CC_IS_CLANG = "y" ]; then $PYTHON3 scripts/clang-tools/gen_compile_commands.py $PYTHON3 scripts/clang-tools/run-clang-tools.py clang-tidy compile_commands.json else echo "clang-tidy requires CC=clang" exit 1 fi } I changed the rules to Makefile-ish style. https://patchwork.kernel.org/project/linux-kbuild/list/?series=331893 I will wait for comments for the new version. -- Best Regards Masahiro Yamada