| |
| Posted by Derek Fawcus | PermalinkReply |
|
Derek Fawcus
| https://issues.dlang.org/show_bug.cgi?id=24374
Derek Fawcus <dfawcus+dlang@employees.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfawcus+dlang@employees.org
--- Comment #1 from Derek Fawcus <dfawcus+dlang@employees.org> ---
I just ran in to exactly this issue while evaluating the potential for adding D (betterC mode) code to an existing C project, as an alternative to adding Rust code.
For that I needed to be able to annotate existing functions with @nogc and nothrow, however the basic import of a C file does not allow for this.
As such I decided to generate a .di file using this mechanism, and manipulate the file, prepending the annotations. Then I ran in to this issue.
While I could work around this by altering my source files adding tags such that the struct / union is no longer anonymous, that is not viable. One reason being the quantity of changes required.
More significantly the project headers in question transitively included system headers (inttypes.h) which themselves resulted in the same problem, as those system headers had similar anonymous structs and unions. Having to edit these is a non starter.
There was another reason for wishing to pre-process the C headers to .di files, that being efficiency. By doing so, it would avoid the D compiler from having to repeatedly parse/transform the complete C sources, making builds faster.
As it stands, the lack of ability to control the annotation (@nogc, nothrow, etc) applied to C sources so imported rather makes the use of ImportC and BetterC as I envisaged impractical.
--
|