[Issue 21944] New: importC: Support parsing # line marker directive extensions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 21 09:19:46 UTC 2021


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

          Issue ID: 21944
           Summary: importC: Support parsing # line marker directive
                    extensions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

The gcc preprocessor (gcc -E) spits out code like this:
---
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "test.c"
---

The CParser seems to successfully ignore these directives, though it does so
using the `panic()` function.

However if a line marker appears in the middle of a declaration, e.g:
---
struct Foo {
  int var;
#1 "foo.c" 3 4
};
---

An error occurs.

--


More information about the Digitalmars-d-bugs mailing list