From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFF74188CB1; Fri, 7 Feb 2025 21:34:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738964085; cv=none; b=JaifAsnpZQ0VJ0jEF5khnFDT6oqL9m89QjmV5zoamd7/4KMI42+f2uQ5g8mxpwD4LuzDoXSR88P16ZeBoQDECD5HFgFp7W7QeUBxnuDuAES5x8lPzDX2jgj+tbdT6AhSVQsMNLmxb345f0IUZi40Jf+4b/PzaAJILsjbTo8oeOg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738964085; c=relaxed/simple; bh=1vu6IK/TqU5ipJPjTf+My4zQafmF71UcieC3YgeztUE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pllcVvsFYKyvmKAKbr6YuQeiPu6oekvywxlwtAA3Xo3WzT/q3653uocsSct1S1TmnXJ79spBNCtTVuH7cNY0JPLR7GisDFk0y3Kq6eYYXe34k3jeHLZJLDljVkun7FIx/ilpvtf5me0ZSvRFAvLusIdDTA47Q8Ev6m6sotyMgEk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Kup/n0FH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Kup/n0FH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2ADFC4CEE2; Fri, 7 Feb 2025 21:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738964084; bh=1vu6IK/TqU5ipJPjTf+My4zQafmF71UcieC3YgeztUE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Kup/n0FH4N1HCPxeEfcBSE0Hk6Ym/590YyJipMTt7WA6I9iN0Ih7ts7RNdllhdhLD p8c/goMpaEOLUoP2ofmKh5w1h/MPKj/0eOceXwdjgJAry23wYGKSMEvkm0jhZDeFzL xwer1m0ggV43k+XfOyIxmNzjbc8q6M0VH9hNFof8yW4ymcFSLxsUXy5iFBsBFiGFh+ SY7KN82mQ49+c+ASX39MoLx1h/73tK7BbxwGgM1Lw+lkbRo7IcuBOTyIklNcaS5h5Y 9UdgESfA397ZP3EYTHCbuURmPry1Oca8boPJFBIoBSBwCTxw/DUIYdWmD2WotE7b1i xDX580XLalEdw== Date: Fri, 7 Feb 2025 14:34:39 -0700 From: Nathan Chancellor To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Bill Wendling , Justin Stitt , Nick Desaulniers , Nicolas Schier , llvm@lists.linux.dev Subject: Re: [PATCH] gen_compile_commands.py: remove code for '\#' replacement Message-ID: <20250207213439.GA661404@ax162> References: <20250205171811.3471289-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250205171811.3471289-1-masahiroy@kernel.org> On Thu, Feb 06, 2025 at 02:18:02AM +0900, Masahiro Yamada wrote: > Since commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd files for > future Make"), '#' in the build command is replaced with $(pound) rather > than '\#'. > > Calling .replace(r'\#', '#') is only necessary when this tool is used > to parse .*.cmd files generated by Linux 4.16 or earlier, which is > unlikely happen. > > Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor > --- > > scripts/clang-tools/gen_compile_commands.py | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py > index e4fb686dfaa9..96e6e46ad1a7 100755 > --- a/scripts/clang-tools/gen_compile_commands.py > +++ b/scripts/clang-tools/gen_compile_commands.py > @@ -167,10 +167,10 @@ def process_line(root_directory, command_prefix, file_path): > 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(r'\#', '#').replace('$(pound)', '#') > + # escape the pound sign '#' as '$(pound)'. The compile_commands.json file > + # is not interepreted by Make, so this code replaces the escaped version > + # with '#'. > + prefix = command_prefix.replace('$(pound)', '#') > > # Return the canonical path, eliminating any symbolic links encountered in the path. > abs_path = os.path.realpath(os.path.join(root_directory, file_path)) > -- > 2.43.0 >