Declare lwp_exit_switchaway() __dead. Add infinite loop at the end of

lwp_exit_switchaway() to convince gcc that cpu_switchto(NULL, ...) is
really not going to return in that case.  Exposed by gcc4.3.

Reported on tech-kern by Alexander Shishkin.
This commit is contained in:
uwe 2008-07-25 00:48:59 +00:00
parent 2ae533f9b5
commit 4691dacd78
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_synch.c,v 1.250 2008/07/02 19:44:10 rmind Exp $ */
/* $NetBSD: kern_synch.c,v 1.251 2008/07/25 00:48:59 uwe Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.250 2008/07/02 19:44:10 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.251 2008/07/25 00:48:59 uwe Exp $");
#include "opt_kstack.h"
#include "opt_perfctrs.h"
@ -886,6 +886,7 @@ lwp_exit_switchaway(lwp_t *l)
/* Switch to the new LWP.. */
(void)cpu_switchto(NULL, newl, false);
for (;;) continue; /* XXX: convince gcc about "noreturn" */
/* NOTREACHED */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lwp.h,v 1.105 2008/07/03 15:15:40 ad Exp $ */
/* $NetBSD: lwp.h,v 1.106 2008/07/25 00:48:59 uwe Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -280,7 +280,7 @@ void cpu_setfunc(lwp_t *, void (*)(void *), void *);
void startlwp(void *);
void upcallret(lwp_t *);
void lwp_exit(lwp_t *) __dead;
void lwp_exit_switchaway(lwp_t *);
void lwp_exit_switchaway(lwp_t *) __dead;
int lwp_suspend(lwp_t *, lwp_t *);
int lwp_create1(lwp_t *, const void *, size_t, u_long, lwpid_t *);
void lwp_update_creds(lwp_t *);