summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/ocaml-ctypes-test-oo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/ocaml-ctypes-test-oo.patch')
-rw-r--r--gnu/packages/patches/ocaml-ctypes-test-oo.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/gnu/packages/patches/ocaml-ctypes-test-oo.patch b/gnu/packages/patches/ocaml-ctypes-test-oo.patch
new file mode 100644
index 0000000000..7cb797d07d
--- /dev/null
+++ b/gnu/packages/patches/ocaml-ctypes-test-oo.patch
@@ -0,0 +1,49 @@
+Backport upstream commit fe4be538e389d5caf6c0a562cd02e58fda9361cb.
+
+ Add an explicit upcast in the OO-style test.
+
+https://github.com/yallop/ocaml-ctypes/commit/fe4be538e389d5caf6c0a562cd02e58fda9361cb
+
+It allows to deal with GCC@14 stricter than the previous versions.
+
+diff --git a/tests/clib/test_functions.c b/tests/clib/test_functions.c
+index d19db2b..486b7d1 100644
+--- a/tests/clib/test_functions.c
++++ b/tests/clib/test_functions.c
+@@ -293,6 +293,11 @@ struct chorse *new_chorse(int colour)
+ h->colour = (enum colour)colour;
+ return h;
+ }
++
++struct animal *new_chorse_as_animal(int colour)
++{
++ return (struct animal *)new_chorse(colour);
++}
+ /* (End of OO-style example) */
+
+ int accept_pointers(float *float_p,
+diff --git a/tests/clib/test_functions.h b/tests/clib/test_functions.h
+index 5022e98..579f622 100644
+--- a/tests/clib/test_functions.h
++++ b/tests/clib/test_functions.h
+@@ -79,6 +79,8 @@ extern char *chorse_colour(struct chorse *);
+ extern char *chorse_say(struct animal *);
+ extern char *chorse_identify(struct animal *);
+ extern struct chorse *new_chorse(int);
++extern struct animal *new_chorse_as_animal(int);
++
+ extern int accept_pointers(float *,
+ double *,
+ short *,
+diff --git a/tests/test-oo_style/stubs/functions.ml b/tests/test-oo_style/stubs/functions.ml
+index 4434331..6a8e7bd 100644
+--- a/tests/test-oo_style/stubs/functions.ml
++++ b/tests/test-oo_style/stubs/functions.ml
+@@ -82,6 +82,6 @@ struct
+ let check_name = foreign "check_name"
+ (ptr animal @-> string @-> returning int)
+
+- let new_chorse = foreign "new_chorse"
++ let new_chorse = foreign "new_chorse_as_animal"
+ (int @-> returning (ptr animal))
+ end