From df4018141752de57cd7ce59ef556f541016facc1 Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Tue, 12 Jul 2011 14:24:14 +0200 Subject: fix warning on 64bit systems: cast to pointer from integer of different size [-Wint-to-pointer-cast] Signed-off-by: Giel van Schijndel --- src/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h index e7110570c6..064339f99b 100644 --- a/src/util.h +++ b/src/util.h @@ -648,7 +648,7 @@ inline bool TerminateThread(pthread_t hthread, unsigned int nExitCode) return (pthread_cancel(hthread) == 0); } -inline void ExitThread(unsigned int nExitCode) +inline void ExitThread(size_t nExitCode) { pthread_exit((void*)nExitCode); } -- cgit v1.2.3 From ecf1c79aada222ccbf93b0f15d98339431d1a881 Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Fri, 24 Jun 2011 19:56:23 +0200 Subject: fix warnings: expression result unused [-Wunused-value] In the assert()s take advantage of the fact that string constants ("string") are effectively of type 'const char []', which when used in an expression yield a non-NULL pointer. An assertion that should always fail can thus be formulated as: assert(!"fail); An assertion where a text message should be added to the expression can be written as such: assert("message" && expression); Signed-off-by: Giel van Schijndel --- src/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h index 064339f99b..9922ba82a9 100644 --- a/src/util.h +++ b/src/util.h @@ -264,7 +264,7 @@ public: // I'd rather be careful than suffer the other more error prone syntax. // The compiler will optimise away all this loop junk. #define CRITICAL_BLOCK(cs) \ - for (bool fcriticalblockonce=true; fcriticalblockonce; assert(("break caught by CRITICAL_BLOCK!", !fcriticalblockonce)), fcriticalblockonce=false) \ + for (bool fcriticalblockonce=true; fcriticalblockonce; assert("break caught by CRITICAL_BLOCK!" && !fcriticalblockonce), fcriticalblockonce=false) \ for (CCriticalBlock criticalblock(cs); fcriticalblockonce && (cs.pszFile=__FILE__, cs.nLine=__LINE__, true); fcriticalblockonce=false, cs.pszFile=NULL, cs.nLine=0) class CTryCriticalBlock @@ -278,7 +278,7 @@ public: }; #define TRY_CRITICAL_BLOCK(cs) \ - for (bool fcriticalblockonce=true; fcriticalblockonce; assert(("break caught by TRY_CRITICAL_BLOCK!", !fcriticalblockonce)), fcriticalblockonce=false) \ + for (bool fcriticalblockonce=true; fcriticalblockonce; assert("break caught by TRY_CRITICAL_BLOCK!" && !fcriticalblockonce), fcriticalblockonce=false) \ for (CTryCriticalBlock criticalblock(cs); fcriticalblockonce && (fcriticalblockonce = criticalblock.Entered()) && (cs.pszFile=__FILE__, cs.nLine=__LINE__, true); fcriticalblockonce=false, cs.pszFile=NULL, cs.nLine=0) -- cgit v1.2.3