diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-08-19 01:52:46 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-08-19 01:53:59 +0200 |
| commit | 7067e78fd655232314eaa3d964004ed9600e02be (patch) | |
| tree | 76aa3d3fe1ae7fe5172b40335c5b6055f4dc8881 /executor | |
| parent | 48613af61c42e8a3b4925d7fc7b8ca8350e96f9b (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')
| -rw-r--r-- | executor/common.h | 26 | ||||
| -rw-r--r-- | executor/common_fuchsia.h | 21 |
2 files changed, 27 insertions, 20 deletions
diff --git a/executor/common.h b/executor/common.h index 6b8b43a33..81e60397f 100644 --- a/executor/common.h +++ b/executor/common.h @@ -55,7 +55,7 @@ static __thread jmp_buf segv_env; #if GOOS_akaros #include <parlib/parlib.h> -static void recover() +static void recover(void) { _longjmp(segv_env, 1); } @@ -86,7 +86,7 @@ static void segv_handler(int sig, siginfo_t* info, void* ctx) doexit(sig); } -static void install_segv_handler() +static void install_segv_handler(void) { struct sigaction sa; #if GOOS_linux @@ -142,7 +142,7 @@ static void sleep_ms(uint64 ms) #if SYZ_EXECUTOR || SYZ_THREADED || SYZ_REPEAT && SYZ_EXECUTOR_USES_FORK_SERVER #include <time.h> -static uint64 current_time_ms() +static uint64 current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) @@ -156,7 +156,7 @@ static uint64 current_time_ms() #include <sys/stat.h> #include <unistd.h> -static void use_temporary_dir() +static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); @@ -406,9 +406,9 @@ static void* thr(void* arg) } #if SYZ_REPEAT -static void execute_one() +static void execute_one(void) #else -static void loop() +static void loop(void) #endif { #if SYZ_REPRO @@ -424,7 +424,7 @@ static void loop() again: #endif for (call = 0; call < [[NUM_CALLS]]; call++) { - for (thread = 0; thread < sizeof(threads) / sizeof(threads[0]); thread++) { + for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; @@ -459,7 +459,7 @@ again: #endif #if SYZ_EXECUTOR || SYZ_REPEAT -static void execute_one(); +static void execute_one(void); #if SYZ_EXECUTOR_USES_FORK_SERVER #include <signal.h> #include <sys/types.h> @@ -475,7 +475,7 @@ static void execute_one(); static void reply_handshake(); #endif -static void loop() +static void loop(void) { #if SYZ_HAVE_SETUP_LOOP setup_loop(); @@ -605,7 +605,7 @@ static void loop() } } #else -static void loop() +static void loop(void) { execute_one(); } @@ -623,9 +623,9 @@ static void loop() #if SYZ_THREADED void execute_call(int call) #elif SYZ_REPEAT -void execute_one() +void execute_one(void) #else -void loop() +void loop(void) #endif { [[SYSCALLS]] @@ -644,7 +644,7 @@ int main(int argc, char** argv) if (argc == 2 && strcmp(argv[1], "child") == 0) child(); #else -int main() +int main(void) { [[MMAP_DATA]] #endif 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; }) |
