From patchwork Sun Oct 1 10:00:29 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: 1841702 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=20230601 header.b=CVTqC/Yq; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rz03C11gxz1yp0 for ; Sun, 1 Oct 2023 21:01:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F45A870AF; Sun, 1 Oct 2023 12:00:50 +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="CVTqC/Yq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD64F870AB; Sun, 1 Oct 2023 12:00:48 +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-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 A031A8707C for ; Sun, 1 Oct 2023 12:00:46 +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-x433.google.com with SMTP id ffacd0b85a97d-31c5cac3ae2so14908919f8f.3 for ; Sun, 01 Oct 2023 03:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154446; x=1696759246; 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=CVTqC/Yq/UEt31KPCUksoUS9GiRqDM9SW+z9RaijKcxnKXHCc+gWZb3cSnNV6+4Giy 3ZqCbRltGH2EMyI8to8ZjRouare3RYYijsV4C4jCKpMta/exz2GGa8Dql54KxgPIpI67 3/uQ99O/oDT9jTW/0HmLJEGl5325zuwCl3RbJwfhGPE02ACiezZ30OgAIahdouBmD9/V IBpMEOv70qmn3woGdR/H/10TM5SFQr0/bNFrIZiPlh0TIul6DTqcfvae/XKerB7GHflE /7f8koiyAgFxG808jNlSjGGS64qtU2lFAjJBzqb51iZikhRrpY/KRJAxBpz4i9pRPuSZ Xvxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154446; x=1696759246; 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=CFKRZVv6U7jSuDLCKIshttWugmDR+24j1Zud0zOq31X8G2vv2rd8g8gT70Wixr5cIk fZT67gkNqofnxG0lxC6cw4k9aOZZ8bYDIgfHmntTev1cRipHtLsFOvbbJItp2POv9Gk+ p2EesXdrYuld6RCYgMKHYzEWHGkMOcnsZsMhd07wcYFBgwyyt9Hb0q0frpEEWzKKx8zD oJbPO+ojdYpcql2NPTANdSp8R3f2L0EpQSyZ+utzaEWqy38poQt5ymeKsa5XNkEKPGO3 mNHJ0SrkXsFVpT0D9ppIrocUyDl+s//l2TR7dVaK6KiABDKz6zmzpAMuEYVom0KL11nQ dTHA== X-Gm-Message-State: AOJu0YwH0Fx+xOI5pa3HLSnYgZs9Ji0aMwbr70HkgvDNjPKfmQFnRnFN JCh+b/Z2Q4pt7mfHfftSdqcShCyJYM+47fHC X-Google-Smtp-Source: AGHT+IEMxKPDUdX4brXpZc1GJ5rwxpgPg0Fy51FSa/gy1t7O44EJQL3YIsTCkkBbEEHqt0e9elRJOw== X-Received: by 2002:a5d:55d2:0:b0:31f:db15:e9d8 with SMTP id i18-20020a5d55d2000000b0031fdb15e9d8mr7834938wrw.3.1696154445411; Sun, 01 Oct 2023 03:00:45 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:44 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 1/8] scripts: Port Linux's gen_compile_commands.py to U-Boot Date: Sun, 1 Oct 2023 12:00:29 +0200 Message-ID: <20231001100036.34936-2-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 Sun Oct 1 10:00:30 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: 1841703 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=20230601 header.b=h1BPAI2E; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rz03H20Bnz1yp0 for ; Sun, 1 Oct 2023 21:01:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C9A65870B2; Sun, 1 Oct 2023 12:00:50 +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="h1BPAI2E"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 781B0870B0; Sun, 1 Oct 2023 12:00:49 +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-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 4F419870A4 for ; Sun, 1 Oct 2023 12:00:47 +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-x433.google.com with SMTP id ffacd0b85a97d-32157c8e4c7so15452210f8f.1 for ; Sun, 01 Oct 2023 03:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154446; x=1696759246; 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=h1BPAI2EK56GVTvHRb8kjUXu2AmBcHMSQOEMjx1QzRo138EaVCUCpioknd8fv4wk8v g3BuyWVhHhkLpn8abGXZSdeyIch80PL9OgQ4OAsKu3BfO9q3FNBRdC8xI6kXTPxCuri4 C+fLVh+rFQx4Cpoefd2nEBwH64ghAoOJ0OlZA+zx6YyhgOuDhUlOMLq20HhrvPmKwjFd b04O+myV3d436W6E/UzOQD4JSuZ7JCE7nknij/Oz4ItQrsZ0Nh06RTmEUmkbK/4W6Rf5 b38Yg2rNG+IHk8lBjI1Watlb4Ek5g7XIGmUaCGMAe1OF5yUjKf415o+YCeOVF3M18gHy FCdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154446; x=1696759246; 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=fpqXvtgs8QAYOOdbJxUv7SYtMif/rUQN6wg6m+ExF3ak3cojJg7rWn7dRrG2lEWtt5 Gw4TeFPZ1hsalhjKA/UoeIY5u77QPqngMrYBLqbG/PhzriZgpcmieAbsqqeyf9cPi/S7 LzUVR3QiaIB7prch4lOgflJNttGF0f5tHeMiETu/gOxLXLyV9fScphgAmnHbEapzY0O4 fHxTS7wcT2Jyl8y/cE4o8ceOWyzauCojFZdP98KBzAvO5xxoAmgnpqZIViA9rc7r8LJG kutp8VBUIlyvHHDFIBZ45p1X8UBVlLQAEy30xfABtd1gtm1laK/ePi1wGs0jxUr4a8uW bR7A== X-Gm-Message-State: AOJu0YzZLAL2aOvwVqOIqeigZg6JDSNrSAqRgCy5KY6EMi/kMTeE+B+y 8DN+Y8sicV/FrcmWyldYnlEhP9JEGrZ/wT8i X-Google-Smtp-Source: AGHT+IG9NAQIlnI6iBtqVSWtzZdlQQOR4aabP2QdX+oK/Y0NXmZ7m1Ui2rQ/udx2lCloN2Di8i2tOQ== X-Received: by 2002:adf:ea84:0:b0:321:6f5f:78ab with SMTP id s4-20020adfea84000000b003216f5f78abmr7065573wrm.56.1696154446258; Sun, 01 Oct 2023 03:00:46 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:45 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 2/8] scripts/gen_compile_commands.py: adapt _LINE_PATTERN Date: Sun, 1 Oct 2023 12:00:30 +0200 Message-ID: <20231001100036.34936-3-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 Sun Oct 1 10:00:31 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: 1841704 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=20230601 header.b=FU3XWffL; 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 4Rz03V0XSzz1yp0 for ; Sun, 1 Oct 2023 21:01:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C7AB870B9; Sun, 1 Oct 2023 12:00:51 +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="FU3XWffL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CFD1B870A7; Sun, 1 Oct 2023 12:00:49 +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 EE9DC86EFF for ; Sun, 1 Oct 2023 12:00:47 +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-3247d69ed2cso4932129f8f.0 for ; Sun, 01 Oct 2023 03:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154447; x=1696759247; 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=FU3XWffLsbXqURjK33l0e2u+/UoZi2QRwLxhZ/cgzfHSvV2O+DL2wi0/+tUdxFSgh8 NdK6S9kMr4Kr8F8MOOq61gfbjiQ1ESfj6k2yre90oJCxxL3pGZm69/44nPBg3RZdhNC5 6mmlMJF596L1KkRBmjdZb9RfiMK00QH+vYKltsj1g+c2+f9JI5o01ro686tkWGPGqAqK rqnIKM0zZmQsCck3v+Zza/SAl5UcPlmc8Xml5L958tWzJV0VAjtRFqKOxA3i4ZzWE9UA EjZz7u9jzHcJIHxhuuSLfc28K8TRsewDMtLjxTlyOvDdukyqs60VQBxUxLRYoJwx50vv 066g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154447; x=1696759247; 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=BijlbutQ0+OlsqVXia1lLXBT4Bem4p4UTU0vLmeCg47YnPN+JfGB3edg8Ogu8OTUVX Z9j7A4NIho+RxP16vUGC9FPvrbYmyfEUPgEblV3gu0rYfSoI+3doDJ95SlHECMNqrL7/ IIRV4o90QFSSirO9BiQ3K0W4Z0Z/O0h2QoCnvr87mi2DcgRS2klXaMWXpSGg6dVqd/w9 10oi7FIqHwVldtcegfjMkewqem/7iJqTkb2vewwGky4mtCxbZgpfSYYF7dj21Nf7H6hS zJgyQ8yHL+9r8ll82ExMCElL0fSFk1QfeIMNM+afXzLZhWQn5Dtl9mKN7dHtmkxppE9j YK4g== X-Gm-Message-State: AOJu0YzWRCX0zrdvt028+ljL13OCyu3p9PWc2wrrJ5vae9Yb0LTPQH6t fqC/QyeNdjNNWZGL9frwYDwsOmIcmrKMohBM X-Google-Smtp-Source: AGHT+IEF7lG0B0Yu9jM9wVVcfVnI/RJlEGgjpdF8AZErXXc5bMbOEH0Y8ZdxTYujfmLK1QzNZZK3UA== X-Received: by 2002:adf:de0a:0:b0:31f:fb5d:96da with SMTP id b10-20020adfde0a000000b0031ffb5d96damr7372499wrm.64.1696154446954; Sun, 01 Oct 2023 03:00:46 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:46 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 3/8] scripts/gen_compile_commands.py: fix docstring Date: Sun, 1 Oct 2023 12:00:31 +0200 Message-ID: <20231001100036.34936-4-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 Sun Oct 1 10:00:32 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: 1841705 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=20230601 header.b=EOtfyjgo; 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 4Rz03j2Ldzz1yp0 for ; Sun, 1 Oct 2023 21:01:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A51FB870C1; Sun, 1 Oct 2023 12:00:51 +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="EOtfyjgo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7CC41870B2; Sun, 1 Oct 2023 12:00:50 +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-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 5A5F6870A8 for ; Sun, 1 Oct 2023 12:00:48 +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-x430.google.com with SMTP id ffacd0b85a97d-32483535e51so3513857f8f.0 for ; Sun, 01 Oct 2023 03:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154447; x=1696759247; 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=EOtfyjgoD1GM/8aeiu5tncAxuSDurz0UVSzdkFWPjtmNXmCV6/ZxKDkXlSFgjclbTB nGwaRfJH4KfXIq4WyIbfIaJN/4CA4WTZ8QmwlJIDgSgKtyiAxwb9P4OUg5xI816p+SIT v5Nxljy60+VmiJGcaCkUT41R33TkThepT0/5f7qUssyuYFTib5tJ37mEP8Xs3rOMvWdf Ozzs4niM6aJ4Cfjax+2SC+DROez3CVmgx037anLekKTe/QaknPc1pSgREdemebHPIgBr xvOenATu7najNDZaZqOlhjxmMM9DFNN7piUvAPfrNA7OmHuqv2OGyggcWIq/eQg+NiL5 UvLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154447; x=1696759247; 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=dkCF0QDOHpl7FU+Ul9X1MGpbrmySQJT1imqMUV0HXvmdNrcpZGDxx84zmnPYYgJnWJ ZpYUOykNfVPd+e3ANJUd9TJwLh0NqE4G4n3IKLvY0a5q1h4+cihDg6jlC79LMjobmNI1 8c58q9CUqv6x2m70pt4B+06FBUvvZmnw01dDvk9lc/jP/bCjy2CZYU4HA3l5yjCGXn4c UlnSZEv+E059g5K7ZEy177hdSLZJ/K8jjOhGHVPY2rOAWYKowYOgpyMnNZ6YzumPp0OB jUrhKPaGTT9XWtS5UduSoPaiMhSlRHXguN3UO1dNiV/lrcqi2D+CmQXuK72IsKZUA9+6 bYfw== X-Gm-Message-State: AOJu0YwG+6Ch8VtiDzp2uIqbJ98NrUk+f82BTiufde0rXhpNgpR/mdOO TWBZMAEMpBAmY+qRD8lGND3A2Exsc+gmOlic X-Google-Smtp-Source: AGHT+IFRx6ZOsJzKwkPVsoqmTNKeBZ92rpMKsbCbJiGlV5falaZARlm6ojN+ZdKvWOfuig6ZLNwEmw== X-Received: by 2002:a5d:63cb:0:b0:319:6e3f:d5f0 with SMTP id c11-20020a5d63cb000000b003196e3fd5f0mr8307876wrw.44.1696154447574; Sun, 01 Oct 2023 03:00:47 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:47 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 4/8] scripts/gen_compile_commands.py: add acknowledgments Date: Sun, 1 Oct 2023 12:00:32 +0200 Message-ID: <20231001100036.34936-5-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 Sun Oct 1 10:00:33 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: 1841706 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=20230601 header.b=d4WSLwYz; 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 4Rz03v6NYtz1yp0 for ; Sun, 1 Oct 2023 21:01:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1563B870B7; Sun, 1 Oct 2023 12:00:54 +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="d4WSLwYz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D988870BB; Sun, 1 Oct 2023 12:00:51 +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-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 6E46B870AE for ; Sun, 1 Oct 2023 12:00:49 +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-x336.google.com with SMTP id 5b1f17b1804b1-405497850dbso136160235e9.0 for ; Sun, 01 Oct 2023 03:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154448; x=1696759248; 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=d4WSLwYzY0rczk17UHF7lgtnSHqrOgfhwDBpvkRoxRDuCXGDjun0GDuJ8xQKy8ZZP4 V3Za1vde/EQz6uXkU2RrzIyorYY4wktAN1TpwRqckBxE3VeSmk9klkcfITeVRNHJl+6i JdSCh/PshEXM1Bzun/LIZyAxQQOJ6WH/l79db0DfSHY1yNDmjNPL7USvOqhxrVgOVWJ0 lWXHDtVR/5X4o+7u//LyJICGbUsLQuMAXM4qgmZ9MV81xci0ErtcgDpSxjPx35q08p4M XMCwUiZiEdB2Isz8iM+dmbkEVuA85mXQ7imTuTR1+ToddS3Iv0kOxbCfHi4eb87d8nzG cLdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154448; x=1696759248; 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=cEOFqBOpyFcGkO6Oo79H1/RfKOt7lSeHncRbmlZB0C6IeuX/aCEI/3Xc9G4RTHYKaa zS4FAp2fyT4G8eWVbHUw0y4dXrTLxTMO38tdluf6Peo4WqbdeCLB1y9f3GxAmaWKsttQ +9Sm9e+eF1IOLZpAyzYesB19cXdomvHPQ01V3b+uZ+beQq0fRTfwujKVFVJ/p+5KJPt2 jIXSZMX8ulwmDyI3xetuvGwujrBMI6Yya64o2tW63A4RdMvfomQcjZ2FyEkMdtrI3rp4 OxCMub/Ovq7rMoAiMKDpqvU97w4mvaFQnxO+6VbMnMgQtENXSIcj2B7mQV9Nza+h9nHO v4sw== X-Gm-Message-State: AOJu0YwJsUF6XpJoIR+18Gn4IhUEYV7OLitimKFHPqfV+0U901aEkAvz TV6eDe9Fq3Ct+CnxbT3do/EGSRwUf2RCgZL0 X-Google-Smtp-Source: AGHT+IFXxjPkMxfQeit3xukWHz22VCZlDYbSWCX2EJq1iSHAsWjVvvsE+ejg+ssi/HmqpF8UEmiE7A== X-Received: by 2002:a5d:5384:0:b0:31f:fa61:961b with SMTP id d4-20020a5d5384000000b0031ffa61961bmr7376271wrv.66.1696154448489; Sun, 01 Oct 2023 03:00:48 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:47 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 5/8] .gitignore: add compile_commands.json Date: Sun, 1 Oct 2023 12:00:33 +0200 Message-ID: <20231001100036.34936-6-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 Sun Oct 1 10:00:34 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: 1841707 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=20230601 header.b=bHyHZD8g; 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 4Rz04572b6z1yp0 for ; Sun, 1 Oct 2023 21:01:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8CD60870BD; Sun, 1 Oct 2023 12:00:54 +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="bHyHZD8g"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 48433870C5; Sun, 1 Oct 2023 12:00:52 +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-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 ECF0C86EFF for ; Sun, 1 Oct 2023 12:00:49 +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-x42c.google.com with SMTP id ffacd0b85a97d-3232be274a0so1232418f8f.1 for ; Sun, 01 Oct 2023 03:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154449; x=1696759249; 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=DinrtiGbWU7IKwb73jTNgtGyClbqN6mTQj/gJa05yGg=; b=bHyHZD8gKk767/EqrmZwnKeC0uzFgy+fZnjqie+zPWSq5VmRDC+OH3TuEnQSIeeN1K uNOcnwqxxedJJSsH3F5Qvb6HwsoGbdt7fQC1ujBLqGPtP6XOQk+FG4IptJyyzjflorZ8 uwRs5fQZxcDq3SiD3qIciS5kuESJiNrZlzvDLOsvQC3TB1510KXR8FSPJN8erw4XfQZc PdNmdnCAPFIIPrj0RvUoZlw6bu8hqZrW0Mbk1/XKjBuHEUrX1QaJ5nUrCAFBF36mCfi2 S8pl4wrO/ErYDMLgvUycqG0VqSgQF2CUe2Do4RUKsuJEUfITSBzc1VnWoHI4djURC3BV vMvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154449; x=1696759249; 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=DinrtiGbWU7IKwb73jTNgtGyClbqN6mTQj/gJa05yGg=; b=bQY3RQkgx8JMqkeoSBLRh1jMmVk74igSkAd4F7T90FV8FNLTgDKqvWq8Bz83xZXV8N nnTCP6BczCckaPEHuzlhdMZYNSOQt20KWBt8IpMuVV8qomyT9EbQ6ORfEwS8x9Kal8bU C9OIKr+5MKOgtjIUdJoD99IQYe/NkN1Dj5i8ZzILV238jEc13u9URuRnywpvCMxscz73 40qQYN0gs4SeXkuT84VZP02cP46sc+vEw/VYw5cEorHsCUYFDDg7sfApIXe6mnHhJHoa EVN+YRKR9/rszywKg6mRMny8FwdxgrtkO2+V95YgK/+xihCqsKSeiIxAU4Cc3cQEN0m2 s/iQ== X-Gm-Message-State: AOJu0YwMzQwIXRdain98zuNAxdD1WXi6aCBG6RdfoeoPOeHxbiHJTQW9 Q1W6Kx4uqgt6OTeVd/z3Ukws917FpxNxOsBJ X-Google-Smtp-Source: AGHT+IGTmDziDr5RsV/M7u1u45wiSFM6AeIjT7O70UGO5QJC09I1Zrt9yLgo6EmAmUEqdF+EvUaSnw== X-Received: by 2002:a5d:4049:0:b0:323:3b45:c452 with SMTP id w9-20020a5d4049000000b003233b45c452mr7737698wrp.14.1696154449071; Sun, 01 Oct 2023 03:00:49 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:48 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 6/8] doc: add documentation for gen_compile_commands.py Date: Sun, 1 Oct 2023 12:00:34 +0200 Message-ID: <20231001100036.34936-7-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 and in doc/build index. Signed-off-by: Joao Marcos Costa --- doc/build/gen_compile_commands.rst | 83 ++++++++++++++++++++++++++++++ doc/build/index.rst | 1 + scripts/gen_compile_commands.py | 1 + 3 files changed, 85 insertions(+) create mode 100644 doc/build/gen_compile_commands.rst diff --git a/doc/build/gen_compile_commands.rst b/doc/build/gen_compile_commands.rst new file mode 100644 index 0000000000..50305cec4a --- /dev/null +++ b/doc/build/gen_compile_commands.rst @@ -0,0 +1,83 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +Create build database for IDEs +============================== + +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`. + +For more details on the database format, please refer to the official +documentation at https://clang.llvm.org/docs/JSONCompilationDatabase.html. + +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/xxx_defconfig) +built before running the script. + +Example:: + + make sandbox_defconfig + make + ./scripts/gen_compile_commands.py + +Beware that depending on the changes you made to the project's source code, you +may need to run the script again (presuming you recompiled your target, of +course) to have an up-to-date database. + +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). + +Compatible IDEs +=============== + +Several popular integrated development environments (IDEs) support the use +of JSON compilation databases for C/C++ development, making it easier to +manage build configurations and code analysis. Some of these IDEs include: + +1. **Visual Studio Code (VS Code)**: IntelliSense in VS Code can be set up to + use compile_commands.json by following the instructions in + https://code.visualstudio.com/docs/cpp/faq-cpp#_how-do-i-get-intellisense-to-work-correctly. + +2. **CLion**: JetBrains' CLion IDE supports JSON compilation databases out + of the box. You can configure your project to use a compile_commands.json + file via the project settings. Details on setting up CLion with JSON + compilation databases can be found at + https://www.jetbrains.com/help/clion/compilation-database.html. + +3. **Qt Creator**: Qt Creator, a popular IDE for Qt development, also + supports compile_commands.json for C/C++ projects. Instructions on how to + use this feature can be found at + https://doc.qt.io/qtcreator/creator-clang-codemodel.html#using-compilation-databases. + +4. **Eclipse CDT**: Eclipse's C/C++ Development Tools (CDT) can be + configured to use JSON compilation databases for better project management. + You can find guidance on setting up JSON compilation database support at the + wiki: https://wiki.eclipse.org/CDT/User/NewIn910#Build. + +For Vim, Neovim, and Emacs, if you are using Clangd as your LSP, placing the +compile_commands.json in the root of the repository should suffice to enable +code navigation. + +Usage +===== + +For further details on the script's options, please refer to its help message, +as in the example below. + +Help:: + + ./scripts/gen_compile_commands.py --help diff --git a/doc/build/index.rst b/doc/build/index.rst index 64e66491bd..7a4507b574 100644 --- a/doc/build/index.rst +++ b/doc/build/index.rst @@ -14,3 +14,4 @@ Build U-Boot tools buildman documentation + gen_compile_commands diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 1a9c49b34a..aa52e88e18 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/build/gen_compile_commands.rst # """A tool for generating compile_commands.json in U-Boot.""" From patchwork Sun Oct 1 10:00:35 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: 1841708 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=20230601 header.b=T1WRRfg3; 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 4Rz04K08BNz1yp0 for ; Sun, 1 Oct 2023 21:02:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D1F7870C5; Sun, 1 Oct 2023 12:00:55 +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="T1WRRfg3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F113D870C6; Sun, 1 Oct 2023 12:00:52 +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-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 1FAD8870B6 for ; Sun, 1 Oct 2023 12:00:51 +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-x430.google.com with SMTP id ffacd0b85a97d-3231df68584so11383580f8f.1 for ; Sun, 01 Oct 2023 03:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154450; x=1696759250; 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=UPo8gLq6xXDg/aiaGtn38iTgCitr6s5cc9aGJghK5Gk=; b=T1WRRfg3jI0FXuuwnkYp/69BnKBKgFe3QfgA2Vm6pgs1iw1LgX3OZAPwRN9fnoT+Gx 3qeRI3Sopw6xRCz8SNpiGFVHX0SfCaBcB4XMGcr1DEt9J5nP3LTpfbfj++uY6QJyY0AY d9epJHjq89VaTO5asf14J26kS276BIZSD/2Xm9CrYVzVZi+/Qq6QW3++0KnLFzrTEDeL VpbzVIRy9GXHq43uCXfyCItYbpf1gI5VyXYAwcxb7Lv3ggIkNBUQeN7o8wxyefysIt6e tC6muEfX27+rUzUzUMFjOx3qdlbxLNMiR+rTTkxEm6xZTaL9mF5RAzNKia2A5LJQ9OcG 5g5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154450; x=1696759250; 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=UPo8gLq6xXDg/aiaGtn38iTgCitr6s5cc9aGJghK5Gk=; b=ZPzPZ41tD1BBScAHuUNKq+YV7WtA3bXmIYfWRbUjonvXAg4UaWE5Gsl348P5N9UcfF omgU0T8GmCIIjEK7jFwuwinHvN8ryATrtSxTwtCbbHVpNnT/gu8CrbYKvYfKGKNVZYhb lskOqHWYOSWuwaC/M7qGoTzu3LnglEmfGq1YCngfUdwQBZl6rt+pmR2dz7mfTCAVCn+F Djjy4hq1cHdJXXeSgR1hDMMw665tm0Tu8AjSLItT0/FhetPnEfpi00ECsu9hrnoipiQk H4sSJuWymuwoUyIVxSbFft7efUMjEIUWMD9MOZxzWVE5XFyWj3LouA/WDAIEVF/IAJns x71w== X-Gm-Message-State: AOJu0YwaNyVxV5cP0gqBsLAMInjHesGULmOYQN7KrFTo99cYbm1pRSK5 /BauCp3QvxhNJXBokGdMupK2rKPedz2LbMXM X-Google-Smtp-Source: AGHT+IElBKu0jeapomOW6Pa0F1JGFpsDyIjZdpJTK2xAWMOuKTfpcHousXts4p7ZpWnoShjuHTUCVQ== X-Received: by 2002:a5d:4e8a:0:b0:324:885f:f806 with SMTP id e10-20020a5d4e8a000000b00324885ff806mr8633595wru.56.1696154450024; Sun, 01 Oct 2023 03:00:50 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:49 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 7/8] doc: add ide_integration.rst to doc/develop Date: Sun, 1 Oct 2023 12:00:35 +0200 Message-ID: <20231001100036.34936-8-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 'Integration with IDEs' chapter. For now, this chapter is mostly a reference to the documentation of gen_compile_commands, in doc/build, but it can be futurely used as a guide for other IDE-friendly features. Signed-off-by: Joao Marcos Costa --- doc/develop/ide_integration.rst | 12 ++++++++++++ doc/develop/index.rst | 1 + 2 files changed, 13 insertions(+) create mode 100644 doc/develop/ide_integration.rst diff --git a/doc/develop/ide_integration.rst b/doc/develop/ide_integration.rst new file mode 100644 index 0000000000..455e09959c --- /dev/null +++ b/doc/develop/ide_integration.rst @@ -0,0 +1,12 @@ +Integration with IDEs +===================== + +IDEs and text editors (e.g., VSCode, Emacs, Vim, Neovim) typically offer +plugins to enhance the development experience, such as Clangd LSP. These +plugins provide features like code navigation (i.e., jumping to definitions +and declarations), code completion, and code formatting. + +U-Boot provides a script (i.e., scripts/gen_compile_commands.py) that +generates a compilation database to be utilized by Clangd LSP for code +navigation. For detailed usage instructions, please refer to the script's +documentation: :doc:`../build/gen_compile_commands`. diff --git a/doc/develop/index.rst b/doc/develop/index.rst index 5b230d0321..272bdef84d 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -19,6 +19,7 @@ General security sending_patches system_configuration + ide_integration Implementation -------------- From patchwork Sun Oct 1 10:00:36 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: 1841709 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=20230601 header.b=E+ZOT1aC; 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 4Rz04V4dT9z1yp0 for ; Sun, 1 Oct 2023 21:02:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 75E4F870C6; Sun, 1 Oct 2023 12:00:55 +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="E+ZOT1aC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 39988870B7; Sun, 1 Oct 2023 12:00:53 +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 60B0C870BC for ; Sun, 1 Oct 2023 12:00:51 +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-40572aeb6d0so122337805e9.1 for ; Sun, 01 Oct 2023 03:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696154450; x=1696759250; 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=/1Zp1492jG7c7BEWQV1tYh/VpdeLbdjJOPPrKGl/hcM=; b=E+ZOT1aCCQs5/qaHhfoqvmelHqNJ6OuCxP3AfNJNY0yTsQjEGcgaGqp6aVJ95gUq0X G8ySiO1TJrpXYZd9nQcKEbJsAqVcGWL5XIVBDKoLZN4j9V/A3zTHVTAI7CG2dJUdU6io /jKsV0d9t+03gEmJxRZLQVZ5G7E6lRtfZZnfa3QKRIUKFeGs9yeNXXDUVl3MnsccHvtc RkloPMyDNn5D/6gYPkHMlGWk5ZaokIoKxfivcvxC6OpD5wYrP+ZGjIoDAF2Fcoelxqia yvsMNz/Qbm83CMD9NLRIm1fArxDzJ+O1ic6KOEC/05F4AZSXDysMROcK9+6/84EfJ8sX GqsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696154450; x=1696759250; 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=/1Zp1492jG7c7BEWQV1tYh/VpdeLbdjJOPPrKGl/hcM=; b=gzjVONssHl7GKncyjPE0ZDtZ7MLWDiY+mTmbYO5rO+zIKry1A7OODy/YV42BSGsnRR ItqlBnqdh8wJuBGFRVBvGuwiwtd7fmu6+Lc+b/uyFjsNDlQMItKU0wXL0EtLOlQiAudm SCwNFSFK9ivCW3ZXprj1yGPhuKmihLMIHx86oIf0T5ydfR970z6qJlPw4bhh+R6VrsLW xa+vVi0sjmnddqI+AKVVFxWCpxgX458cI0AqDiOJ+efjB3vybhNJrn8k6rmaWfFNnWjO qSf2ge3IVYjHJVWmsCIO3B2PGQkNufzdgPY6UxJEG0WJ7Ks0vOPZqzFCEV9QrY76mS1w B/IA== X-Gm-Message-State: AOJu0YxsWvPJbt7gL1v0aSnLd/0FxcjlqvywjOd5lhOy+9GnvY4yC5II UBjzze5k9PGqtirXFU+iO/dacxIN1IMZ6IrL X-Google-Smtp-Source: AGHT+IHd1ukdEFmIcAaUM8aGQeEDiyu7Y3MGYjCB27OyT8Ecm2rnw4vLuqCxnhmEDbte7iEscbd6oQ== X-Received: by 2002:a5d:4f8e:0:b0:320:aea6:abb9 with SMTP id d14-20020a5d4f8e000000b00320aea6abb9mr7719609wru.6.1696154450637; Sun, 01 Oct 2023 03:00:50 -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 g18-20020a5d5552000000b00326f5d0ce0asm3087135wrw.21.2023.10.01.03.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 03:00:50 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, Y.Moog@phytec.de, Joao Marcos Costa Subject: [PATCH v4 8/8] scripts/gen_compile_commands: fix usage message Date: Sun, 1 Oct 2023 12:00:36 +0200 Message-ID: <20231001100036.34936-9-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231001100036.34936-1-jmcosta944@gmail.com> References: <20231001100036.34936-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 Replace mentions to 'kernel' by 'U-Boot' to avoid confusion. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index aa52e88e18..cdca85e6b0 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -37,10 +37,10 @@ def parse_arguments(): 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' + usage = 'Creates a compile_commands.json database from U-Boot .cmd files' parser = argparse.ArgumentParser(description=usage) - directory_help = ('specify the output directory used for the kernel build ' + directory_help = ('specify the output directory used for the U-Boot build ' '(defaults to the working directory)') parser.add_argument('-d', '--directory', type=str, default='.', help=directory_help)