aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-02-07 15:26:41 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2023-02-07 16:01:09 +0530
commit2ceb0616a6b59d33b8d8adc816e096b1b5fba13b (patch)
tree6529e9e3f62ca6f575c8dd1b5b1732b093a00379
parent9bbceeee068190b2a7a622b368d7a4d54385fb22 (diff)
downloadmeson-nirbheek/valac-clang-int-conversion.zip
meson-nirbheek/valac-clang-int-conversion.tar.gz
meson-nirbheek/valac-clang-int-conversion.tar.bz2
test cases/vala: Fix clang error during int to pointer coercionnirbheek/valac-clang-int-conversion
``` clang [...] -c valaprog.p/GLib.Thread.c ../test cases/vala/5 target glib/GLib.Thread.vala:17:17: error: incompatible integer to pointer conversion passing 'gint' (aka 'int') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion] g_thread_exit (get_ret_code ()); ^~~~~~~~~~~~~~~ /usr/include/glib-2.0/glib/gthread.h:158:66: note: passing argument to parameter 'retval' here void g_thread_exit (gpointer retval); ^ 1 error generated. ```
-rw-r--r--test cases/vala/5 target glib/GLib.Thread.vala2
-rw-r--r--test cases/vala/5 target glib/retcode.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/test cases/vala/5 target glib/GLib.Thread.vala b/test cases/vala/5 target glib/GLib.Thread.vala
index 7018821..fc82919 100644
--- a/test cases/vala/5 target glib/GLib.Thread.vala
+++ b/test cases/vala/5 target glib/GLib.Thread.vala
@@ -1,4 +1,4 @@
-extern int get_ret_code ();
+extern void * get_ret_code ();
public class MyThread : Object {
public int x_times { get; private set; }
diff --git a/test cases/vala/5 target glib/retcode.c b/test cases/vala/5 target glib/retcode.c
index abca9bf..df44de5 100644
--- a/test cases/vala/5 target glib/retcode.c
+++ b/test cases/vala/5 target glib/retcode.c
@@ -1,5 +1,5 @@
-int
+void *
get_ret_code (void)
{
- return 42;
+ return (void *) (int) 42;
}