From patchwork Fri Sep 1 20:03:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1828982 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=i2tnZ/fm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rcps45Nq8z1ygF for ; Sat, 2 Sep 2023 06:04:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BC9F8678A; Fri, 1 Sep 2023 22:04:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="i2tnZ/fm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 92D068675B; Fri, 1 Sep 2023 22:04:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D55CC866CF for ; Fri, 1 Sep 2023 22:04:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fe32016bc8so24145465e9.1 for ; Fri, 01 Sep 2023 13:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693598652; x=1694203452; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cLt/k2jfppd558tZuRkQGTwbhBX5TEWbxVq56iIr2Oo=; b=i2tnZ/fmTHAMl7g2wcJ9j2SQHJpQfp2cCWQWOD480+Pzl9BY7wHTLFLmCQuVh5dNK9 Oz5+mbMaD9M01rCAhMR+6MIyJH/SiHn4X7aE0k0y4Yzw+nGIv9K53NA2BFmchZ9jmLZ/ df/sYTSp7Flf5krrv0/Q3/s0xkZ4dyAuoB98sR8SxxasXISf2ZDzp33RL0P274BpdjjO N21cZERvZI3LssgCTKFrE9en8/oDHlJ5nf5L6lfANaPPD99rnFmM5+lAJgJ05APKEskH I5BE3lw2n2oi/iKz7mznnA4pxOXL0Z7ELZg37SQ1mh5J0c4pW9yp23Lvz9ejpXKwSyOB PyMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693598652; x=1694203452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cLt/k2jfppd558tZuRkQGTwbhBX5TEWbxVq56iIr2Oo=; b=U4Z8SHpiKempCXDUk+vDVfSJqZKO5o27TxHgBN4qjHp9Bb2OLtB+ISqI489dZyGa50 yKv/GTMWMk1P9FD1rgcERmQTgprWVgSLOluxiTjJ/+HqSQ9HOPyV6VGTfSURe318Xpa8 GT448g1OiyBT+p/1SwGw0lENxHZYnwt2EGezr5QJcrUH6QI3Gu+Knet3FrObRy96eD/S l9YAT2ZT05H3oq6hhTuFNaYq7Y+gIVCKLJWGT4V97kzttpsA6hCMnSL1QusKP5bpzCY2 IcKiiHbtXtHWiAm5qJBduV+NhFDbCu5Xx8bW9HWjrU1lYxmp1/ivZmY/v7/oSlS+Hfuu i6ZA== X-Gm-Message-State: AOJu0Yw+iPjBfh7MYXiK404+8qyn+nbbwRO1x+P6qux8gDL3Mxs2+UDE T/42d9HW0ofHXfD0uQynEeE0mjzUysh4bRRX X-Google-Smtp-Source: AGHT+IGyGQhf713wckKuctaKOXoQexRbA+3WjluTqaXMEZPHxUk9aVQIutWPdGdw+chPkgYyiTEs7g== X-Received: by 2002:adf:f144:0:b0:317:648c:3895 with SMTP id y4-20020adff144000000b00317648c3895mr2537045wro.33.1693598651801; Fri, 01 Sep 2023 13:04:11 -0700 (PDT) Received: from fedora.. (cust-west-par-46-193-56-152.cust.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id l4-20020adffe84000000b003176eab8868sm6207849wrr.82.2023.09.01.13.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:04:11 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v2 1/6] scripts: Port Linux's gen_compile_commands.py to U-Boot Date: Fri, 1 Sep 2023 22:03:48 +0200 Message-ID: <20230901200353.90290-2-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230901200353.90290-1-jmcosta944@gmail.com> References: <20230901200353.90290-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This script generates a database of compiler flags, namely compile_commands.json. It is quite useful for text editors that use clangd LSP (e.g. Vim, Neovim). It was ported from Linux's sources: - tag: v6.4 - revision 6995e2de6891c724bfeb2db33d7b87775f913ad1 Modifications for U-Boot compatibility will be added in a follow-up commit. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 228 ++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100755 scripts/gen_compile_commands.py diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py new file mode 100755 index 0000000000..15ba56527a --- /dev/null +++ b/scripts/gen_compile_commands.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) Google LLC, 2018 +# +# Author: Tom Roeder +# +"""A tool for generating compile_commands.json in the Linux kernel.""" + +import argparse +import json +import logging +import os +import re +import subprocess +import sys + +_DEFAULT_OUTPUT = 'compile_commands.json' +_DEFAULT_LOG_LEVEL = 'WARNING' + +_FILENAME_PATTERN = r'^\..*\.cmd$' +_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' +_VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] +# The tools/ directory adopts a different build system, and produces .cmd +# files in a different format. Do not support it. +_EXCLUDE_DIRS = ['.git', 'Documentation', 'include', 'tools'] + +def parse_arguments(): + """Sets up and parses command-line arguments. + + Returns: + log_level: A logging level to filter log output. + directory: The work directory where the objects were built. + ar: Command used for parsing .a archives. + output: Where to write the compile-commands JSON file. + paths: The list of files/directories to handle to find .cmd files. + """ + usage = 'Creates a compile_commands.json database from kernel .cmd files' + parser = argparse.ArgumentParser(description=usage) + + directory_help = ('specify the output directory used for the kernel build ' + '(defaults to the working directory)') + parser.add_argument('-d', '--directory', type=str, default='.', + help=directory_help) + + output_help = ('path to the output command database (defaults to ' + + _DEFAULT_OUTPUT + ')') + parser.add_argument('-o', '--output', type=str, default=_DEFAULT_OUTPUT, + help=output_help) + + log_level_help = ('the level of log messages to produce (defaults to ' + + _DEFAULT_LOG_LEVEL + ')') + parser.add_argument('--log_level', choices=_VALID_LOG_LEVELS, + default=_DEFAULT_LOG_LEVEL, help=log_level_help) + + ar_help = 'command used for parsing .a archives' + parser.add_argument('-a', '--ar', type=str, default='llvm-ar', help=ar_help) + + paths_help = ('directories to search or files to parse ' + '(files should be *.o, *.a, or modules.order). ' + 'If nothing is specified, the current directory is searched') + parser.add_argument('paths', type=str, nargs='*', help=paths_help) + + args = parser.parse_args() + + return (args.log_level, + os.path.abspath(args.directory), + args.output, + args.ar, + args.paths if len(args.paths) > 0 else [args.directory]) + + +def cmdfiles_in_dir(directory): + """Generate the iterator of .cmd files found under the directory. + + Walk under the given directory, and yield every .cmd file found. + + Args: + directory: The directory to search for .cmd files. + + Yields: + The path to a .cmd file. + """ + + filename_matcher = re.compile(_FILENAME_PATTERN) + exclude_dirs = [ os.path.join(directory, d) for d in _EXCLUDE_DIRS ] + + for dirpath, dirnames, filenames in os.walk(directory, topdown=True): + # Prune unwanted directories. + if dirpath in exclude_dirs: + dirnames[:] = [] + continue + + for filename in filenames: + if filename_matcher.match(filename): + yield os.path.join(dirpath, filename) + + +def to_cmdfile(path): + """Return the path of .cmd file used for the given build artifact + + Args: + Path: file path + + Returns: + The path to .cmd file + """ + dir, base = os.path.split(path) + return os.path.join(dir, '.' + base + '.cmd') + + +def cmdfiles_for_a(archive, ar): + """Generate the iterator of .cmd files associated with the archive. + + Parse the given archive, and yield every .cmd file used to build it. + + Args: + archive: The archive to parse + + Yields: + The path to every .cmd file found + """ + for obj in subprocess.check_output([ar, '-t', archive]).decode().split(): + yield to_cmdfile(obj) + + +def cmdfiles_for_modorder(modorder): + """Generate the iterator of .cmd files associated with the modules.order. + + Parse the given modules.order, and yield every .cmd file used to build the + contained modules. + + Args: + modorder: The modules.order file to parse + + Yields: + The path to every .cmd file found + """ + with open(modorder) as f: + for line in f: + obj = line.rstrip() + base, ext = os.path.splitext(obj) + if ext != '.o': + sys.exit('{}: module path must end with .o'.format(obj)) + mod = base + '.mod' + # Read from *.mod, to get a list of objects that compose the module. + with open(mod) as m: + for mod_line in m: + yield to_cmdfile(mod_line.rstrip()) + + +def process_line(root_directory, command_prefix, file_path): + """Extracts information from a .cmd line and creates an entry from it. + + Args: + root_directory: The directory that was searched for .cmd files. Usually + used directly in the "directory" entry in compile_commands.json. + command_prefix: The extracted command line, up to the last element. + file_path: The .c file from the end of the extracted command. + Usually relative to root_directory, but sometimes absolute. + + Returns: + An entry to append to compile_commands. + + Raises: + ValueError: Could not find the extracted file based on file_path and + root_directory or file_directory. + """ + # The .cmd files are intended to be included directly by Make, so they + # escape the pound sign '#', either as '\#' or '$(pound)' (depending on the + # kernel version). The compile_commands.json file is not interepreted + # by Make, so this code replaces the escaped version with '#'. + prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#') + + # Use os.path.abspath() to normalize the path resolving '.' and '..' . + abs_path = os.path.abspath(os.path.join(root_directory, file_path)) + if not os.path.exists(abs_path): + raise ValueError('File %s not found' % abs_path) + return { + 'directory': root_directory, + 'file': abs_path, + 'command': prefix + file_path, + } + + +def main(): + """Walks through the directory and finds and parses .cmd files.""" + log_level, directory, output, ar, paths = parse_arguments() + + level = getattr(logging, log_level) + logging.basicConfig(format='%(levelname)s: %(message)s', level=level) + + line_matcher = re.compile(_LINE_PATTERN) + + compile_commands = [] + + for path in paths: + # If 'path' is a directory, handle all .cmd files under it. + # Otherwise, handle .cmd files associated with the file. + # built-in objects are linked via vmlinux.a + # Modules are listed in modules.order. + if os.path.isdir(path): + cmdfiles = cmdfiles_in_dir(path) + elif path.endswith('.a'): + cmdfiles = cmdfiles_for_a(path, ar) + elif path.endswith('modules.order'): + cmdfiles = cmdfiles_for_modorder(path) + else: + sys.exit('{}: unknown file type'.format(path)) + + for cmdfile in cmdfiles: + with open(cmdfile, 'rt') as f: + result = line_matcher.match(f.readline()) + if result: + try: + entry = process_line(directory, result.group(1), + result.group(2)) + compile_commands.append(entry) + except ValueError as err: + logging.info('Could not add line from %s: %s', + cmdfile, err) + + with open(output, 'wt') as f: + json.dump(compile_commands, f, indent=2, sort_keys=True) + + +if __name__ == '__main__': + main() From patchwork Fri Sep 1 20:03:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1828983 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=b7lZEhun; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcpsG3nznz1ygF for ; Sat, 2 Sep 2023 06:04:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D27DF867DE; Fri, 1 Sep 2023 22:04:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b7lZEhun"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A1DFB867B6; Fri, 1 Sep 2023 22:04:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 149D586703 for ; Fri, 1 Sep 2023 22:04:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-401b393ddd2so24509155e9.0 for ; Fri, 01 Sep 2023 13:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693598653; x=1694203453; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e7hb2jrvivQxON1XeovwgMxiW+RYRxZdLPP3zp29do4=; b=b7lZEhunMAFsxLlqLLTDAPaRQYxCOQFC9BTrWX7WBbNhXXKMrBb+zkmqSIpLLpU67N qv6BAT61BOSoSkOlwGCfmjgZtlN8HESWpsDAZ/dZVbGMnpR9k4EdJGx8cugym0UtS0aM Y623MARbnGsjEgBWtDZ29jh83EV0awdDT+stmveA+VN1GFvqoq8pJo6skcAX3HOPtWP+ 89Q2Qpwr6KP058JDcxp7kRr1a4bQzGNPS/QHkicGnXo+ULE966Ow+8YsIhAmtiwWAXUz 7QiGu4p5HRPD6WfmPSUx0uK6zv+Zp0eU0QrcdXHld3uEgCEId3HBQPrMb0IR7wpNtGw6 ih0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693598653; x=1694203453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e7hb2jrvivQxON1XeovwgMxiW+RYRxZdLPP3zp29do4=; b=kTMsfiv/pokSy5CfwY0CicL4SlHsP5CnQdRoY5Bq0N7KN+gMxTl2Ysifssfu6E7p/d ZrMppojgNls4kkA8mfQp8yfbeqvmeO4LN+dZzrB1ShSBO2ZLVgmEj7lnIzX3CBpETZaa xoYg2BnzS0DIURaqNb7JQVu6vvnu4Skq9iMdPqOeKjWyG5+J5ADKXjTvgfrT6pyq+3Cr ivNnyBst/26qbq7bjVNC2OHN3Y6DzK+wc9zDSIqwA7zfwLYfYLouLSgZ5LtKS4sFB22B w6SNcRGOful6z8pEsiMyuw8cvAqGbOpnFHEDPnpK0XyHFd2sTPbtAIB+CFKDnIEe4RIh j7Qg== X-Gm-Message-State: AOJu0YwET2sfZybQblR8Uj2GBv0Vx4BMDx56iQXEmniqpQ3gFblv2uQX joTfzd0Xc6uxaody7xENWXlAfQyRkDB1CVp/ X-Google-Smtp-Source: AGHT+IHOlw7VPOOt6YxeLgZiLHhEQYkhOgM6Kqcl2nLqknKIngnBSW9iOzZvX9zqwD6bsf4pRNkmiQ== X-Received: by 2002:adf:e48c:0:b0:317:6314:96e2 with SMTP id i12-20020adfe48c000000b00317631496e2mr2604678wrm.14.1693598653013; Fri, 01 Sep 2023 13:04:13 -0700 (PDT) Received: from fedora.. (cust-west-par-46-193-56-152.cust.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id l4-20020adffe84000000b003176eab8868sm6207849wrr.82.2023.09.01.13.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:04:12 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v2 2/6] scripts/gen_compile_commands.py: adapt _LINE_PATTERN Date: Fri, 1 Sep 2023 22:03:49 +0200 Message-ID: <20230901200353.90290-3-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230901200353.90290-1-jmcosta944@gmail.com> References: <20230901200353.90290-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean For U-Boot's context, the regular expression defined by _LINE_PATTERN should be adapted. Replace 'savedcmd' by 'cmd'. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 15ba56527a..0227522959 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -19,7 +19,7 @@ _DEFAULT_OUTPUT = 'compile_commands.json' _DEFAULT_LOG_LEVEL = 'WARNING' _FILENAME_PATTERN = r'^\..*\.cmd$' -_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' +_LINE_PATTERN = r'^cmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' _VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] # The tools/ directory adopts a different build system, and produces .cmd # files in a different format. Do not support it. From patchwork Fri Sep 1 20:03:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1828984 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=lRq/IdNh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcpsS3LcDz1ygF for ; Sat, 2 Sep 2023 06:04:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2675686741; Fri, 1 Sep 2023 22:04:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lRq/IdNh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1663E867F7; Fri, 1 Sep 2023 22:04:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2A51186725 for ; Fri, 1 Sep 2023 22:04:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-31de47996c8so2042634f8f.2 for ; Fri, 01 Sep 2023 13:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693598654; x=1694203454; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Msrb6/nmtExFC8B0sHWpf3s96bn/pi+WsRWwEFGprnc=; b=lRq/IdNhSmuzz8CxzcWk5NQvB1jP5nhGEkMZiZ4THDs4D2cGWERuOG1LGe4XbiS24m wEzty1xhSSmQu8bIhDmbqbHx5BhvlBZw2xcOj5CF9ZSBEOwWqNU15MCJ49nQ7F3iHWSw MNhqvaHAqMOFsU13bSUNk8Q2RMhb+NEe7IaF4efe+73qMr2aUOvaPzdC+JXVyK/QaDWC X/1ptJOHZoVEj8drXKTUM3a49ym0lzJL/Ie28XfGUHDldqeoc7fNYYVkEGQkQPq6Bl6c EPJhmajJA6NOnaCq41QO1CeORw+w+Yjsc9A2SHHE1vdES8Xlb/1bnxtwrAwNlUveydm4 4Hpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693598654; x=1694203454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Msrb6/nmtExFC8B0sHWpf3s96bn/pi+WsRWwEFGprnc=; b=K8iYl50afjgUoOa2yZiiv6E2+WjhYZ89DjN2nLCl3GKfHsETJMsMMnfoaszqKeZRqm iK2bE2fKZywaIoLPAJeHBTlp2IswWfXSHrFMWszYuzLMwoSamz1Y0Haavcs6dBF7Fkf4 uxGBbCwtpe6DgDReeeadudtLZ+pohcHs7k6o7zTc169VwcY4R6fdZwolf9DeuSDHgLuz yCcdHfduOReRyyp95b2APMi/ZX/oULBTq+sg4nJtk013WWW+KEplLek1XaJLO/OKEpVI CGM5DpruHIxp6yhftBSmmRk3d/YgDGVT/I+Gtp0Ja8l6xVdJwKAwCT6hbPnhUzgJauht 5X1A== X-Gm-Message-State: AOJu0Yx1/IFzanFCM6mWHOcj34uQFpbTTao/z8D95wTjqCyBlFaIvcKJ jnidQy1hHASdWCV9oHSqKrAKp3cCqmxbdGkc X-Google-Smtp-Source: AGHT+IFqqA86EGml0+nezosNEK4ssAlOkaClPKpr01nJg389fpqGLaXiUtKjxlDdXtTi3IT9ChhmSw== X-Received: by 2002:adf:de0f:0:b0:319:7788:5027 with SMTP id b15-20020adfde0f000000b0031977885027mr2826896wrm.59.1693598654417; Fri, 01 Sep 2023 13:04:14 -0700 (PDT) Received: from fedora.. (cust-west-par-46-193-56-152.cust.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id l4-20020adffe84000000b003176eab8868sm6207849wrr.82.2023.09.01.13.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:04:14 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v2 3/6] scripts/gen_compile_commands.py: fix docstring Date: Fri, 1 Sep 2023 22:03:50 +0200 Message-ID: <20230901200353.90290-4-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230901200353.90290-1-jmcosta944@gmail.com> References: <20230901200353.90290-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The referred tool is now in U-Boot. Replace "the Linux kernel" by "U-Boot" to make the docstring coherent. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 0227522959..63d036a773 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -5,7 +5,7 @@ # # Author: Tom Roeder # -"""A tool for generating compile_commands.json in the Linux kernel.""" +"""A tool for generating compile_commands.json in U-Boot.""" import argparse import json From patchwork Fri Sep 1 20:03:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1828985 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=GOFjEFxG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rcpsf3ZgLz1ygF for ; Sat, 2 Sep 2023 06:04:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C3E8F8676C; Fri, 1 Sep 2023 22:04:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GOFjEFxG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3326B86758; Fri, 1 Sep 2023 22:04:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9116286795 for ; Fri, 1 Sep 2023 22:04:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-401da71b7faso24475395e9.2 for ; Fri, 01 Sep 2023 13:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693598656; x=1694203456; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nquaMTUkKEj9f0VDmD18sTp9HY+/Vhfo0qP8M2hbUps=; b=GOFjEFxGPH+KYJsQ5mX0sYe4dhTSTGoJwbj19Q0yJ8wEhFEHQjqN4mdXeHZFKYYhO+ deYAI16nnKidAiRHm4Ru7DOdsZ6Tb/uFS9vEEGHjLBBpi2Xuw1gYmmbe/yEWZJRrNjcr b0SnnxeAckm1NA8P0NdQSjvz+nLtqI1b1mPEUIZA+oA3MPgxMx07AZDPzny0N6Yyasnu 5ctzyFWByKzchVVyjHNFbh37KC6ZvYNnpo4CXXistcIaxh8INiw06kOEhNIB1M6tnyVM tlk2961KSjAbWoO2LeKa9jOYtgrT6BIFzTu4GZTfz9YVoCxgGlhHpitRtG/ngdAMAgAn WT8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693598656; x=1694203456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nquaMTUkKEj9f0VDmD18sTp9HY+/Vhfo0qP8M2hbUps=; b=R+JMR85FusjIb/9xMnFDgb7l/ro8NqLBOEWcGzLEmp+hwm0YwAs7qwao7LqxEpaEmx muMKv5jP1kQVAmdIicPONMzHQ9mcrgZj329vvb+uk2xlkOgfw9QwjRrK/RHvW9xiQOzz F0vam36kLCUqZJhqpQ11AbzwHBzwKlUGpO2FbsjbNRMjnQ4/3jC/hV0LBbpQgDfNZWG3 Ple9nN6aXbEmOirwM/7I4N9FdTGY+R71toTrRUa9IK/+2zn6X2o1gm6SbX4jkahU5+/Z ie88+FWUgSTXtFtYLrTX0191/+waSfGa6Q+EtCHkruX3AdLsbj6C9fs/2uZWDbQOHGpE TLtg== X-Gm-Message-State: AOJu0YySSb8Zguh9FaAeM/vgYRASar7S/huJ8WsMFFl02K/nbJe+5GHe /Ktfmt3uZug2j8REZ3JdKO7TORd7Xu579rn1 X-Google-Smtp-Source: AGHT+IFhZxf7YmwXP3NVvXBCyFueTyrVrfChLo6Wk0krZK4dMkWFMiTRsIPmqBzjTTgR1JR6qXlCkw== X-Received: by 2002:adf:ebcd:0:b0:313:eaf5:515 with SMTP id v13-20020adfebcd000000b00313eaf50515mr2498452wrn.6.1693598655828; Fri, 01 Sep 2023 13:04:15 -0700 (PDT) Received: from fedora.. (cust-west-par-46-193-56-152.cust.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id l4-20020adffe84000000b003176eab8868sm6207849wrr.82.2023.09.01.13.04.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:04:15 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v2 4/6] scripts/gen_compile_commands.py: add acknowledgments Date: Fri, 1 Sep 2023 22:03:51 +0200 Message-ID: <20230901200353.90290-5-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230901200353.90290-1-jmcosta944@gmail.com> References: <20230901200353.90290-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add acknowledgments for porting and modifying the script. Of course, the license, author, and copyright notice remain the same as in the original script. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 63d036a773..1a9c49b34a 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -4,6 +4,7 @@ # Copyright (C) Google LLC, 2018 # # Author: Tom Roeder +# Ported and modified for U-Boot by Joao Marcos Costa # """A tool for generating compile_commands.json in U-Boot.""" From patchwork Fri Sep 1 20:03:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1828986 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Xrsa1hW9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rcpsr48dhz1yfm for ; Sat, 2 Sep 2023 06:05:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 10B9C866CF; Fri, 1 Sep 2023 22:04:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xrsa1hW9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C01B8675B; Fri, 1 Sep 2023 22:04:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B64F5867C3 for ; Fri, 1 Sep 2023 22:04:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3110ab7110aso2039562f8f.3 for ; Fri, 01 Sep 2023 13:04:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693598657; x=1694203457; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7/rN6hpA6RUR8xcynsTbN4wgdal1KH5zv5tVJu4j/8A=; b=Xrsa1hW9QDylK58UM3Kq5h9R2e0+KmMUHuN4+X8kcPf9i+28tGpZOZ9vhtXFPmAbSt rIHbWDa+N9fioVonRSu0jW/X+BrQ09lIyLUb1pxBcGfyqsSOI1Q+eglFnGe6H2UbCLuH slnMF4aGNf5PIBv/NokigRs3K3w8SMP70t9y6heXgXrT+RSJjtmSx2BX4bQILEzs0xtO +0RBArOotCcZ4OvbpjIhNeEPZWxOKD1SlA0wbXe9DFgmnlioyf3xOLgatcTK296c4VCR O8mm4oe08eyl0DwIA8KRF5Jv5oWcr99kiMZe3DJcfQ/9OgXSq6rOi/gfx8TccQSeOMzq 3zrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693598657; x=1694203457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7/rN6hpA6RUR8xcynsTbN4wgdal1KH5zv5tVJu4j/8A=; b=O4ywYQMAM85YXOuDw1ArT0KHc1m5oTBXpvFAxUgIbzyGsM1GiSNK/tedhBB/5iJg+g DnJwdunhlfwBPBTBsH8fI02barOzYfQQ/eSuL1k00zaAs2XiqT57kN1rSCsG2YgijL+9 zR261AL2/EUu2BpsPWw1HhK8yafFqGjhlw3yWVDsjgWV5mUtaCtjlrYmLgYFlnYLcD8N g/dqHL3KhHifc+sAzLxVeAVV2bIJxWoomWsWDLlwN6zvPzxyf2E1+OnfApb9Mn1Zri0v ca12zCFEK18L35pSSfve8CVvXQIVY+6LfZQejMo9brSgNT40uyOJls1vOpDXPOMo9hDB 9I3A== X-Gm-Message-State: AOJu0Yx788S6Esu4c8TKUYBRYPWtjnH6YRbD8qb+u0qbNQIvZwdu7ryS oTr9o3KXnPf97Xm0LLTImDgNcElWuWk3CRN6 X-Google-Smtp-Source: AGHT+IHHYaK+2olip5ZQujXX6CV+4Wry2TEBU6rSnexf8msxHGfAuemJ9h2P5s67ZRRBoxHn31fXQA== X-Received: by 2002:adf:e50e:0:b0:319:6e3f:d5f0 with SMTP id j14-20020adfe50e000000b003196e3fd5f0mr2599476wrm.44.1693598656960; Fri, 01 Sep 2023 13:04:16 -0700 (PDT) Received: from fedora.. (cust-west-par-46-193-56-152.cust.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id l4-20020adffe84000000b003176eab8868sm6207849wrr.82.2023.09.01.13.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:04:16 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v2 5/6] .gitignore: add compile_commands.json Date: Fri, 1 Sep 2023 22:03:52 +0200 Message-ID: <20230901200353.90290-6-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230901200353.90290-1-jmcosta944@gmail.com> References: <20230901200353.90290-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add Clang's compilation database file (i.e. compile_commands.json) to .gitignore, at the root of the repository. Signed-off-by: Joao Marcos Costa --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 002f95de4f..261a1d6754 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,6 @@ __pycache__ # moveconfig database /moveconfig.db + +# Clang's compilation database file +/compile_commands.json From patchwork Fri Sep 1 20:03:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1828987 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=jB1cTBmr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rcpt35VsRz1yZs for ; Sat, 2 Sep 2023 06:05:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 585D186758; Fri, 1 Sep 2023 22:04:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jB1cTBmr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F85686177; Fri, 1 Sep 2023 22:04:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D2324866CF for ; Fri, 1 Sep 2023 22:04:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-401ec23be82so24697665e9.0 for ; Fri, 01 Sep 2023 13:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693598658; x=1694203458; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vRHl9oAo6l8JVVaT8sveDVJX5sNbE+Ajq4cagCw2jv8=; b=jB1cTBmrQ2WUI9p1o5IwrPE25MiKYdQ/GQt56wXDTFdF9mlcPb1twjIwRsvEPn8SFt TLb0PM127AwHvmTAoiVIcBLmOjV7JtI/bJmLhCk5dBtqLkhEcSB1rUSC7wbj9lx8foNI EO3HoyEdTpzV5q+WC/PDuMvVCbRX39B9O3yVOjW0gKbmEl3jKyO5Mz5ELu+ySwH3rW/F ubfz5NT2M6UES5HmaXkbRA9x2uKMNpS/Me7WMbYHE2abGmQpPXK0lJxzxkJWD51oXAh1 05vQizcVAEYTvOC5LOU3HzMPwBOwd+dTKGdJr7tRWxUp+d+gfiTJF09N3mCxUxspsSzx WUTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693598658; x=1694203458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vRHl9oAo6l8JVVaT8sveDVJX5sNbE+Ajq4cagCw2jv8=; b=c06juSR4chGybvMBb065eL4GZaB/RWrQZQfS+1Zn2gpjMVtUCXkl/v3Gqy6XfrNahZ ThBZPGH/b3pSo04dc/Q7s4dJmZvWgLwBw9mv7R+4ymV3RxFOajLPu3zOxUefo5gYNFIU dK7FggMy2lnq5DDoGCmzUMN9FetGmbnCo63VEkIjZo9smgMpEe2eeH2fHullWdV5LLbn Y13QQNwCU2oLjx7rmJ7NFl4PW+mgF/ePasGRldpj43N4PzTmWB4bq3lCQxovgBiqQeMB ntSmvd5YgWN6jhaob7f1+0ebt8bEnV9feAmzIP1/f0Kc/+xmB+kv6Q5ZiR+izyGDUQUv yMGQ== X-Gm-Message-State: AOJu0YzyE/9upHTw7s1tXwKGPl5wq56b0xILWv+C5kN5RQUp1mjF2uk/ 8GJCxIDPyXD0AZ+31nw6TxdMh9RWYyw/wwPy X-Google-Smtp-Source: AGHT+IF3S80eNwycRP7+yMBIKD0Vkd58fR7t8xsY8AK5gcT+jYHLOkNzPea6A2K2UtrAp1v2zdwIvg== X-Received: by 2002:adf:f691:0:b0:317:6fb5:bafc with SMTP id v17-20020adff691000000b003176fb5bafcmr2557458wrp.65.1693598658016; Fri, 01 Sep 2023 13:04:18 -0700 (PDT) Received: from fedora.. (cust-west-par-46-193-56-152.cust.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id l4-20020adffe84000000b003176eab8868sm6207849wrr.82.2023.09.01.13.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:04:17 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v2 6/6] doc: add documentation for gen_compile_commands.py Date: Fri, 1 Sep 2023 22:03:53 +0200 Message-ID: <20230901200353.90290-7-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230901200353.90290-1-jmcosta944@gmail.com> References: <20230901200353.90290-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This documentation briefly explains what is a compilation database, and how to use the script to generate one. This is not a portage, as there was no original documentation in the Linux sources. Acknowledge the documentation in the script's header. Signed-off-by: Joao Marcos Costa --- doc/develop/gen_compile_commands.rst | 46 ++++++++++++++++++++++++++++ scripts/gen_compile_commands.py | 1 + 2 files changed, 47 insertions(+) create mode 100644 doc/develop/gen_compile_commands.rst diff --git a/doc/develop/gen_compile_commands.rst b/doc/develop/gen_compile_commands.rst new file mode 100644 index 0000000000..09466938fe --- /dev/null +++ b/doc/develop/gen_compile_commands.rst @@ -0,0 +1,46 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +========== +gen_compile_commands +========== + +gen_compile_commands (scripts/gen_compile_commands.py) is a script used to +generate a compilation database (compile_commands.json). This database consists +of an array of "command objects" describing how each translation unit was +compiled. + +Example:: + + { + "command": "gcc -Wp,-MD,arch/x86/cpu/.lapic.o.d -nostdinc -isystem (...)" + "directory": "/home/jmcosta/u-boot", + "file": "/home/jmcosta/u-boot/arch/x86/cpu/lapic.c" + } + +Such information comes from parsing the respective .cmd file of each translation +unit. In the previous example, that would be `arch/x86/cpu/.lapic.o.cmd`. + +The compilation database is quite useful for text editors (and IDEs) that use +Clangd LSP. It allows jumping to definitions and declarations. Since it relies +on parsing .cmd files, one needs to have a target (e.g. configs/*_defconfig) +built before running the script. + +Example:: + + make sandbox_defconfig + make + ./scripts/gen_compile_commands.py + +The database will be in the root of the repository. No further modifications are +needed for it to be usable by the LSP, unless you set a name for the database +other than it's default one (compile_commands.json). + +Options +======= + +For further details on how to use the script and its options, please refer to +its help message, as in the example below. + +Help:: + + ./scripts/gen_compile_commands.py --help diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 1a9c49b34a..f0c6bafdc5 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -5,6 +5,7 @@ # # Author: Tom Roeder # Ported and modified for U-Boot by Joao Marcos Costa +# Briefly documented at doc/develop/gen_compile_commands.rst # """A tool for generating compile_commands.json in U-Boot."""