From patchwork Wed Feb 5 17:18:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13961577 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 EAFD71FC113; Wed, 5 Feb 2025 17:18:57 +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=1738775938; cv=none; b=gWHzqx191Mk4DlOOBUBCBhsMxEKbSxWPArb9FfoBt492R4BclxYt6BX0bi70q8n4q7QfvdMMJRMRdusJY15ALxJW9yomMaw4/pXRpayhYvC2mpTgJKZ+RoBcWL+n97inQhPeq5sHPkaH9CEICScvCXTCq4pTGSV9Q91diCzbx80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738775938; c=relaxed/simple; bh=BtalxZX0KkAtCZcNkpyLSzdDRyUnT77353MUONB+T1Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fnSrXp21S2hH+oO0wpwFzMp+Q52g5GrJWJXQqE/Fj22hSvEyOHq7ubLH9RZdR+UpsuVtSoMAoWMZmkNzVuti/7EWe6Dc6m+mYA98GrhldakSoZCS2Ta1j6OXdXg4nxBNtTNXE3r0XKZlAfNyFbJH7I2Fk6uBUB3/2IAGBXZabgE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h70wPXiQ; 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="h70wPXiQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C9BDC4CED1; Wed, 5 Feb 2025 17:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738775937; bh=BtalxZX0KkAtCZcNkpyLSzdDRyUnT77353MUONB+T1Y=; h=From:To:Cc:Subject:Date:From; b=h70wPXiQH8nORUkgtcLZfvCoUkuroXJqPNTAErNSUmZJRMoZhxjpxBo3brCJlnE9o gaZv6RsRZjdqujzcNaULO75XDI28glrtiuPrnq1cUSo2iMlLwi0LO/tjMa0yYgncZN wR8wIZcwCgxVuFdlS5+w4Boi4OMwZ1EErfUg92cNn0t3mPMML1RXCWtG2+Dhe0JyeV 2vP4oHtUrmqtSohQ2rOZ3mIO7TE1NEdyP5gWLI879Le3QTyF7oc9j3SmBPVq+mWrnr 8Drx77QaIQD2ZVxDc24twbYcdTE/Vm54/8m0nTnfWgm6Nm+u9x3e6UAFoYHhf1/czY ClVkmACJX84nQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Bill Wendling , Justin Stitt , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , llvm@lists.linux.dev Subject: [PATCH] gen_compile_commands.py: remove code for '\#' replacement Date: Thu, 6 Feb 2025 02:18:02 +0900 Message-ID: <20250205171811.3471289-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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))