Skip to content

[ctypes] Add support for cstubs codegen errno parameter#5827

Closed
droyo wants to merge 1 commit intoocaml:mainfrom
droyo:ctypes-errno
Closed

[ctypes] Add support for cstubs codegen errno parameter#5827
droyo wants to merge 1 commit intoocaml:mainfrom
droyo:ctypes-errno

Conversation

@droyo
Copy link
Copy Markdown
Contributor

@droyo droyo commented Jun 4, 2022

This parameter dates back to 2016, and switches the generated
code between returning just the C function's return value, to a tuple
of (retval, errno).

Signed-off-by: David Arroyo david@aqwari.net

@droyo droyo requested a review from christinerose as a code owner June 4, 2022 02:25
@rgrinberg
Copy link
Copy Markdown
Member

Summoning @mbacarella

@mbacarella
Copy link
Copy Markdown
Collaborator

awesome!

lgtm, though can you add a blackbox test for it @droyo ?

@rgrinberg since this adds a config directive, should we bump the ctypes extension syntax version from 0.1 to 0.2?

@rgrinberg
Copy link
Copy Markdown
Member

since this adds a config directive, should we bump the ctypes extension syntax version from 0.1 to 0.2?

defo

@droyo
Copy link
Copy Markdown
Contributor Author

droyo commented Jun 10, 2022

Sorry for the delay @mbacarella , I was away from my computer. I added a blackbox test, but it is affected by #5809 (this was actually the change that made me find the issue to begin with). I've not yet rebased it against your tentative fix.

@droyo
Copy link
Copy Markdown
Contributor Author

droyo commented Jun 10, 2022

I have locally rebased this against #5816 and verified the test passes.

@droyo droyo force-pushed the ctypes-errno branch 2 times, most recently from 738009a to 3c8f570 Compare June 14, 2022 12:50
@rgrinberg rgrinberg added this to the 3.3.0 milestone Jun 14, 2022
@rgrinberg
Copy link
Copy Markdown
Member

@droyo could you sign off on the commits?

@mbacarella
Copy link
Copy Markdown
Collaborator

@droyo thanks for the tests. do you want to take a crack at making the errno_policy flag a 0.2-only feature?

@droyo
Copy link
Copy Markdown
Contributor Author

droyo commented Jun 16, 2022

@droyo could you sign off on the commits?

done. I also squashed the commits into one.

@droyo thanks for the tests. do you want to take a crack at making the errno_policy flag a 0.2-only feature?

done, sorry for the delay. I hope I did it right.

@rgrinberg rgrinberg requested a review from mbacarella June 16, 2022 18:48
@rgrinberg rgrinberg modified the milestones: 3.3.0, 3.4.0 Jun 17, 2022
let syntax =
Dune_lang.Syntax.create ~name ~desc:"the ctypes extension"
[ ((0, 1), `Since (3, 0))
; ((0, 2), `Since (3, 0)) ]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this line say `Since (3, 3) ?
@rgrinberg

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or 3.4 now, rather?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@droyo droyo force-pushed the ctypes-errno branch 2 times, most recently from 64a024e to dadddb1 Compare June 19, 2022 13:01
@mbacarella
Copy link
Copy Markdown
Collaborator

mbacarella commented Jun 19, 2022

not sure why the DCO check is failing, there appears to be a sign-off?

EDIT: oh, maybe the workflow needs approved to re-run the DCO check (even though that check costs $0)

This parameter dates back to 2016, and switches the generated code
between returning just the C function's return value, to a tuple of
(retval, errno).

Signed-off-by: David Arroyo <david@aqwari.net>
@droyo
Copy link
Copy Markdown
Contributor Author

droyo commented Jun 19, 2022

not sure why the DCO check is failing, there appears to be a sign-off?

I think it was because I was missing the < > brackets around the email in the commit message. I fixed that and it's passing now.

@mbacarella
Copy link
Copy Markdown
Collaborator

The build tests fail on ubuntu and macos 4.14.x because:

+  File "dune-project", line 2, characters 14-17:
+  2 | (using ctypes 0.2)
+                    ^^^
+  Error: Version 0.2 of the ctypes extension is not supported until version 3.4

fine, but why does ubuntu 4.13 succeed?

@rgrinberg
Copy link
Copy Markdown
Member

Merged. Thanks

but why does ubuntu 4.13 succeed?

We don't run the tests on older versions (CI is slow enough already)

@rgrinberg rgrinberg closed this Jun 20, 2022
@mbacarella
Copy link
Copy Markdown
Collaborator

was merged to main here 5821266

emillon added a commit to emillon/opam-repository that referenced this pull request Jul 20, 2022
…ne-site, dune-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info, dune-action-plugin and chrome-trace (3.4.0)

CHANGES:

- Make `dune describe` correctly handle overlapping implementations
  for virtual libraries (ocaml/dune#5971, fixes ocaml/dune#5747, @esope)

- Building the `@check` alias should make sure the libraries and executables
  don't have dependency cycles (ocaml/dune#5892, @rgrinberg)

- [ctypes] Add support for the `errno` parameter using the `errno_policy` field
  in the ctypes settings. (ocaml/dune#5827, @droyo)

- Fix `dune coq top` when it is invoked on files from a subdirectory of the
  directory containing the associated stanza (ocaml/dune#5784, fixes ocaml/dune#5552, @ejgallego,
  @rlepigre, @Alizter)

- Fix hint when an invalid module name is found. (ocaml/dune#5922, fixes ocaml/dune#5273, @emillon)

- The `(cat)` action now supports several files. (ocaml/dune#5928, fixes ocaml/dune#5795, @emillon)

- Dune no longer uses shimmed `META` files for OCaml 5.x, solely using the ones
  installed by the compiler. (ocaml/dune#5916, @dra27)

- Fix handling of the `(deps)` field in `(test)` stanzas when there is an
  `.expected` file. (ocaml/dune#5952, ocaml/dune#5951, fixes ocaml/dune#5950, @emillon)

- Ignore insignificant filesystem events. This stops RPC in watch mode from
  flashing errors on insignificant file system events such as changes in the
  `.git/` directory. (ocaml/dune#5953, @rgrinberg)

- Fix parsing more error messages emitted by the OCaml compiler. In
  particular, messages where the excerpt line number started with a blank
  character were skipped. (ocaml/dune#5981, @rgrinberg)

- env stanza: warn if some rules are ignored because they appear after a
  wildcard rule. (ocaml/dune#5898, fixes ocaml/dune#5886, @emillon)

- On Windows, XDG_CACHE_HOME is taken to be the `FOLDERID_InternetCache` if
  unset, and XDG_CONFIG_HOME and XDG_DATA_HOME are both taken to be
  `FOLDERID_LocalAppData` if unset.  (ocaml/dune#5943, fixes ocaml/dune#5808, @nojb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants