~sircmpwn/annotatec

annotatec/README.md -rw-r--r-- 1.7 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# annotatec

This program scans C source code and emits an annotation graph for
[git.sr.ht](https://git.sr.ht)'s [code
annotations](https://man.sr.ht/git.sr.ht/annotations.md) feature.

## Limitations

This supports C11 syntax and a handful of GNU C extensions. If your software
uses `-std=gnu*`, it will likely not be parsed successfully. You will
undoubtably run into some GNU extensions anyway, please [report them
here](https://todo.sr.ht/~sircmpwn/annotate)

## Usage

```
annotatec [-gdD] [-C <cpp...>] files... >annotations.json
```

This will print annotations to stdout and progress to stderr. For information
about uploading these annotations to git.sr.ht, see the [git.sr.ht
docs](https://man.sr.ht/git.sr.ht/annotations.md).

The `-C` flag allows you to specify a custom C preprocessor command to
use, where you will need to supply it with a list of include directories,
macros, and so on, which matches those used in your source tree, as well as the
C standard to target. For example:

```sh
annotatec -C "cpp -std=c11 -Iinclude $(pkg-config --cflags libgit2)"
```

You also will almost certainly want to specify the `-g` flag, which will
translate file paths into git blob IDs.

## Example

To generate annotations for all C files in your git repo suitable for sending to
git.sr.ht:

```sh
find . -name "*.c" | xargs \
  annotatec -gC "cpp -std=c11 -Iinclude $(pkg-config --cflags libgit2)" \
  > annotations.json
```

## Bugs, help, patches

Submit bugs to [~sircmpwn/annotate](https://todo.sr.ht/~sircmpwn/annotate).

Send support requests to
[sr.ht-discuss](https://lists.sr.ht/~sircmpwn/sr.ht-discuss).

Send patches [via email](https://git-send-email.io) to
[sr.ht-dev](https://lists.sr.ht/~sircmpwn/sr.ht-dev) with `git config
format.subjectPrefix 'PATCH annotatec'`.