www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23884] New: ImportC unsupported gcc extensions

https://issues.dlang.org/show_bug.cgi?id=23884

          Issue ID: 23884
           Summary: ImportC unsupported gcc extensions
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: Patrick.Schluter ec.europa.eu

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`

--
May 04 2023