Thread overview
[Issue 22831] No error for malformed extern(C) main function
Mar 01, 2022
João Lourenço
Mar 01, 2022
Paul Backus
Mar 03, 2022
Dlang Bot
Mar 23, 2022
Dlang Bot
Apr 13, 2022
Dennis
March 01, 2022
https://issues.dlang.org/show_bug.cgi?id=22831

João Lourenço <jlourenco5691@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jlourenco5691@gmail.com

--
March 01, 2022
https://issues.dlang.org/show_bug.cgi?id=22831

Paul Backus <snarwin+bugzilla@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |snarwin+bugzilla@gmail.com

--- Comment #1 from Paul Backus <snarwin+bugzilla@gmail.com> ---
Note that on some platforms there are other possible signatures for main; e.g.,

extern (C) int main(int argc, char** argv, char** envp) { ... }

--
March 03, 2022
https://issues.dlang.org/show_bug.cgi?id=22831

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@MoonlightSentinel created dlang/dmd pull request #13749 "Fix 22831 - Check signature of extern(C) main functions" fixing this issue:

- Fix 22831 - Check signature of extern(C) main functions

  Enforce that the `main` function uses (most likely) valid arguments /
  return types. The spec / C standard denotes the following signatures:

  ```d
  int main() { ... }
  int main(int, char**) { ... }
  ```

  The implemented checks are more lenient to accomodate for common
  deviations from the standards. See the DDOC comment of `checkMain()`
  for a list of accepted extensions.

  Exotic platforms that expect a different signature can circumvent the
  checks using  `pragma(mangle, "main")`.

  See e.g.
https://stackoverflow.com/questions/2108192/what-are-the-valid-signatures-for-cs-main-function

https://github.com/dlang/dmd/pull/13749

--
March 23, 2022
https://issues.dlang.org/show_bug.cgi?id=22831

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13749 "Fix 22831 - Check signature of extern(C) main functions" was merged into master:

- 118e246c5162e81cd49a8a785ebe0cec9957f360 by MoonlightSentinel:
  Fix 22831 - Check signature of extern(C) main functions

  Enforce that the `main` function uses (most likely) valid arguments /
  return types. The spec / C standard denotes the following signatures:

  ```d
  int main() { ... }
  int main(int, char**) { ... }
  ```

  The implemented checks are more lenient to accomodate for common
  deviations from the standards. See the DDOC comment of `checkMain()`
  for a list of accepted extensions.

  Exotic platforms that expect a different signature can circumvent the
  checks using  `pragma(mangle, "main")`.

  See e.g.
https://stackoverflow.com/questions/2108192/what-are-the-valid-signatures-for-cs-main-function

https://github.com/dlang/dmd/pull/13749

--
March 29, 2022
https://issues.dlang.org/show_bug.cgi?id=22831

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mipri@minimaltype.com

--- Comment #4 from moonlightsentinel@disroot.org ---
*** Issue 20377 has been marked as a duplicate of this issue. ***

--
April 13, 2022
https://issues.dlang.org/show_bug.cgi?id=22831

--- Comment #5 from Dennis <dkorpel@live.nl> ---
*** Issue 21503 has been marked as a duplicate of this issue. ***

--