Skip to content

Do not use the compatibility macros in the C stub code.#892

Merged
damiendoligez merged 2 commits intoocaml:trunkfrom
shindere:compatibility-cleanup
Nov 17, 2016
Merged

Do not use the compatibility macros in the C stub code.#892
damiendoligez merged 2 commits intoocaml:trunkfrom
shindere:compatibility-cleanup

Conversation

@shindere
Copy link
Contributor

@shindere shindere commented Nov 6, 2016

No description provided.

@dra27
Copy link
Member

dra27 commented Nov 6, 2016

You should ensure that all those libraries define CAML_NAME_SPACE (as both asmrun and byterun do) to ensure no accidental use of the old names in future. I would:

  1. Remove the #define CAML_NAME_SPACE in otherlibs/str/strstubs.c
  2. Move the -DCAML_NAME_SPACE from EXTRACFLAGS in otherlibs/bigarray/Makefile to CFLAGS in otherlibs/Makefile.

@dra27
Copy link
Member

dra27 commented Nov 6, 2016

Unrelated to your changes (but also worth fixing here), -DCAML_NAME_SPACE is also missing from CFLAGS in both asmrun/Makefile.nt and byterun/Makefile.nt

@shindere
Copy link
Contributor Author

shindere commented Nov 7, 2016

David Allsopp (2016/11/06 05:41 -0800):

You should ensure that all those libraries define CAML_NAME_SPACE
(as both asmrun and byterun do) to ensure no accidental use of the old
names in future.

I agree. it's just that I found this PR big enough and thought that
these changes could diserve another PR.

Unrelated to your changes (but also worth fixing here),
-DCAML_NAME_SPACE is also missing from CFLAGS in both
asmrun/Makefile.nt and byterun/Makefile.nt

Yes, it is actually while trying to merge the build systems in these
directories that I came across this issue. So making sure
CAML_NAME_SPACE is defined everywhere it should (in all the directories
where it makes sense and for all the build systems) is planned for
another PR, unless there is a wish that this goes in this PR as well.

Sébastien.

@dra27
Copy link
Member

dra27 commented Nov 7, 2016

To me, all that's OK to have in this one PR - it fits under the heading of removing the use of compatibility macros. Those changes do belong in a separate commit, though, yes.

@shindere shindere force-pushed the compatibility-cleanup branch from 4c2e0a7 to 917066d Compare November 7, 2016 13:12
@shindere
Copy link
Contributor Author

shindere commented Nov 7, 2016

David Allsopp (2016/11/07 02:00 -0800):

To me, all that's OK to have in this one PR - it fits under the
heading of removing the use of compatibility macros. Those changes do
belong in a separate commit, though, yes!

The PR has been updated. Reviews welcome! Thanks!

@dra27
Copy link
Member

dra27 commented Nov 7, 2016

Making CAML_NAME_SPACE always defined is breaking some of the testsuite (which can sensibly be fixed too).

However, I think the way it's being applied may be a mistake - doesn't adding it at configure also force all third party C libraries to use the caml_ versions?

@shindere
Copy link
Contributor Author

David Allsopp (2016/11/07 05:41 -0800):

Making CAML_NAME_SPACE always defined is breaking some of the
testsuite (which can sensibly be fixed too).

The PR has been updated to also fix the testsuite, thanks!

However, I think the way it's being applied may be a mistake - doesn't
adding it at configure also force all third party C libraries to use
the caml_ versions?

Indeed! Many thanks for having raised this point!
PR #911 is an attempt to address it. This PR depends on it so it is
probably better not to merge this one until either #911 gets
merged or another solution can be found.

@shindere shindere force-pushed the compatibility-cleanup branch 2 times, most recently from e44c324 to ad206b4 Compare November 16, 2016 08:57
@shindere
Copy link
Contributor Author

This PR has been rebased on the latest trunk and should now be ready to be
merged. Given that it should not introduce any user-visible change,
no entry has been added to Changes.

@shindere shindere force-pushed the compatibility-cleanup branch from ad206b4 to acfb61f Compare November 16, 2016 16:22
@shindere
Copy link
Contributor Author

The change in configure introduced by this PR has been minimized thanks
to a suggestion made in private by @damiendoligez. Many thanks to him
for this useful feedback.

The PR should be ready for integration, now.

Copy link
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

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

I reviewed all the identifier changes, so I can attest that they just turn foo into caml_foo, except for mlraise => caml_raise that (is correct but) caught me off-guard. I haven't looked at the Makefile/build stuff.

#define CAML_INTERNALS

#include <caml/mlvalues.h>
#include <caml/memory.h>
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what this change is for.

@shindere
Copy link
Contributor Author

Gabriel Scherer (2016/11/16 13:41 -0800):

I reviewed all the identifier changes, so I can attest that they just
turn foo into caml_foo, except for mlraise => caml_raise that
(is correct but) caught me off-guard.

Thanks a lot for having taken the time to review everything! Such a
commit is big and kind of uninteresting so it's especially easy to make
mistakes, and perhaps especially boring to review and hard to see such
errors. So I really appreciate all your reviewing work! Thanks!

@@ -16,6 +16,7 @@
#define CAML_INTERNALS

#include <caml/mlvalues.h>
+#include <caml/memory.h>

I don't understand what this change is for.

Will check as soon as possible and let you know, thanks!

This is achieved by ensuring that the CAML_NAME_SPACE macro is defined
everytime a C source file is compiled, rather than being defined only
in a few places. Defining this macro guarantees that the compatibility.h
header (where these deprecated identifiers are defined) will not be
included.
@shindere shindere force-pushed the compatibility-cleanup branch from acfb61f to a1deb00 Compare November 17, 2016 08:43
@shindere
Copy link
Contributor Author

Gabriel Scherer (2016/11/16 13:41 -0800):

@@ -16,6 +16,7 @@
#define CAML_INTERNALS

#include <caml/mlvalues.h>
+#include <caml/memory.h>

I don't understand what this change is for.

That was to fix a warning about the implicit declaration of
caml_stat_free but it is indeed not related to this PR.

So I removed this change from the PR and will included it in a PR
dedicated to fixing this kind of warnings which will be submitted soon.

Thanks again for the careful review!

@damiendoligez damiendoligez merged commit 13945a7 into ocaml:trunk Nov 17, 2016
@shindere
Copy link
Contributor Author

Many thanks for the merge.

Unfortunately this PR broke the Cygwin builds.

It's my fault, I took it for granted that code that compiles on Linux
would also work on Cygwin and thus I didn't test -- wrong assumption.

I am working on this right now.

What's the best way to proceed from here? Shall I submit a new PR?

shindere added a commit to shindere/ocaml that referenced this pull request Nov 17, 2016
This fixes PR ocaml#892 (commit 13945a7):
there was one compatibility macro remaining in Cygwin-specific code.
@shindere
Copy link
Contributor Author

I just pushed the fix-pr-892 branch on my public git repository
(it works on both Cygwin and Cygwin 64 now).

Perhaps it's enough that somebody with write access to ocaml's
repository merges or cherry-picks it on trunk?

@gasche
Copy link
Member

gasche commented Nov 17, 2016

Done, thanks!

@shindere
Copy link
Contributor Author

Gabriel Scherer (2016/11/17 03:57 -0800):

Done, thanks!

Thanks, and sorry for the noise / burden.

camlspotter pushed a commit to camlspotter/ocaml that referenced this pull request Oct 17, 2017
* Don't use the compatibility macros, neither in the C stub code nor in the testsuite.

* Make sure compiler sources do not use deprecated C identifiers.

This is achieved by ensuring that the CAML_NAME_SPACE macro is defined
everytime a C source file is compiled, rather than being defined only
in a few places. Defining this macro guarantees that the compatibility.h
header (where these deprecated identifiers are defined) will not be
included.
camlspotter pushed a commit to camlspotter/ocaml that referenced this pull request Oct 17, 2017
This fixes PR ocaml#892 (commit 13945a7):
there was one compatibility macro remaining in Cygwin-specific code.
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Oct 25, 2022
sadiqj pushed a commit to sadiqj/ocaml that referenced this pull request Feb 21, 2023
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 21, 2023
b11eea1 flambda-backend: Introduce Import_info (ocaml#1036)
bc5b135 flambda-backend: Fix `ocamlobjinfo` on flambda2 .cmx files (ocaml#1029)
c8babbd flambda-backend: Compilation_unit optimisations (ocaml#1035)
e8d3e22 flambda-backend: Use 4.14.0 opam switch for building (includes upgrading ocamlformat to 0.24.1) (ocaml#1030)
eb14a86 flambda-backend: Port PR81 from ocaml-jst (ocaml#1024)
131bc12 flambda-backend: Merge ocaml-jst 2022-12-13 (ocaml#1022)
06c189a flambda-backend: Make stack allocation the default (ocaml#1013)
98debd5 flambda-backend: Initial support for value slots not of value kind (ocaml#946)
deb1714 flambda-backend: Add is_last flag to closinfo words (ocaml#938)
d07fce1 flambda-backend: Disable poll insertion in Configure (ocaml#967)
0f1ce0e flambda-backend: Regenerate ocaml/configure autoconf 2.69 (instead of 2.71) (ocaml#1012)
27132d8 flambda-backend: Fix for spurious typing error related to expanding through functor arguments (ocaml#997)
724fb68 flambda-backend: Use `Compilation_unit.t` instead of `Ident.t` for globals (ocaml#871)
396d5b8 flambda-backend: Add a test for frametable setup in natdynlinked libraries (ocaml#983)
b73ab12 flambda-backend: Fix invocation of `caml_shared_startup` in native dynlink (ocaml#980)
7c7d75a flambda-backend: Fix split_default_wrapper which did not trigger anymore with flambda2 (ocaml#970)
8fb75bd flambda-backend: Port ocaml#11727 and ocaml#11732 (ocaml#965)
fdb7987 flambda-backend: Fix include functor issue after 4.14 merge. (ocaml#948)
9745cdb flambda-backend: Print -dprofile/-dtimings output to stdout like 4.12 (ocaml#943)
5f51f21 flambda-backend: Merge pull request ocaml#932 from mshinwell/4.14-upgrade
841687d flambda-backend: Run make alldepend in ocaml/ (ocaml#936)
72a7658 flambda-backend: Remove reformatting changes only in dynlink/dune (preserving PR889 and adjusting to minimise diff)
6d758cd flambda-backend: Revert whitespace changes in dune files, to match upstream
c86bf6e flambda-backend: Remove duplicate tests for polling
971dbeb flambda-backend: Testsuite fixes
32f8356 flambda-backend: Topeval fix for symbols patch
befea01 flambda-backend: Compilation fixes / rectify merge faults
a84543f flambda-backend: Merge ocaml-jst
8e65056 flambda-backend: Merge ocaml-jst
4d70045 flambda-backend: Remove filename from system frametable (amd64) (ocaml#920)
5e57b7d flambda-backend: Bugfix for runtime frame_descr logic for C frames (ocaml#918)
6423d5e flambda-backend: Merge pull request ocaml#914 from mshinwell/merge-ocaml-jst-2022-10-24
ead605c flambda-backend: Add a missing Extract_exception (ocaml#916)
c8f1481 flambda-backend: Resolve conflicts and add specialise/specialised attributes to Builtin_attributes
cf4d0d3 flambda-backend: Merge fixes (ocaml#21)
c2f742f flambda-backend: Re-enable some tests for Flambda2 (ocaml#881)
3d38d13 flambda-backend: Long frames in frametable (ocaml#797)
85aec7b flambda-backend: Add loop attribute to Builtin_attributes
c0f16e3 flambda-backend: Compilation fixes
90dea23 flambda-backend: Merge flambda-backend/main
5acc6ea flambda-backend: Fixes after merge
e501946 flambda-backend: Merge ocaml-jst
115083b flambda-backend: Merge ocaml-jst
9943b2e flambda-backend: Revert "Revert "Transform tail-recursive functions into recursive continuations (ocaml#893)"" (ocaml#909)
ce339f1 flambda-backend: Fix alloc modes and call kinds for overapplications (ocaml#902)
e6a317c flambda-backend: Revert "Transform tail-recursive functions into recursive continuations (ocaml#893)"
853c488 flambda-backend: Transform tail-recursive functions into recursive continuations (ocaml#893)
5a977e4 flambda-backend: Fix missing End_region primitives on switch arms (ocaml#898)
7fa7f9d flambda-backend: Add missing dependencies to Dune files (ocaml#889)
3cd36f0 flambda-backend: Have Lambda `Pgetglobal` and `Psetglobal` take `Compilation_unit.t` (ocaml#896)
7565915 flambda-backend: [@poll error] attribute (ocaml#745)
9eb9448 flambda-backend: Backport the main safepoints PRs (ocaml#740)
689bdda flambda-backend: Add strict mode for ocamldep (ocaml#892)

git-subtree-dir: ocaml
git-subtree-split: b11eea1
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