From 4a7c383116896b84a496ecf436cbcc25f9649236 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Tue, 21 Jun 2011 03:35:30 +0000 Subject: [PATCH] Changed preprocessor statements to provide clarity. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1087 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/ThreadLocal.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/include/loki/ThreadLocal.h b/include/loki/ThreadLocal.h index 5397a54..f03a87f 100644 --- a/include/loki/ThreadLocal.h +++ b/include/loki/ThreadLocal.h @@ -20,19 +20,28 @@ // First assume the compiler does allow thread-local storage by #defining the // macro which allows compiler to see the code inside this file. -// Then #undef the macro for compilers which are known for not supporting -// thread-local storage. +// Then #undef the macro for compilers which do not support thread-local +// storage or do not implement it correctly. #define LOKI_THINKS_COMPILER_ALLOWS_THREAD_LOCAL_STORAGE 1 -// The __APPLE__ macro does not refer to a compiler, but to the Apple OSX operating system. -#if defined( __APPLE__ ) - #warning "GCC for Apple does not allow thread_local storage, so you can not use some parts of Loki." - #undef COMPILER_ALLOWS_THREAD_LOCAL_STORAGE -#endif +#if defined( __GNUC__ ) + // The __APPLE__ macro does not refer to a compiler, but to the Apple OSX operating system. + #if defined( __APPLE__ ) + #warning "GCC for Apple does not allow thread_local storage, so you can not use some parts of Loki." + #undef COMPILER_ALLOWS_THREAD_LOCAL_STORAGE -#if ( defined( __CYGWIN__ ) && ( __GNUC__ <= 3 ) ) - #warning "Older versions of GCC for Cygwin do not allow thread_local storage, so you can not use some parts of Loki." - #undef COMPILER_ALLOWS_THREAD_LOCAL_STORAGE + #elif defined( __CYGWIN__ ) + #if ( __GNUC__ <= 3 ) + #warning "Older versions of GCC for Cygwin do not allow thread_local storage, so you can not use some parts of Loki." + #undef COMPILER_ALLOWS_THREAD_LOCAL_STORAGE + #endif + + #elif ( __GNUC__ == 4 ) // GNU versions other than Cygwin. + #if ( __GNUC_MINOR__ == 4 ) + #warning "GCC version 4.4 implements thread_local storage incorrectly, so you can not use some parts of Loki." + #undef COMPILER_ALLOWS_THREAD_LOCAL_STORAGE + #endif + #endif #endif #if defined( LOKI_THINKS_COMPILER_ALLOWS_THREAD_LOCAL_STORAGE ) && !defined( LOKI_THREAD_LOCAL )