Open staticintlucas opened 2 years ago
Thanks a lot already!
I'd like to split the changes up into separate PRs, to enable a cleaner commit history later on. Can you do one that adds basic C support, one that adds register, one for atomic, and so on.
But in this case the docs show using name_t = _name; which is only valid in C++, rather than a typedef which is standard C.
Yes, cppast's code generator uses using
instead of typedef
as that's easier to generate.
Sorry about the silence, but I've only now had another chance to look at this. I've added the logic required to generate typedef
s for C, while still using using
by for C++.
I still want to find a way to make docs on typedef struct { ... } name_t;
work properly, since it's a fairly common idiom in C. After that when it's ready to merge I will split it all up into separate PRs.
@staticintlucas Any progress on this? It would be really cool to use your hard work :)
Sorry, got distracted with other projects and completely forgot about this. I can create some PRs for what I've already implemented in the coming days.
I had not made any progress with typedef struct { ... } type_t
(which I assume also affects enum
), so that is still TODO
@foonathan is there any reason you want him to create separate PR's rather than just cleaning up the commit history in this one with a rebase? Personally, I don't see the difference.
@foonathan is there any reason you want him to create separate PR's rather than just cleaning up the commit history in this one with a rebase? Personally, I don't see the difference.
I usually rewrite the commit messages when merging. This is easier when it's separate PRs.
Better C support as discussed in standardese/standardese#220.
Added:
restrict
&_Atomic
qualifiersregister
storage class_Thread_local
as an alias for C++'sthread_local
Also fixed an issue that was causing my
compile_commands.json
to parse incorrectly. It was treating... -std=c17 filename.c
as iffilename.c
was the value for-std=c17
rather than splitting-std=c17
and treatingfilename.c
as a positional argument.This PR is still a work in progress, but I think most of the changes required for C support are there if you want to review them. I have generally kept naming as is, so
cpp_standard
now includes both C and C++ standards, andcpp_cv
has all 4 qualifiers, not just const and volatile.I still have some issues using Standardese with some of my C code. For example:
This generates documentation for the anonymous struct rather than the typedef. An easy workaround is:
But in this case the docs show
using name_t = _name;
which is only valid in C++, rather than a typedef which is standard C.I haven't looked into these remaining issues yet; if they originate from foonathan/cppast or whether only standardese/standardese needs some more changes.