[SAoC] 'DPP with Linux kernel headers' Project Thread

Cristian Becerescu cristian.becerescu at yahoo.com
Mon Oct 28 11:14:24 UTC 2019

Update for week 2 of Milestone 2

- PRs from the previous week were successfully merged

- Tested running dpp to translate linux/virtio.h

In this phase, I've begun testing dpp with every linux header 
used by Alex Militaru's driver, starting with linux/virtio.h.

There are multiple cases where a function is declared through a 
macro, where the function return type is specified using 
__typeof(X)__ (e.g. __typeof(X)__ functionName()). The D 
translation would be something like:

typeof(X) functionName();

In C, X could be a variable of a certain type, the type itself 
(e.g. int), or an alias of a type.
In D, it is not valid code if X is either a certain type, or an 
alias of a type.

alias u32 = uint;

typeof(u32) f1(); // err
typeof(int) f2(); // err

Another issue is related to translating nested (on multiple 
levels) anonymous unions and structs (specifically in 
linux/slab.h, line 596), but I still have to wrap my head around 
this (because the generated code is a bit complicated).

An inconvenience is that on my machine, running dpp with virtio.h 
takes about 15 minutes, which slows down the debugging process 
with this specific header.

More information about the Digitalmars-d mailing list