Bug 22812 – ImportC: C11 does not allow newlines between the start and end of a directive
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-02-22T18:45:16Z
Last change time
2022-03-22T13:10:05Z
Keywords
accepts-invalid, ImportC, pull
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2022-02-22T18:45:16Z
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
(
)
---
Comment #1 by dlang-bot — 2022-02-27T14:05:06Z
@ibuclaw created dlang/dmd pull request #13728 "fix Issue 22812 - ImportC: C11 does not allow newlines between the start and end of a directive" fixing this issue:
- fix Issue 22812 - ImportC: C11 does not allow newlines between the start and end of a directive
https://github.com/dlang/dmd/pull/13728
Comment #2 by dlang-bot — 2022-03-22T13:10:05Z
dlang/dmd pull request #13728 "fix Issue 22812 - ImportC: C11 does not allow newlines between the start and end of a directive" was merged into master:
- 52b97c0bf060e0519adb47734609479536ad332a by Iain Buclaw:
fix Issue 22812 - ImportC: C11 does not allow newlines between the start and end of a directive
https://github.com/dlang/dmd/pull/13728