-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main: make -f option work in json and xref output
Close #1546. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
- Loading branch information
Showing
19 changed files
with
161 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <stdio.h> | ||
|
||
static int foo (void) | ||
{ | ||
return 1; | ||
} | ||
|
||
int | ||
main(void) | ||
{ | ||
return foo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright: 2017 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
. ../utils.sh | ||
|
||
O=/tmp/ctags-tmain-$$.json | ||
|
||
is_feature_available "${CTAGS}" json | ||
|
||
$CTAGS --extras=-p --output-format=json -f ${O} input.c > /dev/null && cat ${O} | ||
s=$? | ||
|
||
rm -f ${O} | ||
|
||
exit $s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"_type": "tag", "name": "foo", "path": "input.c", "pattern": "/^static int foo (void)$/", "file": true, "typeref": "int", "kind": "function"} | ||
{"_type": "tag", "name": "main", "path": "input.c", "pattern": "/^main(void)$/", "typeref": "int", "kind": "function"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright: 2017 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
|
||
. ../utils.sh | ||
|
||
is_feature_available ${CTAGS} json | ||
|
||
O=/tmp/ctags-tmain-$$ | ||
|
||
echo '#' json regular file | ||
"${CTAGS}" --quiet --options=NONE --output-format=json -o $O --list-extras | grep pseudo | ||
|
||
echo '#' json - | ||
"${CTAGS}" --quiet --options=NONE --output-format=json -o - --list-extras | grep pseudo | ||
|
||
echo '#' json NOTHING | ||
"${CTAGS}" --quiet --options=NONE --output-format=json --list-extras | grep pseudo | ||
|
||
rm -f $O |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# json regular file | ||
p pseudo yes NONE no Include pseudo tags | ||
# json - | ||
p pseudo no NONE no Include pseudo tags | ||
# json NOTHING | ||
p pseudo no NONE no Include pseudo tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <stdio.h> | ||
|
||
static int foo (void) | ||
{ | ||
return 1; | ||
} | ||
|
||
int | ||
main(void) | ||
{ | ||
return foo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright: 2017 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
. ../utils.sh | ||
|
||
O=/tmp/ctags-tmain-$$.xref | ||
$CTAGS --output-format=xref -f ${O} input.c > /dev/null && cat ${O} | ||
s=$? | ||
|
||
rm -f ${O} | ||
|
||
exit $s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
foo function 3 input.c static int foo (void) | ||
main function 9 input.c main(void) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright: 2017 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
CTAGS=$1 | ||
|
||
O=/tmp/ctags-tmain-$$ | ||
|
||
echo '#' tags regular file | ||
"${CTAGS}" --options=NONE --output-format=u-ctags -o $O --list-extras | grep pseudo | ||
|
||
echo '#' tags - | ||
"${CTAGS}" --options=NONE --output-format=u-ctags -o - --list-extras | grep pseudo | ||
|
||
echo '#' tags NOTHING | ||
"${CTAGS}" --options=NONE --output-format=u-ctags --list-extras | grep pseudo | ||
|
||
echo '#' xref regular file | ||
"${CTAGS}" --options=NONE --output-format=xref -o $O --list-extras | grep pseudo | ||
|
||
echo '#' xref - | ||
"${CTAGS}" --options=NONE --output-format=xref -o - --list-extras | grep pseudo | ||
|
||
echo '#' xref NOTHING | ||
"${CTAGS}" --options=NONE --output-format=xref --list-extras | grep pseudo | ||
|
||
rm -f $O |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# tags regular file | ||
p pseudo yes NONE no Include pseudo tags | ||
# tags - | ||
p pseudo no NONE no Include pseudo tags | ||
# tags NOTHING | ||
p pseudo yes NONE no Include pseudo tags | ||
# xref regular file | ||
p pseudo no NONE yes Include pseudo tags | ||
# xref - | ||
p pseudo no NONE yes Include pseudo tags | ||
# xref NOTHING | ||
p pseudo no NONE yes Include pseudo tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters