ctags
ctags copied to clipboard
CPreprocessor,C: macro expands multiple lines
The name of the parser: C
The command line you used to run ctags:
$ ctags --options=NONE -D 'SYSCALL_DEFINE3(name,...)=long name(__VA_ARGS__)' open.c
open.c is extracted from linux kernel https://elixir.bootlin.com/linux/latest/source/fs/open.c#L714
The content of input file:
SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
{
return do_faccessat(dfd, filename, mode, 0);
}
SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename,
umode_t, mode)
{
return do_fchmodat(dfd, filename, mode, 0);
}
The tags output you are not satisfied with:
faccessat open.c /^SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)$/;" f typeref:typename:long
fchmodat open.c /^ umode_t, mode)$/;" f typeref:typename:long
The tags output you expect:
faccessat open.c /^SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)$/;" f typeref:typename:long
fchmodat open.c /^SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename,/;" f typeref:typename:long
The version of ctags:
$ ctags --version
Universal Ctags 6.1.0(p6.1.20240609.0), Copyright (C) 2015-2023 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Jun 13 2024, 15:18:36
URL: https://ctags.io/
Output version: 0.0
Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +packcc, +optscript, +pcre2
How do you get ctags binary:
Building it locally from master branch today.
It looks hard to fix.
While working on https://github.com/bootlin/elixir/issues/379, I found a way to solve this issue.
$ cat -n input.c
1 SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
2 {
3 return do_faccessat(dfd, filename, mode, 0);
4 }
5
6 SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename,
7 umode_t, mode)
8 {
9 return do_fchmodat(dfd, filename, mode, 0);
10 }
$ ../../../ctags --options=NONE --fields=+n -o - -D 'SYSCALL_DEFINE3(name,...)=long name(__VA_ARGS__)' input.c
ctags: Notice: No options will be read from files or environment
faccessat input.c /^SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)$/;" f line:1 typeref:typename:long
fchmodat input.c /^SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename,$/;" f line:6 typeref:typename:long
I'll make a request after polishing the change.