Skip to content

Instantly share code, notes, and snippets.

@Xatenev
Created March 4, 2021 12:49
Show Gist options
  • Save Xatenev/960e7efc3373b003abaedc53410e1062 to your computer and use it in GitHub Desktop.
Save Xatenev/960e7efc3373b003abaedc53410e1062 to your computer and use it in GitHub Desktop.
Only get non-static functions in ctags.
$ gcc -E main.c | ./filter.py > temp.c && ctags --c-types=f -x --file-scope=no temp.c
main function 25 temp.c int main(void) {
test function 17 temp.c int test() {
#!/usr/bin/env python3
import sys
skip = False
for l in sys.stdin:
if not skip:
sys.stdout.write(l)
if l.startswith("# "):
toks = l.strip().split(" ")
linenum, filename = toks[1:3]
flags = toks[3:]
skip = "3" in flags
#include <stdio.h>
#define my_test static
static void static_test() {
}
int test() {
printf("%d", 6);
}
my_test void foo2() {
printf("%d", 5);
}
int main(void) {
foo2();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment