[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/8] Mark functions that don't return with attribute noreturn
From: |
Marin Ramesa |
Subject: |
[PATCH 7/8] Mark functions that don't return with attribute noreturn |
Date: |
Mon, 16 Dec 2013 23:55:18 +0100 |
---
device/ds_routines.c | 2 +-
device/ds_routines.h | 2 +-
device/net_io.c | 2 +-
device/net_io.h | 2 +-
kern/eventcount.c | 2 +-
kern/machine.c | 2 +-
kern/machine.h | 2 +-
kern/sched_prim.c | 2 +-
kern/sched_prim.h | 8 ++++----
kern/thread.c | 4 ++--
kern/thread.h | 2 +-
kern/thread_swap.c | 2 +-
kern/thread_swap.h | 2 +-
vm/vm_pageout.h | 6 +++---
14 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/device/ds_routines.c b/device/ds_routines.c
index 939a10e..e31d4e1 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -1479,7 +1479,7 @@ void iodone(ior)
splx(s);
}
-void io_done_thread_continue(void)
+void __attribute__ ((noreturn)) io_done_thread_continue(void)
{
for (;;) {
spl_t s;
diff --git a/device/ds_routines.h b/device/ds_routines.h
index a68c6c6..c0543cb 100644
--- a/device/ds_routines.h
+++ b/device/ds_routines.h
@@ -67,7 +67,7 @@ kern_return_t device_pager_setup(
extern void mach_device_init(void);
extern void dev_lookup_init(void);
extern void device_pager_init(void);
-extern void io_done_thread(void);
+extern void io_done_thread(void) __attribute__ ((noreturn));
io_return_t ds_device_write_trap(
device_t dev,
diff --git a/device/net_io.c b/device/net_io.c
index bce27b3..68dcc09 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -553,7 +553,7 @@ void net_ast(void)
(void) splx(s);
}
-void net_thread_continue(void)
+void __attribute__ ((noreturn)) net_thread_continue(void)
{
for (;;) {
spl_t s;
diff --git a/device/net_io.h b/device/net_io.h
index 0ffdc92..e68e64a 100644
--- a/device/net_io.h
+++ b/device/net_io.h
@@ -90,7 +90,7 @@ extern vm_size_t net_kmsg_size;
extern void net_kmsg_collect (void);
extern void net_io_init(void);
-extern void net_thread(void);
+extern void net_thread(void) __attribute__ ((noreturn));
#define net_kmsg_alloc() ((ipc_kmsg_t) kalloc(net_kmsg_size))
#define net_kmsg_free(kmsg) kfree((vm_offset_t) (kmsg), net_kmsg_size)
diff --git a/kern/eventcount.c b/kern/eventcount.c
index 1bc9968..b1b791b 100644
--- a/kern/eventcount.c
+++ b/kern/eventcount.c
@@ -123,7 +123,7 @@ void evc_notify_abort(const thread_t thread)
* Just so that we return success, and give
* up the stack while blocked
*/
-static void
+static void __attribute__((noreturn))
evc_continue(void)
{
thread_syscall_return(KERN_SUCCESS);
diff --git a/kern/machine.c b/kern/machine.c
index 5d1ea34..3d731a3 100644
--- a/kern/machine.c
+++ b/kern/machine.c
@@ -390,7 +390,7 @@ void action_thread_continue()
}
}
-void action_thread()
+void __attribute__((noreturn)) action_thread()
{
action_thread_continue();
/*NOTREACHED*/
diff --git a/kern/machine.h b/kern/machine.h
index af2b7e9..02465e7 100644
--- a/kern/machine.h
+++ b/kern/machine.h
@@ -53,6 +53,6 @@ extern kern_return_t processor_shutdown (processor_t);
/*
* action_thread() shuts down processors or changes their assignment.
*/
-extern void action_thread_continue (void);
+extern void action_thread_continue (void) __attribute__((noreturn));
#endif /* _MACHINE_H_ */
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index f817004..c2459b4 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -1618,7 +1618,7 @@ int no_dispatch_count = 0;
* to execute.
*/
-void idle_thread_continue(void)
+void __attribute__((noreturn)) idle_thread_continue(void)
{
processor_t myprocessor;
volatile thread_t *threadp;
diff --git a/kern/sched_prim.h b/kern/sched_prim.h
index 07b5bf0..c6972cd 100644
--- a/kern/sched_prim.h
+++ b/kern/sched_prim.h
@@ -132,12 +132,12 @@ extern void thread_timeout_setup(
* Machine-dependent code must define these functions.
*/
-extern void thread_bootstrap_return(void);
-extern void thread_exception_return(void);
+extern void thread_bootstrap_return(void) __attribute__((noreturn));
+extern void thread_exception_return(void) __attribute__((noreturn));
#ifdef __GNUC__
extern void __attribute__((__noreturn__))
thread_syscall_return(kern_return_t);
#else
-extern void thread_syscall_return(kern_return_t);
+extern void thread_syscall_return(kern_return_t) __attribute__((noreturn));
#endif
extern thread_t switch_context(
thread_t old_thread,
@@ -181,7 +181,7 @@ void checkrq(run_queue_t rq, char *msg);
void thread_check(thread_t th, run_queue_t rq);
#endif /* DEBUG */
-extern void idle_thread(void);
+extern void idle_thread(void) __attribute__((noreturn));
extern void sched_thread(void);
#endif /* _KERN_SCHED_PRIM_H_ */
diff --git a/kern/thread.c b/kern/thread.c
index 1414078..254497e 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1123,7 +1123,7 @@ kern_return_t thread_halt(
}
}
-void walking_zombie(void)
+void __attribute__((noreturn)) walking_zombie(void)
{
panic("the zombie walks!");
}
@@ -1693,7 +1693,7 @@ thread_t kernel_thread(
* This kernel thread runs forever looking for threads to destroy
* (when they request that they be destroyed, of course).
*/
-void reaper_thread_continue(void)
+void __attribute__((noreturn)) reaper_thread_continue(void)
{
for (;;) {
thread_t thread;
diff --git a/kern/thread.h b/kern/thread.h
index 9946bde..ca3c136 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -350,7 +350,7 @@ extern thread_t kernel_thread(
void (*start)(void),
void * arg);
-extern void reaper_thread(void);
+extern void reaper_thread(void) __attribute__((noreturn));
#if MACH_HOST
extern void thread_freeze(
diff --git a/kern/thread_swap.c b/kern/thread_swap.c
index e76511e..996ff1f 100644
--- a/kern/thread_swap.c
+++ b/kern/thread_swap.c
@@ -154,7 +154,7 @@ void thread_doswapin(thread)
* This procedure executes as a kernel thread. Threads that need to
* be swapped in are swapped in by this thread.
*/
-void swapin_thread_continue(void)
+void __attribute__((noreturn)) swapin_thread_continue(void)
{
for (;;) {
thread_t thread;
diff --git a/kern/thread_swap.h b/kern/thread_swap.h
index 7f611ec..dbfa9a1 100644
--- a/kern/thread_swap.h
+++ b/kern/thread_swap.h
@@ -38,6 +38,6 @@
extern void swapper_init(void);
extern void thread_swapin(thread_t thread);
extern void thread_doswapin(thread_t thread);
-extern void swapin_thread(void);
+extern void swapin_thread(void) __attribute__((noreturn));
#endif /* _KERN_THREAD_SWAP_H_ */
diff --git a/vm/vm_pageout.h b/vm/vm_pageout.h
index 7e3e4e4..633c50f 100644
--- a/vm/vm_pageout.h
+++ b/vm/vm_pageout.h
@@ -44,10 +44,10 @@ extern vm_page_t vm_pageout_setup(vm_page_t, vm_offset_t,
vm_object_t,
vm_offset_t, boolean_t);
extern void vm_pageout_page(vm_page_t, boolean_t, boolean_t);
-extern void vm_pageout(void);
+extern void vm_pageout(void) __attribute__((noreturn));
-extern void vm_pageout_continue(void);
+extern void vm_pageout_continue(void) __attribute__((noreturn));
-extern void vm_pageout_scan_continue(void);
+extern void vm_pageout_scan_continue(void) __attribute__((noreturn));
#endif /* _VM_VM_PAGEOUT_H_ */
--
1.8.1.4
- [PATCH 1/8] device: qualify pointers whose dereferenced values are constant with const, Marin Ramesa, 2013/12/16
- [PATCH 3/8] ipc: qualify pointers whose dereferenced values are constant with const, Marin Ramesa, 2013/12/16
- [PATCH 2/8] i386: qualify pointers whose dereferenced values are constant with const, Marin Ramesa, 2013/12/16
- [PATCH 4/8] kern: qualify pointers whose dereferenced values are constant with const, Marin Ramesa, 2013/12/16
- [PATCH 5/8] util: qualify pointers whose dereferenced values are constant with const, Marin Ramesa, 2013/12/16
- [PATCH 7/8] Mark functions that don't return with attribute noreturn,
Marin Ramesa <=
- [PATCH 6/8] vm: qualify pointers whose dereferenced values are constant with const, Marin Ramesa, 2013/12/16
- [PATCH 8/8] kern: avoid the casts in enqueue_head() and enqueue_tail(), Marin Ramesa, 2013/12/16