projects/guix·blob python-team · refs

49 lines · 1.7 KiB

1Backport upstream commit fe4be538e389d5caf6c0a562cd02e58fda9361cb.
2
3 Add an explicit upcast in the OO-style test.
4
5https://github.com/yallop/ocaml-ctypes/commit/fe4be538e389d5caf6c0a562cd02e58fda9361cb
6
7It allows to deal with GCC@14 stricter than the previous versions.
8
9diff --git a/tests/clib/test_functions.c b/tests/clib/test_functions.c
10index d19db2b..486b7d1 100644
11--- a/tests/clib/test_functions.c
12+++ b/tests/clib/test_functions.c
13@@ -293,6 +293,11 @@ struct chorse *new_chorse(int colour)
14 h->colour = (enum colour)colour;
15 return h;
16 }
17+
18+struct animal *new_chorse_as_animal(int colour)
19+{
20+ return (struct animal *)new_chorse(colour);
21+}
22 /* (End of OO-style example) */
23
24 int accept_pointers(float *float_p,
25diff --git a/tests/clib/test_functions.h b/tests/clib/test_functions.h
26index 5022e98..579f622 100644
27--- a/tests/clib/test_functions.h
28+++ b/tests/clib/test_functions.h
29@@ -79,6 +79,8 @@ extern char *chorse_colour(struct chorse *);
30 extern char *chorse_say(struct animal *);
31 extern char *chorse_identify(struct animal *);
32 extern struct chorse *new_chorse(int);
33+extern struct animal *new_chorse_as_animal(int);
34+
35 extern int accept_pointers(float *,
36 double *,
37 short *,
38diff --git a/tests/test-oo_style/stubs/functions.ml b/tests/test-oo_style/stubs/functions.ml
39index 4434331..6a8e7bd 100644
40--- a/tests/test-oo_style/stubs/functions.ml
41+++ b/tests/test-oo_style/stubs/functions.ml
42@@ -82,6 +82,6 @@ struct
43 let check_name = foreign "check_name"
44 (ptr animal @-> string @-> returning int)
45
46- let new_chorse = foreign "new_chorse"
47+ let new_chorse = foreign "new_chorse_as_animal"
48 (int @-> returning (ptr animal))
49 end