msvcp90/msvcp90.h: right-hand operand of comma expression has no effect
Paul Chitescu
paulc at voip.null.ro
Wed Apr 16 09:35:58 CDT 2014
On Wed Apr 16, 2014 00:48:00 Gerald Pfeifer wrote:
> Building git head with GCC development sources (soon to be GCC 4.9.0)
> gives me the following warnings
>
> ../msvcp90/msvcp90.h:529:75: warning: right-hand operand of comma
> expression has no effect [-Wunused-value] ../msvcp90/msvcp90.h:530:77:
> warning: right-hand operand of comma expression has no effect
> [-Wunused-value]
>
> several times.
>
> Digging into this in more detail I see
>
> ../msvcp90/ios.c: In function 'basic_streambuf_char__Xsgetn_s':
> ../msvcp90/msvcp90.h:529:75: warning: right-hand operand of comma
> expression has no effect [-Wunused-value]
> #define memcpy_s( dst, size, src, count ) (memcpy( (dst), (src), (count)
> ), 0) ^ ../msvcp90/ios.c:1218:13: note: in expansion of macro 'memcpy_s'
> memcpy_s(ptr+copied, size, *this->prpos, chunk);
> ^
>
> Someone must have written that code intentionally, so I am wondering
> how to best address this.
>
> Gerald
memcpy_s() returns an errno_t so the author tried to force returning zero (no
error).
A simple replacement (still without any checks memcpy_s does) would be:
#define memcpy_s( dst, size, src, count ) (!memcpy( (dst), (src), (count) ))
Paul
More information about the wine-devel
mailing list