[Issue 22812] New: ImportC: C11 does not allow newlines between the start and end of a directive

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 22 18:45:16 UTC 2022


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 at puremagic.com
          Reporter: ibuclaw at gdcproject.org

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

The only white-space characters that shall appear between preprocessing tokens
within a preprocessing directive (from just after the introducing `#`
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
    (
)
---

--


More information about the Digitalmars-d-bugs mailing list