Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp109203rdb; Fri, 29 Sep 2023 19:28:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYlGwjadQKFgpQQc/bSEd/kptsDD+2iZA66gMVMGqufM7qvBBAzNC5vwMpHM4uMXFbLiTp X-Received: by 2002:a05:6a00:1703:b0:693:3cac:789a with SMTP id h3-20020a056a00170300b006933cac789amr6787261pfc.12.1696040901703; Fri, 29 Sep 2023 19:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696040901; cv=none; d=google.com; s=arc-20160816; b=iBIaurzJ7IKRpBbbkCXZEEqsnE4TPORmrKS2yJ20NdsZyaKX1RDpvpsMJv23/BU02o G8xsR5Iha2gqFYElFmrM0KAloNB9Q1xSbPS7T7ggC/ijgnTUyjjKDw6TP15S5IOZ4jXq QeZNLr6jd7QAoEjglUrXCKjGWaPMYs+3O1FvH9f1DIoVPOVBOuWldgrEhbPFb9hbmaKE rlyRlr8TnYprTJsQj/6Dw4NmAscFpn/DsfWFpuu0/aiDB9QeDcxRTlbZWA2HyCsg1Vh0 ATAl49u+nOfLBqW5Oi94zg7VqkONUIIiImaM/TsrcDI9MS5Sjm/1Dnyjl2qJraENIzaw MG9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=tl2+4CsKy4eJf2x1H0MEhr2ez9lBgVPpFI/7ocetrG0=; fh=4K3fPrf4aytAe6MEIpWe4+HKFDoZ/RfkAh95gmmQbDk=; b=KHX285Nz5azF8tMLp5zWpkHBmVNV6xHE3rgXs+knSK7m3CKOcbFXraJyT3O2/2fDia xYXzo8i2bVxvux9667v8b/mGPFtzpmfy+Icn7/WEJYByudfHw4rSlO99NTfmKtr9YxW0 cfhyNG2sQle0CqPhwePx1v1OjzwcWkdIy9hNI/kq8OytozPsfMJP5npUyrUQWqi9NEHs 2AiiwhveqxzpebJOoeyOd4vbWbYjwLBWRaYy395+HR8Ttlq80s2vpmVw4eN7iIuBvi2V plCwcPciS7lX4WnX2dgFmSZ/sDKW/m06jmiBvpvjl1wkMY63TcdfhxCZu4Enr9KsG7sb fOaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jcline.org header.s=fm2 header.b=HMksuo6N; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VDygIHyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id b132-20020a63348a000000b005787de7abd4si22339871pga.12.2023.09.29.19.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 19:28:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@jcline.org header.s=fm2 header.b=HMksuo6N; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VDygIHyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id E21FF8405304; Fri, 29 Sep 2023 12:05:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233563AbjI2TE7 (ORCPT + 99 others); Fri, 29 Sep 2023 15:04:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233365AbjI2TE6 (ORCPT ); Fri, 29 Sep 2023 15:04:58 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7416199 for ; Fri, 29 Sep 2023 12:04:55 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id A683732000E5; Fri, 29 Sep 2023 15:04:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 29 Sep 2023 15:04:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jcline.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; t=1696014294; x=1696100694; bh=tl2+4CsKy4 eJf2x1H0MEhr2ez9lBgVPpFI/7ocetrG0=; b=HMksuo6NSjlz9VKe+j/jrBS021 w2C1jWc70y7WdOb/3yx9xx6hrh/GnqOjY+QzvTzndGVKt3xSsT1LAqKKYbTlb1YY S/x8OQqTeZEpqLxhMkBUR3sseOYiH6y3qzXM9171dNuAK2Mqp6XTzxG2Z5yLHpVw r14732TA4KbEFigbadTjHspvJlcTcGkuqPD/ofS80OQ+A/0HfMBvFLLNdNHAowul 3vivu2ISAiPCWj1+EATy/zPZ7F42P5jHnmZlBnVFQBky7Pm3opzCG28xJLCfLrwi aU0EoCLTq8v/9ShiTsiYFTZnmbzNZ8vgkhyyZhwZBljaVHYmkI4GCaElmrSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1696014294; x=1696100694; bh=tl2+4CsKy4eJf 2x1H0MEhr2ez9lBgVPpFI/7ocetrG0=; b=VDygIHyyb5jMFO+nwnAHprxexGgr9 Di6QuWfUL30TRRlVTdozC1A7v3EJjNF8BTuVEfFkjlQue1sxYRS3ZcYqU4p4l05+ HYTOxL7rQ5/mbTIDRZA1tqVB2PDEakAru6jQTb5BS64IeZ4JxNWw4AUjKJcd4Iur ftrKAuL2rezceQIusqsuXy0z1DluJJ4pt2ez7V+LlJo9hFSqXoaOCvhka+oBGyNY nQA9ytMoasR9WUBvZD2DQRUMHY0Y8pfqOT9hpbxIsrgcc9c79dx4DfZ95wqz1hw0 MQhazzSk5N5zN2zrv6Cf+QjSxaFg9+OfHs0Sh7li0FMPuEaxgUY1slxMA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddvgddufedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomheplfgvrhgvmhih ucevlhhinhgvuceojhgvrhgvmhihsehjtghlihhnvgdrohhrgheqnecuggftrfgrthhtvg hrnheptddufeeugeefheehvedufeduvddtgfdvtdfgudfftdelkeelfffhjeevhefhhfeg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhgvrh gvmhihsehjtghlihhnvgdrohhrgh X-ME-Proxy: Feedback-ID: i7a7146c5:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Sep 2023 15:04:53 -0400 (EDT) From: Jeremy Cline To: Nathan Chancellor , Nick Desaulniers Cc: Tom Rix , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Jeremy Cline Subject: [PATCH] gen_compile_commands: use raw string when replacing \# Date: Fri, 29 Sep 2023 15:04:46 -0400 Message-ID: <20230929190446.113168-1-jeremy@jcline.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 29 Sep 2023 12:05:09 -0700 (PDT) I noticed this since I'm running Python 3.12-rc3, which emits "SyntaxWarning: invalid escape sequence '\#'" when running this script. According to the Python 3.12 release notes this will eventually become a SyntaxError. Based on the comment in the code, I believe the intention was to match the literal string "\#". Marking it as a raw string will stop Python from trying to treat it as an escape sequence and behave as intended. Signed-off-by: Jeremy Cline --- scripts/clang-tools/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py index a84cc5737c2c..bc005cac1944 100755 --- a/scripts/clang-tools/gen_compile_commands.py +++ b/scripts/clang-tools/gen_compile_commands.py @@ -170,7 +170,7 @@ def process_line(root_directory, command_prefix, file_path): # 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)', '#') + prefix = command_prefix.replace(r'\#', '#').replace('$(pound)', '#') # Use os.path.abspath() to normalize the path resolving '.' and '..' . abs_path = os.path.abspath(os.path.join(root_directory, file_path)) -- 2.41.0