All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions
@ 2009-02-13 21:44 Stefan Weil
  2009-02-16 15:41 ` Anthony Liguori
  2009-02-16 16:05 ` Anthony Liguori
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Weil @ 2009-02-13 21:44 UTC (permalink / raw)
  To: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 97 bytes --]

Hello,

this patch adds the QEMU_NORETURN attribute to several functions.

Regards
Stefan Weil



[-- Attachment #2: noreturn.patch --]
[-- Type: text/x-diff, Size: 15820 bytes --]

Add missing QEMU_NORETURN attribute to several functions.
When needed, static is added, too.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>

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"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions
  2009-02-13 21:44 [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions Stefan Weil
@ 2009-02-16 15:41 ` Anthony Liguori
  2009-02-16 18:10   ` Stefan Weil
  2009-02-16 16:05 ` Anthony Liguori
  1 sibling, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2009-02-16 15:41 UTC (permalink / raw)
  To: qemu-devel

Stefan Weil wrote:
> Hello,
>
> this patch adds the QEMU_NORETURN attribute to several functions.
>   

Why?  Does this eliminate warnings?

Regards,

Anthony Liguori

> Regards
> Stefan Weil
>
>
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions
  2009-02-13 21:44 [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions Stefan Weil
  2009-02-16 15:41 ` Anthony Liguori
@ 2009-02-16 16:05 ` Anthony Liguori
  2009-02-16 19:05   ` Stefan Weil
  1 sibling, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2009-02-16 16:05 UTC (permalink / raw)
  To: qemu-devel

Stefan Weil wrote:
> Hello,
>
> this patch adds the QEMU_NORETURN attribute to several functions.
>   

Based on some IRC discussion, the best place to use QEMU_NORETURN is in 
header files.  If you add it to a C file, you don't really need it 
(since the compiler can determine this anyway).

Regards,

Anthony Liguori

> Regards
> Stefan Weil
>
>
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions
  2009-02-16 15:41 ` Anthony Liguori
@ 2009-02-16 18:10   ` Stefan Weil
       [not found]     ` <49A9673D.8000805@mail.berlios.de>
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2009-02-16 18:10 UTC (permalink / raw)
  To: qemu-devel

Anthony Liguori schrieb:
> Stefan Weil wrote:
>> Hello,
>>
>> this patch adds the QEMU_NORETURN attribute to several functions.
>>   
>
> Why?  Does this eliminate warnings?
>
> Regards,
>
> Anthony Liguori

Yes, if you compile using compiler option -Wmissing-noreturn.

Regards
Stefan Weil

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions
  2009-02-16 16:05 ` Anthony Liguori
@ 2009-02-16 19:05   ` Stefan Weil
  2009-02-17  0:34     ` Jamie Lokier
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2009-02-16 19:05 UTC (permalink / raw)
  To: qemu-devel

Anthony Liguori schrieb:
> Stefan Weil wrote:
>> Hello,
>>
>> this patch adds the QEMU_NORETURN attribute to several functions.
>>   
>
> Based on some IRC discussion, the best place to use QEMU_NORETURN is
> in header files.  If you add it to a C file, you don't really need it
> (since the compiler can determine this anyway).
>
> Regards,
>
> Anthony Liguori


This is correct - in theory. I have put all QEMU_NORETURN in header
files were possible.

In practice, there remain two cases which are exceptions to the rule:

Without the attribute, gcc will give warnings (when they are enabled)
for static functions
which don't return. It could determine this automatically, but it does not.

And for some helper functions, there are no simple prototypes in header
files because
they are built by compiler macros, so it is difficult to add the
attribute in the header.

If we want to allow -Wmissing-noreturn some day (which is needed to see the
interesting functions), I think we have to accept these two exceptions.

Regards
Stefan Weil

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions
  2009-02-16 19:05   ` Stefan Weil
@ 2009-02-17  0:34     ` Jamie Lokier
  0 siblings, 0 replies; 7+ messages in thread
From: Jamie Lokier @ 2009-02-17  0:34 UTC (permalink / raw)
  To: qemu-devel

Stefan Weil wrote:
> Without the attribute, gcc will give warnings (when they are
> enabled) for static functions which don't return. It could determine
> this automatically, but it does not.

Obviously it can determine it automatically, otherwise it couldn't warn :-)

-- Jamie

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions
       [not found]               ` <49ABEAF6.10502@us.ibm.com>
@ 2009-03-02 15:11                 ` Stefan Weil
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Weil @ 2009-03-02 15:11 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

Anthony Liguori schrieb:
> Stefan Weil wrote:
>> Would a patch which only adds noreturn to header files be accepted? 
>
> Yup.
>
> Regards,
>
> Anthony Liguori



Here is an extract of my previous patch.

This new patch adds the noreturn attribute only to global functions
declared in header files.

Regards

Stefan Weil


[-- Attachment #2: noreturn.patch --]
[-- Type: text/x-diff, Size: 3069 bytes --]

Add missing QEMU_NORETURN attribute to several global functions.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Index: trunk/bsd-user/qemu.h
===================================================================
--- trunk.orig/bsd-user/qemu.h	2009-03-01 11:04:00.000000000 +0100
+++ trunk/bsd-user/qemu.h	2009-03-02 15:48:59.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/qemu.h
===================================================================
--- trunk.orig/darwin-user/qemu.h	2009-03-01 11:04:01.000000000 +0100
+++ trunk/darwin-user/qemu.h	2009-03-02 15:48:59.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-03-01 11:04:00.000000000 +0100
+++ trunk/exec-all.h	2009-03-02 15:48:59.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/linux-user/qemu.h
===================================================================
--- trunk.orig/linux-user/qemu.h	2009-03-01 11:04:01.000000000 +0100
+++ trunk/linux-user/qemu.h	2009-03-02 15:48:59.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/target-arm/exec.h
===================================================================
--- trunk.orig/target-arm/exec.h	2009-03-01 11:04:00.000000000 +0100
+++ trunk/target-arm/exec.h	2009-03-02 15:48:59.000000000 +0100
@@ -55,4 +55,4 @@
 #include "softmmu_exec.h"
 #endif
 
-void raise_exception(int);
+void QEMU_NORETURN raise_exception(int);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-02 15:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-13 21:44 [Qemu-devel] [PATCH] Add QEMU_NORETURN to some functions Stefan Weil
2009-02-16 15:41 ` Anthony Liguori
2009-02-16 18:10   ` Stefan Weil
     [not found]     ` <49A9673D.8000805@mail.berlios.de>
     [not found]       ` <49A9B0C4.3090606@us.ibm.com>
     [not found]         ` <49A9B7A0.7030606@mail.berlios.de>
     [not found]           ` <49AB1BC8.2060309@us.ibm.com>
     [not found]             ` <49AB953B.2050802@mail.berlios.de>
     [not found]               ` <49ABEAF6.10502@us.ibm.com>
2009-03-02 15:11                 ` Stefan Weil
2009-02-16 16:05 ` Anthony Liguori
2009-02-16 19:05   ` Stefan Weil
2009-02-17  0:34     ` Jamie Lokier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.