Subject: Re: more fallout from unused changes (why at all?)
To: Geoff Wing <mason@primenet.com.au>
From: Martin S. Weber <Ephaeton@gmx.net>
List: current-users
Date: 10/14/2006 16:58:47
Moin...

On Sat, Oct 14, 2006 at 09:05:23AM +0000, Geoff Wing wrote:
> src/sys/compat/linux/arch/i386/linux_machdep.c: linux_sys_modify_ldt()
> when USER_LDT is not defined
> 
> --- sys/compat/linux/arch/i386/linux_machdep.c.org	2006-10-12 15:12:19.000000000 +1000
> +++ sys/compat/linux/arch/i386/linux_machdep.c	2006-10-14 18:59:49.000000000 +1000
> @@ -727,6 +727,8 @@
>  	case 0x11:
>  		retval[0] = 0;
>  		return linux_write_ldt(l, uap, retval);
> +#else
> +	do { if (&l || &retval) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
>  #endif /* USER_LDT */

I'm a bit confused about the "why -Wunused". To me, enabling this warning
gives you a hint about obvious oversights, removing not used variables, saving
a bit of space.

Now I don't have the impression (I haven't studied the diffs) what is being
done here is "ensure each and every variable is used" -- why the -Wunused then
at all? Why get the adress of the variable? Just to have a void statement instead
of a void variable? Is it better to have a statement of which you hope the
compiler will drop it instead of having unused 2, 4 or 8 bytes somewhere ?

I try to understand the reasoning for enabling this on i386, could someone
enlighten me please?

-Martin