www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22812] New: ImportC: C11 does not allow newlines between the

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

          Issue ID: 22812
           Summary: ImportC: C11 does not allow newlines between the start
                    and end of a directive
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

According to C11 6.10-5 (Preprocessing directives: Constraints)

The only white-space characters that shall appear between preprocessing tokens

preprocessing token through just before the terminating new-line character) are
space and horizontal-tab (including spaces that have replaced comments or
possibly other white-space characters in translation phase 3).

To be clear, any whitespace/comment is fine, but new lines can't be ignored
because they are the terminator for directives.

So the following should result in an error:
---

    pragma
pack
    (
2
    )
struct S
{
    int i;
    short j;
    double k;
};

    pragma
pack
    (
)
---

--
Feb 22 2022