aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_fuchsia.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-08-19 01:52:46 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-08-19 01:53:59 +0200
commit7067e78fd655232314eaa3d964004ed9600e02be (patch)
tree76aa3d3fe1ae7fe5172b40335c5b6055f4dc8881 /executor/common_fuchsia.h
parent48613af61c42e8a3b4925d7fc7b8ca8350e96f9b (diff)
executor: fix gcc warnings in fuchsia generated code
gcc complains about function declarations not being prototypes, signed/unsigned cast mismatch and casts between incompatible functions. Fix them.
Diffstat (limited to 'executor/common_fuchsia.h')
-rw-r--r--executor/common_fuchsia.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/executor/common_fuchsia.h b/executor/common_fuchsia.h
index 6740c0e95..219aee865 100644
--- a/executor/common_fuchsia.h
+++ b/executor/common_fuchsia.h
@@ -3,7 +3,6 @@
// This file is shared between executor and csource package.
-#include <ddk/driver.h>
#include <fcntl.h>
#include <lib/fdio/util.h>
#include <poll.h>
@@ -22,6 +21,10 @@
#include <zircon/process.h>
#include <zircon/syscalls.h>
+#if SYZ_EXECUTOR || __NR_get_root_resource
+#include <ddk/driver.h>
+#endif
+
#if SYZ_EXECUTOR || SYZ_HANDLE_SEGV
#include <pthread.h>
#include <setjmp.h>
@@ -33,7 +36,7 @@
static __thread int skip_segv;
static __thread jmp_buf segv_env;
-static void segv_handler()
+static void segv_handler(void)
{
if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED)) {
debug("recover: skipping\n");
@@ -91,7 +94,7 @@ static void* ex_handler(void* arg)
return 0;
}
-static void install_segv_handler()
+static void install_segv_handler(void)
{
zx_status_t status;
zx_handle_t port;
@@ -185,28 +188,28 @@ long syz_mmap(size_t addr, size_t size)
#endif
#if SYZ_EXECUTOR || __NR_syz_process_self
-static long syz_process_self()
+static long syz_process_self(void)
{
return zx_process_self();
}
#endif
#if SYZ_EXECUTOR || __NR_syz_thread_self
-static long syz_thread_self()
+static long syz_thread_self(void)
{
return zx_thread_self();
}
#endif
#if SYZ_EXECUTOR || __NR_syz_vmar_root_self
-static long syz_vmar_root_self()
+static long syz_vmar_root_self(void)
{
return zx_vmar_root_self();
}
#endif
#if SYZ_EXECUTOR || __NR_syz_job_default
-static long syz_job_default()
+static long syz_job_default(void)
{
return zx_job_default();
}
@@ -242,3 +245,7 @@ static int do_sandbox_none(void)
#define do_sandbox_setuid() 0
#define do_sandbox_namespace() 0
#endif
+
+// Ugly way to work around gcc's "error: function called through a non-compatible type".
+// The macro is used in generated C code.
+#define CAST(f) ({void* p = (void*)f; p; })