[Issue 24011] dmd fails to compile .i files

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 4 01:44:48 UTC 2023


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
Oh, I know what's wrong. The line:

    extern FILE *fopen (const char *__restrict __filename,
      const char *__restrict __modes) ;

ImportC doesn't recognize the __restrict keyword. (__restrict is not a C11
Standard keyword.). When ImportC runs the preprocessor, it also implicitly
#include's the file druntime/src/importc.h, which #define's `__restrict` to
nothing.

ImportC is rather heavily reliant on importc.h to adjust the wild extensions in
various C compilers to something that ImportC can swill on (the ugly
alternative is for ImportC to implement everybody else's extension).

The solution, for your case, is to have gcc use importc.h as well:

    gcc -E -include <path-to-importc>importc.h test.c > test.i

where <path-to-importc> is where importc.h is on your system.

--


More information about the Digitalmars-d-bugs mailing list