Re: Fix clang warning in x86emu code

2012-08-18 Thread Brad Smith
On Tue, Aug 14, 2012 at 10:33:00AM +0200, Mark Kettenis wrote:
> > Date: Tue, 14 Aug 2012 04:12:47 -0400
> > From: Brad Smith 
> > 
> > ../../../../dev/x86emu/x86emu.c:291:1: error: function declared 'noreturn' 
> > should not return [-Werror,-Winvalid-noreturn]
> > 
> > 
> > x86emu_halt_sys: add an (unreached) panic after longjmp
> > 
> > To convince clang that we won't return.
> 
> Perhaps  should mark longjmp(9) as __dead?

Ok. Then how about this?


Index: sys/sys/systm.h
===
RCS file: /home/cvs/src/sys/sys/systm.h,v
retrieving revision 1.92
diff -u -p -r1.92 systm.h
--- sys/sys/systm.h 7 Aug 2012 05:16:53 -   1.92
+++ sys/sys/systm.h 18 Aug 2012 09:33:42 -
@@ -307,7 +307,7 @@ int uiomove(void *, int, struct uio *);
 
 #if defined(_KERNEL)
 intsetjmp(label_t *);
-void   longjmp(label_t *);
+__dead voidlongjmp(label_t *);
 #endif
 
 void   consinit(void);

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: Fix clang warning in x86emu code

2012-08-14 Thread Brad Smith
On Tue, Aug 14, 2012 at 10:33:00AM +0200, Mark Kettenis wrote:
> > Date: Tue, 14 Aug 2012 04:12:47 -0400
> > From: Brad Smith 
> > 
> > ../../../../dev/x86emu/x86emu.c:291:1: error: function declared 'noreturn' 
> > should not return [-Werror,-Winvalid-noreturn]
> > 
> > 
> > x86emu_halt_sys: add an (unreached) panic after longjmp
> > 
> > To convince clang that we won't return.
> 
> Perhaps  should mark longjmp(9) as __dead?

That also works. I see FreeBSD/NetBSD have done so for longjmp()
for both the kernel and userland headers.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: Fix clang warning in x86emu code

2012-08-14 Thread Mark Kettenis
> Date: Tue, 14 Aug 2012 04:12:47 -0400
> From: Brad Smith 
> 
> ../../../../dev/x86emu/x86emu.c:291:1: error: function declared 'noreturn' 
> should not return [-Werror,-Winvalid-noreturn]
> 
> 
> x86emu_halt_sys: add an (unreached) panic after longjmp
> 
> To convince clang that we won't return.

Perhaps  should mark longjmp(9) as __dead?



Fix clang warning in x86emu code

2012-08-14 Thread Brad Smith
../../../../dev/x86emu/x86emu.c:291:1: error: function declared 'noreturn' 
should not return [-Werror,-Winvalid-noreturn]


x86emu_halt_sys: add an (unreached) panic after longjmp

To convince clang that we won't return.

>From oga@Bitrig


Index: x86emu.c
===
RCS file: /home/cvs/src/sys/dev/x86emu/x86emu.c,v
retrieving revision 1.5
diff -u -p -r1.5 x86emu.c
--- x86emu.c17 Feb 2010 15:09:47 -  1.5
+++ x86emu.c14 Aug 2012 07:33:52 -
@@ -288,6 +288,7 @@ x86emu_halt_sys(struct x86emu *emu)
 #else
longjmp(emu->exec_state, 1);
 #endif
+   panic("%s: longjmp returned", __func__);
 }
 
 /*

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.