From d83ace1a19d56130ffae890d444ff314f731cd04 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Wed, 11 Jan 2012 12:45:55 -0800 Subject: [PATCH] Bug 679832: In nsCheapSets, cast 32-bit value to intptr_t before converting it to 64-bit void*, to silence GCC 4.6 warning. r=bsmedberg --- xpcom/ds/nsCheapSets.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xpcom/ds/nsCheapSets.h b/xpcom/ds/nsCheapSets.h index 9a5e7d2455d..50047f4e19e 100644 --- a/xpcom/ds/nsCheapSets.h +++ b/xpcom/ds/nsCheapSets.h @@ -175,7 +175,16 @@ private: /** Set the single integer */ void SetInt(PRInt32 aInt) { - mValOrHash = (void*)((aInt << 1) | 0x1); + /** + * NOTE: on 64-bit GCC, we do an intermediate cast to (intptr_t) to fix + * build warning about converting 32-bit value to 64-bit pointer. + * This is GCC-only since some platforms/compilers lack "intptr_t". + */ + mValOrHash = (void*) +#if (defined(__GNUC__) && defined(__x86_64__)) + (intptr_t) +#endif + ((aInt << 1) | 0x1); } /** Create the hash and initialize */ nsresult InitHash(nsInt32HashSet** aSet);