Bug 22961 – importC: K&R-style main function rejected

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-29T22:40:33Z
Last change time
2022-03-30T23:06:11Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
duser

Comments

Comment #0 by duser — 2022-03-29T22:40:33Z
int main(argc, argv) int argc; char **argv; { return 0; } test.c(4): Error: function `test.main` parameters must match one of the following signatures test.c(4): `main()` test.c(4): `main(int argc, char** argv)` test.c(4): `main(int argc, char** argv, char** environ)` [POSIX extension] this used to work before the error was added in https://github.com/dlang/dmd/pull/13749
Comment #1 by dlang-bot — 2022-03-30T10:28:21Z
@MoonlightSentinel created dlang/dmd pull request #13927 "Fix 22961 - Don't reject valid K&R main's in C files" fixing this issue: - Fix 22961 - Don't reject valid K&R main's in C files K&R functions are implicitly variadic and hence triggered the error if the declaration actually specified parameters (even if when their types are correct). This patch changes the check s.t. it allows implicitly variadic K&R functions in C files but still reports an error for explicit `...`. https://github.com/dlang/dmd/pull/13927
Comment #2 by moonlightsentinel — 2022-03-30T10:31:44Z
Comment #3 by dlang-bot — 2022-03-30T23:06:11Z
dlang/dmd pull request #13927 "Fix 22961 - Don't reject valid K&R main's in C files" was merged into master: - 9c367327d706b1ba4708b395f97a37bd4ab22d3b by MoonlightSentinel: Fix 22961 - Don't reject valid K&R main's in C files K&R functions are implicitly variadic and hence triggered the error if the declaration actually specified parameters (even if when their types are correct). This patch changes the check s.t. it allows implicitly variadic K&R functions in C files but still reports an error for explicit `...`. https://github.com/dlang/dmd/pull/13927