Finishing off C++ Header generation, a request for help

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Oct 12 12:30:55 UTC 2023


I recently attempted to use the `-HC` generated dmd/frontend.h to 
build LDC and discovered it doesn't work:

So far I have fixed:
* redefinition of `size_t`
* appending of _ to C keywords (to the disgruntlement of Iain), 
so that the tokens enum work with clang

Still to do:
* generate `#include <stdarg.h>` when `va_list` is used
* general issues of declaration order and forward declarations: 
some resolution is too eager resulting in subclasses being 
emitted before their base classes. other is not eager enough 
resulting in typedefs of templates not forward declaring their 
arguments ending up with `typedef Array<BaseClass* > BaseClasses 
not referring to a valid (i.e. prior) definition of `struct 
BaseClass`.

I'm currently in the weeds of resolving the order of declaration 
issues, but it is rather annoying and tedious, given DMD does not 
build on macOS. But before I lose the rest of my marbles trying 
to do that I thought I put out an invitation/request for help for 
anyone interested in learning a bit of DMD, given the success I 
had last time. Thanks already to Rikki for the header generation 
command!

I can provide an overview of what needs to be done along with a 
guided tour of the relevant bits of DMD and pull request reviews 
and so on.

Hit me up on the Discord if you are interested.

Thanks in advance,
Nic




More information about the Digitalmars-d mailing list