atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
230 stars 31 forks source link

Macros with volatile: result contains non-D "volatile" keyword #239

Open denizzzka opened 4 years ago

denizzzka commented 4 years ago

C header:

unsigned int val;

#define MMIO32(addr)             (*(volatile unsigned int *)(addr))
#define VOL_VAL     MMIO32(&val)

dpp code what uses this macros:

VOL_VAL |= 1;

Produced D code:

 ( * ( volatile uint32_t * ) ( & val ) ) |= 1; // contains non-D "volatile" keyword

Compilation error:

test.d(11657): Error: found uint32_t when expecting )
test.d(11657): Error: expression expected, not )