[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] Re: _EVUTIL_NIL_CONDITION cause VC2010 error C2070



By the way, this patch no "unused variable" warnings:

cl /Fobufferevent_async.obj /c bufferevent_async.c /MT /O2 /Ox /EHsc
/W3 /DWIN32 /DNDEBUG /D_CRT_NONSTDC_NO_DEPRECATE
/D_CRT_SECURE_NO_DEPRECATE /IWIN32-Code /Iinclude /Icompat /I.
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

On Sun, Dec 26, 2010 at 11:21, Dongsheng Song <dongsheng.song@xxxxxxxxx> wrote:
> Hi Jones,
>
> Your commit b63ab17 caused VC2010 error C2070:
>
> bufferevent_async.c(409) : error C2070: 'unsigned int': illegal sizeof operand
> bufferevent_async.c(434) : error C2070: 'unsigned int': illegal sizeof operand
> bufferevent_async.c(473) : error C2070: 'unsigned int': illegal sizeof operand
>
> Because you can not use sizeof on bitfield, here is my patch:
>
> diff --git a/util-internal.h b/util-internal.h
> index cb76ee4..9cd6a1c 100644
> --- a/util-internal.h
> +++ b/util-internal.h
> @@ -181,7 +181,11 @@ long _evutil_weakrand(void);
>
> Â/* Replacement for assert() that calls event_errx on failure. */
> Â#ifdef NDEBUG
> +#ifdef _MSC_VER
> +#define EVUTIL_ASSERT(cond) _EVUTIL_NIL_STMT
> +#else
> Â#define EVUTIL_ASSERT(cond) _EVUTIL_NIL_CONDITION(cond)
> +#endif
> Â#define EVUTIL_FAILURE_CHECK(cond) 0
> Â#else
> Â#define EVUTIL_ASSERT(cond)
>
> Regards,
> Dongsheng Song
>
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.