Menu

#370 ctags parsing fails on static_assert C++11 keyword

open
nobody
None
5
2019-04-09
2016-01-19
No

I recently found that ctags wasn't outputting tags for my functions and found that in some cases, the C++11 keyword can cause ctags to stop parsing. So far, I've found two ways ctags can handle static_assert. Some are parsed as a function prototype, like this:

$ cat test.cpp 
static_assert(sizeof(int) < 4, "foo");
$ ctags -f - --c++-kinds=p test.cpp
sizeof  test.cpp  /^static_assert(sizeof(int) < 4, "foo");$/;" p       file:

Others, produce not output, but also suppress output for all subsequent code:

matthijs@grubby:/tmp$ cat test2.cpp 
static_assert(a < b, "bar");
int test();
matthijs@grubby:/tmp$ ctags -f - --c++-kinds=p test2.cpp 
(no output produced)

Especially the latter is annoying. This should probably be fixed by properly parsing static_assert directives.

Discussion

  • Plastic Vermin

    Plastic Vermin - 2019-04-09

    The same needs to be done for the c11 keyword _Static_assert
    https://en.cppreference.com/w/c/keyword/_Static_assert

     

Log in to post a comment.