Re: [PATCH 10/11 v2] Fix warnings in nedmalloc when compiling with GCC 4.4.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> Nedmalloc's source code has a cute #define construct to avoid inserting
> an if() statement, because that might interact badly with enclosing if()
> statements.  However, GCC > 4 complains with a "warning: value computed
> is not used".  So we cast the result to "void".
>
> 	Forgot to send.

Thanks.  The description on the pragma is a good thing to add, which you
did.

Is Visual C++ happy with casting discarded result to (void)?  I'd find it
broken if it isn't, but it would not hurt to ask just to make sure.

Steffen, can we move the series, with this patch replaced, to 'next' now?
I think it looks good (thanks!) but again it would not hurt to ask just to
make sure ;-).

>  compat/nedmalloc/malloc.c.h  |    4 +++-
>  compat/nedmalloc/nedmalloc.c |    2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
> index bb0f482..b5b1495 100644
> --- a/compat/nedmalloc/malloc.c.h
> +++ b/compat/nedmalloc/malloc.c.h
> @@ -1270,7 +1270,9 @@ int mspace_mallopt(int, int);
>  /*------------------------------ internal #includes ---------------------- */
>  
>  #ifdef WIN32
> +#ifndef __GNUC__
>  #pragma warning( disable : 4146 ) /* no "unsigned" warnings */
> +#endif
>  #endif /* WIN32 */
>  
>  #include <stdio.h>       /* for printing in malloc_stats */
> @@ -2541,7 +2543,7 @@ struct malloc_params {
>  static struct malloc_params mparams;
>  
>  /* Ensure mparams initialized */
> -#define ensure_initialization() (mparams.magic != 0 || init_mparams())
> +#define ensure_initialization() ((void)(mparams.magic == 0 || init_mparams()))
>  
>  #if !ONLY_MSPACES
>  
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]