June 23, 2023
https://issues.dlang.org/show_bug.cgi?id=24011

          Issue ID: 24011
           Summary: dmd fails compile .i files
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: vabenil@protonmail.com

following the example in https://dlang.org/spec/importc.html
> ImportC files have one of the extensions .i, or .c. If no extension is given, .i is tried first, then .c.
And
> The Gnu C Preprocessor can be invoked as:
>    gcc -E file.c > file.i
When I try to compile the following file (main.c):
```
// main.c
#include <stdio.h>
#include <stdint.h>

typedef struct block_s
{
    uint16_t mat_id; // 2
    struct {
        uint8_t r, g, b, c; // 4
    } color;
} block_t;


int main()
{
    printf("sizeof(block_t) is %lu\n", sizeof(block_t));
    return 0;
}
```
with `gcc -E main.c > main.i && dmd main.i` I get:
```
/usr/include/stdio.h(258): Error: found `__filename` when expecting `,`
/usr/include/stdio.h(258): Error: no type-specifier for parameter
/usr/include/stdio.h(259): Error: found `__modes` when expecting `,`
/usr/include/stdio.h(265): Error: found `__filename` when expecting `,`
/usr/include/stdio.h(265): Error: no type-specifier for parameter
/usr/include/stdio.h(266): Error: found `__modes` when expecting `,`
/usr/include/stdio.h(266): Error: no type-specifier for parameter
/usr/include/stdio.h(267): Error: found `__stream` when expecting `,`
/usr/include/stdio.h(328): Error: found `__stream` when expecting `,`
/usr/include/stdio.h(328): Error: no type-specifier for parameter
/usr/include/stdio.h(328): Error: found `__buf` when expecting `,`
/usr/include/stdio.h(332): Error: found `__stream` when expecting `,`
/usr/include/stdio.h(332): Error: no type-specifier for parameter
/usr/include/stdio.h(332): Error: found `__buf` when expecting `,`
/usr/include/stdio.h(332): Error: no type-specifier for parameter
/usr/include/stdio.h(338): Error: found `__stream` when expecting `,`
/usr/include/stdio.h(338): Error: no type-specifier for parameter
/usr/include/stdio.h(338): Error: found `__buf` when expecting `,`
/usr/include/stdio.h(338): Error: no type-specifier for parameter
/usr/include/stdio.h(350): Error: found `__stream` when expecting `,`
```

This issue happens when compiling pretty much any .i file generated with `gcc -E`. This works fine in `gdc`.

I'm using dmd v2.104.0

--