Bug 23691 – compilable/test22294.i:16:1: control Z interpreted as end of file

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2023-02-12T14:44:22Z
Last change time
2023-04-09T22:32:33Z
Keywords
accepts-invalid, ImportC, pull
Assigned to
No Owner
Creator
Iain Buclaw
Depends on
23689
See also
https://issues.dlang.org/show_bug.cgi?id=23689

Comments

Comment #0 by ibuclaw — 2023-02-12T14:44:22Z
When compiling with `gcc -std=c11 -fsyntax-only` --- compilable/test22294.i:16:1: error: unknown type name ‘this’ 16 | this should never be parsed | ^~~~ compilable/test22294.i:16:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘never’ 16 | this should never be parsed | ^~~~~ compilable/test22294.i:16:13: error: unknown type name ‘never’ --- Original source content: --- /*********************************************************/ // https://issues.dlang.org/show_bug.cgi?id=22294 #pragma whatever enum { Ax, Bx, Cx }; #pragma _Static_assert(Ax == 0 && Bx == 1 && Cx == 2, "in"); int array22924[Cx]; // Note that ^Z means end of file, this file ends with one #pragma ^Z this should never be parsed
Comment #1 by bugzilla — 2023-02-20T06:32:00Z
The use of ^Z to indicate end of file is commonplace on Windows. It dates back to DOS because the size of a file was the size it was on disk, so ^Z was used to terminate it.
Comment #2 by ibuclaw — 2023-02-20T10:36:40Z
(In reply to Walter Bright from comment #1) > The use of ^Z to indicate end of file is commonplace on Windows. It dates > back to DOS because the size of a file was the size it was on disk, so ^Z > was used to terminate it. So it's valid for a Windows C compiler, but not Linux? I doubt that there's any defined way to mark the end of a source file in C, so maybe mention this alternative form of `__EOF__` under https://dlang.org/spec/importc.html#visualc-extensions ?
Comment #3 by dlang-bot — 2023-04-09T07:31:00Z
@WalterBright created dlang/dlang.org pull request #3579 "fix Issue 23691 - compilable/test22294.i:16:1: control Z interpreted …" fixing this issue: - fix Issue 23691 - compilable/test22294.i:16:1: control Z interpreted as end of file https://github.com/dlang/dlang.org/pull/3579
Comment #4 by dlang-bot — 2023-04-09T22:32:33Z
dlang/dlang.org pull request #3579 "fix Issue 23691 - compilable/test22294.i:16:1: control Z interpreted …" was merged into master: - 3e4818576a9d40bb7a0f6bad3c569c30d26bc5e4 by Walter Bright: fix Issue 23691 - compilable/test22294.i:16:1: control Z interpreted as end of file https://github.com/dlang/dlang.org/pull/3579