valgrind.h: Fix macro definition for Windows x64

The Windows x64 ABI follows the LLP64 model, so unsigned long int is 32 bits

Fixes the following warnings when compiling for Windows x64:

  ../glib/gobject/gatomicarray.c:85:3: warning: cast to smaller integer type 'unsigned long' from 'gpointer' (aka 'void *') [-Wvoid-pointer-to-int-cast]
    VALGRIND_MALLOCLIKE_BLOCK (mem, real_size - sizeof (GAtomicArrayMetadata),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../glib/glib/valgrind.h:6479:5: note: expanded from macro 'VALGRIND_MALLOCLIKE_BLOCK'
      VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MALLOCLIKE_BLOCK,       \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../glib/glib/valgrind.h:203:15: note: expanded from macro 'VALGRIND_DO_CLIENT_REQUEST_STMT'
    do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                        \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../glib/glib/valgrind.h:417:20: note: expanded from macro 'VALGRIND_DO_CLIENT_REQUEST_EXPR'
      _zzq_args[1] = (unsigned long int)(_zzq_arg1);                \
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See https://bugs.kde.org/show_bug.cgi?id=427146
This commit is contained in:
Luca Bacci 2023-10-05 16:43:43 +02:00
parent dfeb671c36
commit 4aa051cafb

View File

@ -93,6 +93,7 @@
#include <stdarg.h>
#include <stdint.h>
/* Nb: this file might be included in a file compiled with -ansi. So
we can't use C++ style "//" comments nor the "asm" keyword (instead
@ -411,14 +412,14 @@ typedef
_zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
__extension__ \
({ volatile unsigned long int _zzq_args[6]; \
({ volatile uintptr_t _zzq_args[6]; \
volatile unsigned long int _zzq_result; \
_zzq_args[0] = (unsigned long int)(_zzq_request); \
_zzq_args[1] = (unsigned long int)(_zzq_arg1); \
_zzq_args[2] = (unsigned long int)(_zzq_arg2); \
_zzq_args[3] = (unsigned long int)(_zzq_arg3); \
_zzq_args[4] = (unsigned long int)(_zzq_arg4); \
_zzq_args[5] = (unsigned long int)(_zzq_arg5); \
_zzq_args[0] = (uintptr_t)(_zzq_request); \
_zzq_args[1] = (uintptr_t)(_zzq_arg1); \
_zzq_args[2] = (uintptr_t)(_zzq_arg2); \
_zzq_args[3] = (uintptr_t)(_zzq_arg3); \
_zzq_args[4] = (uintptr_t)(_zzq_arg4); \
_zzq_args[5] = (uintptr_t)(_zzq_arg5); \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
/* %RDX = client_request ( %RAX ) */ \
"xchgq %%rbx,%%rbx" \