Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2292143ybi; Thu, 20 Jun 2019 12:24:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxKQLpk8nzfe0mU2AtPGmymhP6OTg8m6WQQV3EfXhJ3XYjIEfOFpk55K/0SwAaXDz1OgF/ X-Received: by 2002:a17:90a:22ef:: with SMTP id s102mr1369507pjc.2.1561058658356; Thu, 20 Jun 2019 12:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561058658; cv=none; d=google.com; s=arc-20160816; b=Lo6NToWJGRPZUulGyrDx+hNekQDp/hcboqK5MsPNvgZFSSFiRsvay3eepxk2ZY8bVs nE+4Myy5t12k19wldtm1f2Hi9Yh/sPPtWBgpV3hOWh4ldT9+6QOqTQaBJNNerumBq0gU 3JRUJ+gRZkaWFn40mglIHoGu8V/r6tLXQ6KLiS8qpebVxDq0bnz09zebuEqSTmdFwoIR o2CSECCVU95VK+B0RgeW/vALAYSya5h2FpJ0z1KzNB5KVLjEEaJVvRm9QKVQSFi0a/1Y z/i9ec/qnpKYg64uB0xDGdqNy47r5c9AHDV0+e4FYzz7qD6XLnMH8mB/EAmFSlEq5EOm w99g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7PbqY6JxYtRflT8VXBrZuI2k7SBuVCB7vKDf/rMKPrA=; b=QYjijsOjN7zJUz4RFHCaSd8bKlhF/AtnacopNrSjgKJJXkAVeP3L9Mdc7Ru62/PbN+ yoJfyFPBRyYwce+weMp0tVrxCUCELFJPrMDNMM6yHgm4Nmq98Wq5R5JzJNTmJS7nxVxz 0fyD/oMiI7k2Zfmz3JNnFK8nzlC+O6C6fX2vkEAMwrT6btlD0iKgWo4igqg7pq4pPdts zL6fmsLHyk8g80L9RBfDq1NhFjT9BS42cKM0QBiiQZATFKYX5krfdESJqhxLYJlZocZn 0WPlcxSHf7tJmA8UPQpegSvTpQFrlJuvMm6ZIJLspOF1XF/zt17hDBYNiIecBCkfh6ph TaBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MHGHcHQr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si348635pgi.56.2019.06.20.12.24.01; Thu, 20 Jun 2019 12:24:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MHGHcHQr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726424AbfFTTXu (ORCPT + 99 others); Thu, 20 Jun 2019 15:23:50 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:32945 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbfFTTXu (ORCPT ); Thu, 20 Jun 2019 15:23:50 -0400 Received: by mail-pl1-f194.google.com with SMTP id c14so1790000plo.0 for ; Thu, 20 Jun 2019 12:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7PbqY6JxYtRflT8VXBrZuI2k7SBuVCB7vKDf/rMKPrA=; b=MHGHcHQrQsuQfe3jUNK1WeU21v3fsHqkh3H5MuygqvthK+Ib0xua03oAnMOlMqOyQS 6uI2leF5kP2xtXwijlnVSeUYkvZ04DoFcdSQX4e4BHe4nw66ldwJN2SU0kZ4z+yWwSwK cQeIwp/92O/lc/D1hRPH8sGB5tkRnjoS2ho/BgUs9AO6x4J95ElOBg1wgEr6RqJ8iN24 +7a+KQx58Qok1htiavsR4e3CmPTqE0HRSYbEYh9YzLzFRG9yZBkN8Hfu+3tDNPlw8RGl dQK2tu1ASXOID/dmTxVte784bTiEgRvGbBRmjxVUY+M/NaIIUfyxZlTEWDp65GyNVE9z agfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7PbqY6JxYtRflT8VXBrZuI2k7SBuVCB7vKDf/rMKPrA=; b=G8zyyE65QHSInP7zpezJyaDBlkM4ga8J0hNOCo0Xm1diNSJuG0BHwCrL6wEtoXSbJu 5J3Vts9n6auvpYhlyMuUqzox+7j17ktgxsNpAyLrikIrqCnCM0IHQVlY8WuQFr8f1U8x KHO/c153yPwh1CyQde+7GCvUIzW7XhfPA3JzxnOOWF12lxhKMtvkySAmQHQQuowowcV4 NIVeFv8ek+pO5xs8OSHYzJcLmw/LRkCY9iP+0XbzaP/IwZNmUaT8kUxw3v8X/6J3ITFy uQD5af+BFpFuLW6F30NlpSw2PhFkVCcFKgvv6BnaJPiLFjjpMSSJiz8+1ojUWdGR5NdF 6rng== X-Gm-Message-State: APjAAAWRe0zpdDs+N8ZqWFz++TeOd0ftr48TtBrhpZTyTYSAL5BlOL74 QMRN7yNanKG5XUgoClIA4iWFGg== X-Received: by 2002:a17:902:76c6:: with SMTP id j6mr101517249plt.263.1561058629064; Thu, 20 Jun 2019 12:23:49 -0700 (PDT) Received: from google.com ([2620:0:1008:1100:dac3:f780:2846:b802]) by smtp.gmail.com with ESMTPSA id k3sm375687pgo.81.2019.06.20.12.23.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 12:23:48 -0700 (PDT) Date: Thu, 20 Jun 2019 12:23:45 -0700 From: Tom Roeder To: Matthias Kaehlcke Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Raul E Rangel , Nick Desaulniers , Tom Hughes , Douglas Anderson , Ryan Case , Yu Liu Subject: Re: [PATCH] gen_compile_command: Add support for separate KBUILD_OUTPUT directory Message-ID: <20190620192345.GA133204@google.com> References: <20190620184523.155756-1-mka@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190620184523.155756-1-mka@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I can confirm that I can still run clang-tidy on the kernel using this new version of the script; it generates a version of compile_commands.json that works in my case. On Thu, Jun 20, 2019 at 11:45:23AM -0700, Matthias Kaehlcke wrote: > gen_compile_command.py currently assumes that the .cmd files and the > source code live in the same directory, which is not the case when > a separate KBUILD_OUTPUT directory is used. > > Add a new option to specify the kbuild output directory. If the > option is not set the kernel source directory is used. > > Signed-off-by: Matthias Kaehlcke Reviewed-by: Tom Roeder Tested-by: Tom Roeder > --- > Feel free to bikeshed about the option names ;-) > > scripts/gen_compile_commands.py | 28 +++++++++++++++++++--------- > 1 file changed, 19 insertions(+), 9 deletions(-) > > diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py > index 7915823b92a5..5a738ec66cc7 100755 > --- a/scripts/gen_compile_commands.py > +++ b/scripts/gen_compile_commands.py > @@ -31,15 +31,21 @@ def parse_arguments(): > > Returns: > log_level: A logging level to filter log output. > - directory: The directory to search for .cmd files. > + source_directory: The kernel source directory. > + kbuild_output_directory: The directory to search for .cmd files. > output: Where to write the compile-commands JSON file. > """ > usage = 'Creates a compile_commands.json database from kernel .cmd files' > parser = argparse.ArgumentParser(description=usage) > > - directory_help = ('Path to the kernel source directory to search ' > + directory_help = ('Path to the kernel source directory' Minor detail: this needs a space after "directory" so that it reads "directory '". Otherwise, the output doesn't have a space before the parenthesis. > '(defaults to the working directory)') > parser.add_argument('-d', '--directory', type=str, help=directory_help) > + kbuild_output_directory_help = ('Path to the directory to search for ' > + '.cmd files' Same comment here: this should be "files '", with a space before the ending quote character.