From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02021C433E0 for ; Wed, 12 Aug 2020 17:48:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D48112076C for ; Wed, 12 Aug 2020 17:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597254529; bh=EYt4wh2alCuy+duhJyqAQ5V4dVUDjsYJIHkzlfrWUZE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=qJNA3G4re4nsRCv09lhGpvGNXyJ0ZjFzYxmPjHDwFuFow5KZRfuFfEfRq4hL+0MAn UoyPF9omfmHeZNAyL5SZBObGTr5qJLRK+KYHSdIWmCfiYV+usrgwuvbORLrg/4iCtR uNz5ftW/rJZKBeDYWkiZPwykIPeredqS/OriO1Ps= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726477AbgHLRss (ORCPT ); Wed, 12 Aug 2020 13:48:48 -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-Google-Smtp-Source: ABdhPJzetrCFjWMWorlM78pluJ8mIRVZKqXRbqxC7kbwHtCysk4df/83X8LPmdlF0mAhagZ0k6VqVgyrCQKxB/8vY6U= 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-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@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