[PATCH 7/7] Add support for MSVC

Mike Hommey mh+jemalloc at glandium.org
Mon Apr 30 03:49:07 PDT 2012


On Mon, Apr 30, 2012 at 12:44:48PM +0200, Mike Hommey wrote:
> On Mon, Apr 30, 2012 at 12:38:31PM +0200, Mike Hommey wrote:
> > From: Mike Hommey <mh at glandium.org>
> > 
> > Tested with MSVC 8 32 and 64 bits.
> 
> BTW, MSVC gives some interesting warnings, some of which might be worth
> investigating (especially the C4146 ones).
> 
> I'm attaching a log for each of 32 and 64 bits builds.

Erf, I overlooked these logs, some of the warning comes from patch 7/7.
Please squash the following when applying:

diff --git a/include/jemalloc/internal/atomic.h b/include/jemalloc/internal/atomic.h
index 4b6f623..286b457 100644
--- a/include/jemalloc/internal/atomic.h
+++ b/include/jemalloc/internal/atomic.h
@@ -57,7 +57,7 @@ atomic_add_uint64(uint64_t *p, uint64_t x)
 JEMALLOC_INLINE uint64_t
 atomic_sub_uint64(uint64_t *p, uint64_t x)
 {
-       return InterlockedExchangeAdd64(p, -x);
+       return InterlockedExchangeAdd64(p, -((int64_t)x));
 }
 #elif (defined(JEMALLOC_OSATOMIC))
 JEMALLOC_INLINE uint64_t
@@ -167,7 +167,7 @@ atomic_add_uint32(uint32_t *p, uint32_t x)
 JEMALLOC_INLINE uint32_t
 atomic_sub_uint32(uint32_t *p, uint32_t x)
 {
-       return InterlockedExchangeAdd(p, -x);
+       return InterlockedExchangeAdd(p, -((int32_t)x));
 }
 #elif (defined(JEMALLOC_OSATOMIC))
 JEMALLOC_INLINE uint32_t

Mike



More information about the jemalloc-discuss mailing list