Skip to content

Conversation

@gadmm
Copy link
Contributor

@gadmm gadmm commented Nov 26, 2023

Headers must be compatible with C++ so they cannot refer to _Bool. We replace _Bool for Caml_state->action_pending with intnat where only the least-significant byte is taken into account.

Fixes: #12772. See discussion there regarding the choice for s390x.

Precheck passes: https://ci.inria.fr/ocaml/job/precheck/915/

Copy link
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

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

I believe a similar change needs to happen in the 5.1 branch as https://github.com/ocaml/ocaml/pull/12734/files#diff-92e5994819665dce8d9ae0342af2dbb1ff3cd11666eb080873f54c2cc04a5ca3R138 introduced a use of _Bool as well.

@gadmm
Copy link
Contributor Author

gadmm commented Nov 26, 2023

This other occurrence is under a CAML_INTERNALS guard so I am afraid that this part is not covered by warranty :)

I checked and the current modification is the only occurrence of _Bool in need of removal.

Copy link
Contributor

@kayceesrk kayceesrk left a comment

Choose a reason for hiding this comment

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

LGTM.

Do we have tests in the testsuite that fail if the RET_FROM_C_CALL macro does not work as expected?

@xavierleroy
Copy link
Contributor

Even if the remaining _Bool in caml/*.h is protected by CAML_INTERNALS, you're welcome to replace it with int for consistency.

Copy link
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@gadmm
Copy link
Contributor Author

gadmm commented Nov 27, 2023

We test that the poll happens when it should. We do not test that no poll happens when it should not (and it would ask some effort to devise one).

I'm a proponent of using bool inside the runtime, which sometimes leads to using _Bool inside internal headers. All the more as the situation will resolve itself in the long term with C23.

A test that would be nice to have in the CI is that C++ compilers understand public OCaml headers.

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.

Package compilation error due to _Bool type in domain_state.tbl

4 participants