From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LY5pV-0007Zz-Rd for qemu-devel@nongnu.org; Fri, 13 Feb 2009 16:44:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LY5pU-0007Z1-L3 for qemu-devel@nongnu.org; Fri, 13 Feb 2009 16:44:13 -0500 Received: from [199.232.76.173] (port=54757 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LY5pU-0007Yn-7u for qemu-devel@nongnu.org; Fri, 13 Feb 2009 16:44:12 -0500 Received: from moutng.kundenserver.de ([212.227.126.171]:58914) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LY5pT-0002WN-78 for qemu-devel@nongnu.org; Fri, 13 Feb 2009 16:44:11 -0500 Received: from localhost ([127.0.0.1] ident=stefan) by flocke.weilnetz.de with esmtp (Exim 4.69) (envelope-from ) id 1LY5pQ-0006ZG-KS for qemu-devel@nongnu.org; Fri, 13 Feb 2009 22:44:08 +0100 Message-ID: <4995E9A8.6030403@mail.berlios.de> Date: Fri, 13 Feb 2009 22:44:08 +0100 From: Stefan Weil MIME-Version: 1.0 Subject: [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions Content-Type: multipart/mixed; boundary="------------020604020104090600000400" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers This is a multi-part message in MIME format. --------------020604020104090600000400 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Hello, this patch adds the QEMU_NORETURN attribute to several functions. Regards Stefan Weil --------------020604020104090600000400 Content-Type: text/x-diff; name="noreturn.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="noreturn.patch" Add missing QEMU_NORETURN attribute to several functions. When needed, static is added, too. Signed-off-by: Stefan Weil Index: trunk/bsd-user/qemu.h =================================================================== --- trunk.orig/bsd-user/qemu.h 2009-02-13 22:33:18.000000000 +0100 +++ trunk/bsd-user/qemu.h 2009-02-13 22:37:52.000000000 +0100 @@ -136,7 +136,7 @@ abi_long arg5, abi_long arg6); void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); extern THREAD CPUState *thread_env; -void cpu_loop(CPUState *env, enum BSDType bsd_type); +void QEMU_NORETURN cpu_loop(CPUState *env, enum BSDType bsd_type); void init_paths(const char *prefix); const char *path(const char *pathname); char *target_strerror(int err); Index: trunk/darwin-user/main.c =================================================================== --- trunk.orig/darwin-user/main.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/darwin-user/main.c 2009-02-13 22:37:52.000000000 +0100 @@ -737,7 +737,7 @@ } #endif -void usage(void) +static void QEMU_NORETURN usage(void) { printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2004 Fabrice Bellard\n" "usage: qemu-" TARGET_ARCH " [-h] [-d opts] [-L path] [-s size] program [arguments...]\n" Index: trunk/darwin-user/qemu.h =================================================================== --- trunk.orig/darwin-user/qemu.h 2009-02-13 22:33:18.000000000 +0100 +++ trunk/darwin-user/qemu.h 2009-02-13 22:37:52.000000000 +0100 @@ -105,7 +105,7 @@ void write_dt(void *ptr, unsigned long addr, unsigned long limit, int flags); extern CPUState *global_env; -void cpu_loop(CPUState *env); +void QEMU_NORETURN cpu_loop(CPUState *env); void init_paths(const char *prefix); const char *path(const char *pathname); Index: trunk/exec-all.h =================================================================== --- trunk.orig/exec-all.h 2009-02-13 22:33:18.000000000 +0100 +++ trunk/exec-all.h 2009-02-13 22:37:52.000000000 +0100 @@ -74,8 +74,8 @@ int cpu_restore_state_copy(struct TranslationBlock *tb, CPUState *env, unsigned long searched_pc, void *puc); -void cpu_resume_from_signal(CPUState *env1, void *puc); -void cpu_io_recompile(CPUState *env, void *retaddr); +void QEMU_NORETURN cpu_resume_from_signal(CPUState *env1, void *puc); +void QEMU_NORETURN cpu_io_recompile(CPUState *env, void *retaddr); TranslationBlock *tb_gen_code(CPUState *env, target_ulong pc, target_ulong cs_base, int flags, int cflags); Index: trunk/hw/bt.c =================================================================== --- trunk.orig/hw/bt.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/hw/bt.c 2009-02-13 22:37:52.000000000 +0100 @@ -28,7 +28,7 @@ } /* Slaves should never receive these PDUs */ -static void bt_dummy_lmp_connection_complete(struct bt_link_s *link) +static void QEMU_NORETURN bt_dummy_lmp_connection_complete(struct bt_link_s *link) { if (link->slave->reject_reason) fprintf(stderr, "%s: stray LMP_not_accepted received, fixme\n", @@ -39,13 +39,13 @@ exit(-1); } -static void bt_dummy_lmp_disconnect_master(struct bt_link_s *link) +static void QEMU_NORETURN bt_dummy_lmp_disconnect_master(struct bt_link_s *link) { fprintf(stderr, "%s: stray LMP_detach received, fixme\n", __FUNCTION__); exit(-1); } -static void bt_dummy_lmp_acl_resp(struct bt_link_s *link, +static void QEMU_NORETURN bt_dummy_lmp_acl_resp(struct bt_link_s *link, const uint8_t *data, int start, int len) { fprintf(stderr, "%s: stray ACL response PDU, fixme\n", __FUNCTION__); Index: trunk/hw/pxa2xx_dma.c =================================================================== --- trunk.orig/hw/pxa2xx_dma.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/hw/pxa2xx_dma.c 2009-02-13 22:37:52.000000000 +0100 @@ -406,13 +406,12 @@ } } -static uint32_t pxa2xx_dma_readbad(void *opaque, target_phys_addr_t offset) +static uint32_t QEMU_NORETURN pxa2xx_dma_readbad(void *opaque, target_phys_addr_t offset) { cpu_abort(cpu_single_env, "%s: Bad access width\n", __FUNCTION__); - return 5; } -static void pxa2xx_dma_writebad(void *opaque, +static void QEMU_NORETURN pxa2xx_dma_writebad(void *opaque, target_phys_addr_t offset, uint32_t value) { cpu_abort(cpu_single_env, "%s: Bad access width\n", __FUNCTION__); Index: trunk/linux-user/main.c =================================================================== --- trunk.orig/linux-user/main.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/linux-user/main.c 2009-02-13 22:37:53.000000000 +0100 @@ -2178,7 +2178,7 @@ } #endif /* TARGET_ALPHA */ -static void usage(void) +static void QEMU_NORETURN usage(void) { printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n" "usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n" Index: trunk/linux-user/qemu.h =================================================================== --- trunk.orig/linux-user/qemu.h 2009-02-13 22:33:18.000000000 +0100 +++ trunk/linux-user/qemu.h 2009-02-13 22:37:53.000000000 +0100 @@ -174,7 +174,7 @@ abi_long arg5, abi_long arg6); void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); extern THREAD CPUState *thread_env; -void cpu_loop(CPUState *env); +void QEMU_NORETURN cpu_loop(CPUState *env); void init_paths(const char *prefix); const char *path(const char *pathname); char *target_strerror(int err); Index: trunk/linux-user/syscall.c =================================================================== --- trunk.orig/linux-user/syscall.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/linux-user/syscall.c 2009-02-13 22:37:53.000000000 +0100 @@ -2861,7 +2861,7 @@ sigset_t sigmask; } new_thread_info; -static void *clone_func(void *arg) +static void * QEMU_NORETURN clone_func(void *arg) { new_thread_info *info = arg; CPUState *env; @@ -2884,19 +2884,17 @@ pthread_mutex_unlock(&clone_lock); cpu_loop(env); /* never exits */ - return NULL; } #else /* this stack is the equivalent of the kernel stack associated with a thread/process */ #define NEW_STACK_SIZE 8192 -static int clone_func(void *arg) +static int QEMU_NORETURN clone_func(void *arg) { CPUState *env = arg; cpu_loop(env); /* never exits */ - return 0; } #endif Index: trunk/qemu-img.c =================================================================== --- trunk.orig/qemu-img.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/qemu-img.c 2009-02-13 22:37:53.000000000 +0100 @@ -51,7 +51,7 @@ } /* Please keep in synch with qemu-img.texi */ -static void help(void) +static void QEMU_NORETURN help(void) { printf("qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 Fabrice Bellard\n" "usage: qemu-img command [command options]\n" Index: trunk/tap-win32.c =================================================================== --- trunk.orig/tap-win32.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/tap-win32.c 2009-02-13 22:37:53.000000000 +0100 @@ -487,7 +487,7 @@ return 0; } -static DWORD WINAPI tap_win32_thread_entry(LPVOID param) +static DWORD WINAPI QEMU_NORETURN tap_win32_thread_entry(LPVOID param) { tap_win32_overlapped_t *overlapped = (tap_win32_overlapped_t*)param; unsigned long read_size; @@ -538,8 +538,6 @@ buffer = get_buffer_from_free_list(overlapped); } } - - return 0; } static int tap_win32_read(tap_win32_overlapped_t *overlapped, Index: trunk/target-arm/exec.h =================================================================== --- trunk.orig/target-arm/exec.h 2009-02-13 22:33:18.000000000 +0100 +++ trunk/target-arm/exec.h 2009-02-13 22:37:53.000000000 +0100 @@ -55,4 +55,4 @@ #include "softmmu_exec.h" #endif -void raise_exception(int); +void QEMU_NORETURN raise_exception(int); Index: trunk/target-arm/op_helper.c =================================================================== --- trunk.orig/target-arm/op_helper.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/target-arm/op_helper.c 2009-02-13 22:37:53.000000000 +0100 @@ -245,14 +245,14 @@ return res; } -void HELPER(wfi)(void) +void QEMU_NORETURN HELPER(wfi)(void) { env->exception_index = EXCP_HLT; env->halted = 1; cpu_loop_exit(); } -void HELPER(exception)(uint32_t excp) +void QEMU_NORETURN HELPER(exception)(uint32_t excp) { env->exception_index = excp; cpu_loop_exit(); Index: trunk/target-i386/op_helper.c =================================================================== --- trunk.orig/target-i386/op_helper.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/target-i386/op_helper.c 2009-02-13 22:37:53.000000000 +0100 @@ -1005,7 +1005,7 @@ #ifdef TARGET_X86_64 #if defined(CONFIG_USER_ONLY) -void helper_syscall(int next_eip_addend) +void QEMU_NORETURN helper_syscall(int next_eip_addend) { env->exception_index = EXCP_SYSCALL; env->exception_next_eip = env->eip + next_eip_addend; @@ -1898,7 +1898,7 @@ } #endif -void helper_single_step(void) +void QEMU_NORETURN helper_single_step(void) { #ifndef CONFIG_USER_ONLY check_hw_breakpoints(env, 1); @@ -2975,7 +2975,7 @@ EDX = (uint32_t)(val >> 32); } -void helper_rdpmc(void) +void QEMU_NORETURN helper_rdpmc(void) { if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) { raise_exception(EXCP0D_GPF); @@ -4612,7 +4612,7 @@ } #endif -static void do_hlt(void) +static QEMU_NORETURN void do_hlt(void) { env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */ env->halted = 1; @@ -4620,7 +4620,7 @@ cpu_loop_exit(); } -void helper_hlt(int next_eip_addend) +void QEMU_NORETURN helper_hlt(int next_eip_addend) { helper_svm_check_intercept_param(SVM_EXIT_HLT, 0); EIP += next_eip_addend; @@ -4652,18 +4652,18 @@ } } -void helper_debug(void) +void QEMU_NORETURN helper_debug(void) { env->exception_index = EXCP_DEBUG; cpu_loop_exit(); } -void helper_raise_interrupt(int intno, int next_eip_addend) +void QEMU_NORETURN helper_raise_interrupt(int intno, int next_eip_addend) { raise_interrupt(intno, 1, 0, next_eip_addend); } -void helper_raise_exception(int exception_index) +void QEMU_NORETURN helper_raise_exception(int exception_index) { raise_exception(exception_index); } @@ -5036,7 +5036,7 @@ } } -void helper_vmmcall(void) +void QEMU_NORETURN helper_vmmcall(void) { helper_svm_check_intercept_param(SVM_EXIT_VMMCALL, 0); raise_exception(EXCP06_ILLOP); @@ -5124,7 +5124,7 @@ env->hflags2 &= ~HF2_GIF_MASK; } -void helper_skinit(void) +void QEMU_NORETURN helper_skinit(void) { helper_svm_check_intercept_param(SVM_EXIT_SKINIT, 0); /* XXX: not implemented */ @@ -5231,7 +5231,7 @@ } /* Note: currently only 32 bits of exit_code are used */ -void helper_vmexit(uint32_t exit_code, uint64_t exit_info_1) +void QEMU_NORETURN helper_vmexit(uint32_t exit_code, uint64_t exit_info_1) { uint32_t int_ctl; Index: trunk/target-mips/op_helper.c =================================================================== --- trunk.orig/target-mips/op_helper.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/target-mips/op_helper.c 2009-02-13 22:37:53.000000000 +0100 @@ -26,7 +26,7 @@ /*****************************************************************************/ /* Exceptions processing helpers */ -void do_raise_exception_err (uint32_t exception, int error_code) +void QEMU_NORETURN do_raise_exception_err (uint32_t exception, int error_code) { #if 1 if (exception < 0x100) @@ -37,7 +37,7 @@ cpu_loop_exit(); } -void do_raise_exception (uint32_t exception) +void QEMU_NORETURN do_raise_exception (uint32_t exception) { do_raise_exception_err(exception, 0); } @@ -1830,7 +1830,7 @@ } } -void do_wait (void) +void QEMU_NORETURN do_wait (void) { env->halted = 1; do_raise_exception(EXCP_HLT); @@ -1855,7 +1855,8 @@ #define SHIFT 3 #include "softmmu_template.h" -static void do_unaligned_access (target_ulong addr, int is_write, int is_user, void *retaddr) +static void QEMU_NORETURN do_unaligned_access (target_ulong addr, int is_write, + int is_user, void *retaddr) { env->CP0_BadVAddr = addr; do_restore_state (retaddr); @@ -1890,8 +1891,8 @@ env = saved_env; } -void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec, - int unused, int size) +void QEMU_NORETURN do_unassigned_access(target_phys_addr_t addr, int is_write, + int is_exec, int unused, int size) { if (is_exec) do_raise_exception(EXCP_IBE); Index: trunk/target-ppc/op_helper.c =================================================================== --- trunk.orig/target-ppc/op_helper.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/target-ppc/op_helper.c 2009-02-13 22:37:53.000000000 +0100 @@ -38,7 +38,7 @@ /*****************************************************************************/ /* Exceptions processing helpers */ -void helper_raise_exception_err (uint32_t exception, uint32_t error_code) +void QEMU_NORETURN helper_raise_exception_err (uint32_t exception, uint32_t error_code) { #if 0 printf("Raise exception %3x code : %d\n", exception, error_code); @@ -48,7 +48,7 @@ cpu_loop_exit(); } -void helper_raise_exception (uint32_t exception) +void QEMU_NORETURN helper_raise_exception (uint32_t exception) { helper_raise_exception_err(exception, 0); } Index: trunk/target-sparc/op_helper.c =================================================================== --- trunk.orig/target-sparc/op_helper.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/target-sparc/op_helper.c 2009-02-13 22:37:53.000000000 +0100 @@ -49,13 +49,13 @@ #endif } -static void raise_exception(int tt) +static void QEMU_NORETURN raise_exception(int tt) { env->exception_index = tt; cpu_loop_exit(); } -void HELPER(raise_exception)(int tt) +void QEMU_NORETURN HELPER(raise_exception)(int tt) { raise_exception(tt); } @@ -2514,7 +2514,7 @@ } #endif -void helper_debug(void) +void QEMU_NORETURN helper_debug(void) { env->exception_index = EXCP_DEBUG; cpu_loop_exit(); @@ -3036,8 +3036,8 @@ } } -static void do_unaligned_access(target_ulong addr, int is_write, int is_user, - void *retaddr) +static void QEMU_NORETURN do_unaligned_access(target_ulong addr, + int is_write, int is_user, void *retaddr) { #ifdef DEBUG_UNALIGNED printf("Unaligned access to 0x" TARGET_FMT_lx " from 0x" TARGET_FMT_lx Index: trunk/tests/qruncom.c =================================================================== --- trunk.orig/tests/qruncom.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/tests/qruncom.c 2009-02-13 22:37:53.000000000 +0100 @@ -122,7 +122,7 @@ #define COM_BASE_ADDR 0x10100 -void usage(void) +static void QEMU_NORETURN usage(void) { printf("qruncom version 0.1 (c) 2003 Fabrice Bellard\n" "usage: qruncom file.com\n" Index: trunk/tests/runcom.c =================================================================== --- trunk.orig/tests/runcom.c 2009-02-13 22:33:18.000000000 +0100 +++ trunk/tests/runcom.c 2009-02-13 22:37:53.000000000 +0100 @@ -25,7 +25,7 @@ #define COM_BASE_ADDR 0x10100 -void usage(void) +static void QEMU_NORETURN usage(void) { printf("runcom version 0.1 (c) 2003 Fabrice Bellard\n" "usage: runcom file.com\n" --------------020604020104090600000400--