Gerald Pfeifer gerald@pfeifer.com writes:
On Wed, 16 Apr 2014, Paul Chitescu wrote:
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); ^
memcpy_s() returns an errno_t so the author tried to force returning zero (no error).
Since, clearly, the result is never intended to be used, we can as well simply cast the result away instead of using ", 0".
memcpy_s is supposed to return a value, and callers could (and probably should) check it.
On Thu, 12 Jun 2014, Alexandre Julliard wrote:
../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); ^
memcpy_s() returns an errno_t so the author tried to force returning zero (no error).
Since, clearly, the result is never intended to be used, we can as well simply cast the result away instead of using ", 0".
memcpy_s is supposed to return a value, and callers could (and probably should) check it.
Okay, so how about this patch which removes the ", 0" as part of the #define?
That does not establish what you are suggesting, but at least removes this unconditional silencing (and dozens of warnings for GCC).
Gerald
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h index 0d5e124..5d85639 100644 --- a/dlls/msvcp90/msvcp90.h +++ b/dlls/msvcp90/msvcp90.h @@ -526,7 +526,7 @@ typedef struct { } complex_double;
#if _MSVCP_VER < 80 -#define memcpy_s( dst, size, src, count ) (memcpy( (dst), (src), (count) ), 0) +#define memcpy_s( dst, size, src, count ) (memcpy( (dst), (src), (count) )) #define memmove_s( dst, size, src, count ) (memmove( (dst), (src), (count) ), 0) #define mbstowcs_s( ret, wcs, size, mbs, count ) (mbstowcs( (wcs), (mbs), (count) ), 0) #define hypotf( x, y ) ((float)hypot( (double)(x), (double)(y) ))