Bug 23884 – ImportC unsupported gcc extensions

Status
RESOLVED
Resolution
MOVED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-05-04T12:06:16Z
Last change time
2023-05-05T08:21:40Z
Keywords
ImportC
Assigned to
No Owner
Creator
Patrick Schluter
See also
https://issues.dlang.org/show_bug.cgi?id=23886, https://issues.dlang.org/show_bug.cgi?id=23887, https://issues.dlang.org/show_bug.cgi?id=23888, https://issues.dlang.org/show_bug.cgi?id=23889

Comments

Comment #0 by Patrick.Schluter — 2023-05-04T12:06:16Z
I tested ImportC on the code base of the project I'm in charge of at European Commission. While there is no plans yet to use D, it might still be of interest to discover the difficulties encountered. I had for the moment 3 issues that the ImportC compiler was not able to compile: - enum constants bigger than uint. Full in undefined behaviour territory according to the standard, gcc defines the behaviour and defines enums as long/unsigned long/long long/unsigned long long if necessary. ImportC rejects for instance Error: enum member `lang.LANID_TYPE.LANID_GL` enum member value `4294967296LU` does not fit in an `int` - #ident / #sccs this gcc old fashioned pre-processor directive is not supported even if cpp is used by the compiler as pre-processor. Error: C preprocessor directive `#ident` is not supported - VLA (variable length arrays) do not work. Error: variable `ilen` cannot be read at compile time Even replacing VLA with alloca() does not work/ Error: undefined identifier `__builtin_alloca`
Comment #1 by bugzilla — 2023-05-05T08:21:40Z
This is actually 4 bug reports (!) so I split it up into 4 separate issues: 23886, 7, 8 and 9. Thanks for taking the time to report them!