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 BE93617AA2 for ; Fri, 2 Jun 2023 09:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 427E0C4339C for ; Fri, 2 Jun 2023 09:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685698720; bh=Vqi/MACemCggxlqO17uN6VZlX/q7HkWg0XU5JvIeJSw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=N4rrAHSe51CFm9uHpfyFRCT8wZXuLk+w08qgTDN32MYanLpQvf6hZ+cEYOoYO6mFM htnG9FFD6DpqnyJFYyi9gSiu3vCEJ9OJrmZnKZs5LLz3fTJuBXqJrTPX1Aw4Yd+POO pGkELke8I4UNEtvqpO1C5TvPpfpF4ThImXFLt1JTOo5edUEe7LpktXcPcIjIP2OqQM ryr4QYSoFGxv/1dI5W70FxtQQ0DCXQL4gj6UGzBqTtvgya0GMBS/i48zIl5KivBTGV L1NuOLnILG7ibBTYfcBk76PJFeb0uaLdcPCZwbuvfCZzi82wpnxVSNT6hui2wulS0x L1BEz1fIUCgcQ== Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-39a505b901dso1617397b6e.0 for ; Fri, 02 Jun 2023 02:38:40 -0700 (PDT) X-Gm-Message-State: AC+VfDxhSRn4A5MrcGTrFCP5dUZLVthAKioaCHUN12i4Ah+S6Mn0ljv7 FOlMDwezRgNmWJq+v368xwvCkPUETspDLhsVHfE= X-Google-Smtp-Source: ACHHUZ6NI6W/9hWUScOKBzEJwOuBknqklyXwSSIHNUrud+dR00zUFqycmoVyD2S8wu5pB96JOHzmx8gYv5op43LjpKM= X-Received: by 2002:a05:6808:5cd:b0:399:b7bd:903c with SMTP id d13-20020a05680805cd00b00399b7bd903cmr1817547oij.40.1685698719453; Fri, 02 Jun 2023 02:38:39 -0700 (PDT) Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Masahiro Yamada Date: Fri, 2 Jun 2023 18:38:03 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] gen_compile_commands: include targets not ending with .o To: =?UTF-8?B?6IOh546u5paH?= Cc: Nick Desaulniers , llvm@lists.linux.dev, Nathan Chancellor , Tom Rix , Linux Kbuild mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 30, 2023 at 6:04=E2=80=AFPM =E8=83=A1=E7=8E=AE=E6=96=87 wrote: > > On Mon, May 29, 2023 at 07:13:46PM +0900, Masahiro Yamada wrote: > > On Thu, May 25, 2023 at 9:21=E2=80=AFPM Hu Weiwen = wrote: > > > > > > Currently, we only extract commands for targets ending with '.o'. But= we > > > also have many standalone executables built in-tree. > > > > > > Remove this restriction. And to avoid some false matching, exclude > > > targets end with '.c' or '.h' when directly walking the directory. > > > > > > Can you give me some examples of false matching? > > Examples: > - drivers/scsi/scsi_devinfo_tbl.c: generated by > sed -n 's/.*define *BLIST_\\([A-Z0-9_]*\\) *.*/BLIST_FLAG_NAME(\\1),/p'= include/scsi/scsi_devinfo.h > drivers/scsi/scsi_devinfo_tbl.c > > - arch/x86/entry/vdso/vdso-image-32.c: generated by > arch/x86/entry/vdso/vdso2c arch/x86/entry/vdso/vdso32.so.dbg arch/x86/e= ntry/vdso/vdso32.so arch/x86/entry/vdso/vdso-image-32.c > > I think only .c file targets would have false matching, because the cmd > must ends with '.c' to be matched. I see. > > > > > Also, this patch would pick up *.i, *.s, *.lst, etc. > > > > Does it make sense to parse cmd files for those? > > I guess the answer is no. > > We are already parsing cmd files for those before this patch. True, but they are excluded by _LINE_PATTERN. > I use more > strict `_FILENAME_PATTERN'. But it may be hard to exclude all of these > by filename. I think so. > Should we use a more strict `_LINE_PATTERN'? e.g., require the cmd to > begin with a compiler, not `sed' or something else. But we don't know > the compiler name, adding a parameter for compiler name may break the > existing usage. Standalone executables are host programs. I do not think it is worthwhile complicating the code. --=20 Best Regards Masahiro Yamada