From 7067e78fd655232314eaa3d964004ed9600e02be Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 19 Aug 2018 01:52:46 +0200 Subject: 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. --- executor/common_fuchsia.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'executor/common_fuchsia.h') 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 #include #include #include @@ -22,6 +21,10 @@ #include #include +#if SYZ_EXECUTOR || __NR_get_root_resource +#include +#endif + #if SYZ_EXECUTOR || SYZ_HANDLE_SEGV #include #include @@ -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; }) -- cgit mrf-deployment