git grep --show-function treats GOTO labels as function names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Git grep is an amazing tool, and --show-function makes it very easy to
create reports that contain not only line information, but the
containing function as well.

It looks like there is an issue with how the parser handles "goto"
labels, as it treats them the same as a function name.

In the example below, there is only one function, with two matches,
but using --show-function indicates there are two function names.

$ cat test2.cpp
int main() {
    FOO
exit:
    FOO
}

$ git --version
git version 2.26.2

$ git grep --no-index --show-function -e FOO test2.cpp
test2.cpp=1=int main() {
test2.cpp:2:    FOO
test2.cpp=3=exit:
test2.cpp:4:    FOO


Zach Riggle



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux