Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More compatibility macros to Caml_state #9202

Merged
merged 3 commits into from
Dec 26, 2019
Merged

Conversation

kit-ty-kate
Copy link
Member

#8713 moved a bunch of globals to the new Caml_state structure. This change in the C API breaks a number of packages that were using them.

To facilitate this change, compatibility macros have been introduced, however some of them were missing. This PR adds every remaining previously accessible globals that didn't change their type.
The only missing fields from Caml_state are:

  • caml_young_base which was previously a static variable in minor_gc.c
  • caml_ref_table, caml_ephe_ref_table and caml_custom_table which were previously global structures and not structure pointers

I've been noticing the missing globals when I tried to make Oleg Kiselyov's delimcc compile with OCaml 4.10. With at least the first commit from this PR, it compiles with very minimal change.

@gadmm
Copy link
Contributor

gadmm commented Dec 22, 2019

Thanks, one thing that puzzles me is that Delimcc's stack_native.c has both #define CAML_INTERNAL and -DCAML_NAME_SPACE, so I do not see how compatibility.h gets included there (see #9167). Did you have to add it by hand?

@kit-ty-kate
Copy link
Member Author

Did you have to add it by hand?

oh yes it's the "very minimal change" I was talking about. I was a bit puzzled on the role of CAML_NAME_SPACE and cie. and I didn't really bother looking much more into it.

@gadmm
Copy link
Contributor

gadmm commented Dec 22, 2019

Ok, thanks. So, if I understand correctly, with this patch and #9167, delimcc compiles without a change.

It's better to keep the "one #define per line" style than to introduce
line breaks there.
@xavierleroy xavierleroy merged commit 073fcbb into ocaml:4.10 Dec 26, 2019
xavierleroy pushed a commit that referenced this pull request Dec 26, 2019
runtime/caml/compatibility.h:
Add compatibility macros for globals that have been moved to Caml_state.
Some of these globals are used by 3rd-party libraries, e.g. delimcc

.gitattributes:
Tolerate long lines in runtime/caml/compatibility.h.
It's better to keep the "one #define per line" style than to introduce
line breaks there.

(cherry picked from commit 073fcbb)
@xavierleroy
Copy link
Contributor

Even if the discussion at #9205 is still ongoing, this PR is a clear improvement on the current 4.10 situation, so it is in!

I added a tweak to .gitattributes to escape the typography police.

Merged in 4.10 and cherry-picked to trunk (dc458a0).

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.

None yet

3 participants