universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.55k stars 624 forks source link

CPreprocessor,C: macro expands multiple lines #4018

Open kcwu opened 4 months ago

kcwu commented 4 months ago

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.

masatake commented 4 months ago

It looks hard to fix.