Fixed ugly workaround for compiler detection

Corrected ugly workaround for compiler detection in code with
correct definition in llpreprocessor.h and updated various #if
to reflect this.
This commit is contained in:
Drake Arconis
2012-07-10 14:15:59 -04:00
parent bcefad1a97
commit edb144bd1d
6 changed files with 30 additions and 22 deletions

View File

@@ -130,7 +130,6 @@ if (LINUX)
add_definitions(-DLL_IGNORE_SIGCHLD)
if(${CMAKE_C_COMPILER} MATCHES "gcc*")
find_program(GXX g++)
mark_as_advanced(GXX)
@@ -183,9 +182,6 @@ if (LINUX)
# End of hacks.
#GCC Specific
add_definitions(-DCC_GCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
if (NOT STANDALONE)
@@ -217,7 +213,6 @@ if (LINUX)
mark_as_advanced(CLANGXX)
add_definitions(
-DCC_CLANG
-D_FORTIFY_SOURCE=2
)
@@ -237,12 +232,10 @@ if (LINUX)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}${MARCH_FLAG} -msse2")
elseif(${CMAKE_C_COMPILER} MATCHES "icc*" AND ${CMAKE_CXX_COMPILER} MATCHES "icpc*")
find_program(ICC icc)
mark_as_advanced(ICC)
add_definitions(
-DCC_ICC
-D_FORTIFY_SOURCE=2
)

View File

@@ -39,17 +39,13 @@
#include <hash_map>
#include <algorithm>
#elif LL_DARWIN || LL_LINUX
#if CC_GCC || CC_ICC
# if GCC_VERSION >= 40300 || CC_ICC// gcc 4.3 or icc 11 and up
# include <backward/hashtable.h>
# elif GCC_VERSION >= 30400 // gcc 3.4 and up
# include <ext/hashtable.h>
# elif __GNUC__ >= 3
# include <ext/stl_hashtable.h>
# else
# include <hashtable.h>
# endif
#elif CC_CLANG
#if GCC_VERSION >= 40300 || LL_ICC// gcc 4.3 or icc 11 and up
# include <backward/hashtable.h>
#elif GCC_VERSION >= 30400 // gcc 3.4 and up
# include <ext/hashtable.h>
#elif __GNUC__ >= 3
# include <ext/stl_hashtable.h>
#else
# include <hashtable.h>
#endif
#elif LL_SOLARIS

View File

@@ -78,7 +78,18 @@
// Figure out differences between compilers
#if defined(__GNUC__)
#if defined(__clang__) && defined(__GNUC__)
#define CLANG_VERSION (__clang_major__ * 10000 \
+ __clang_minor__ * 100 \
+ __clang_patchlevel__)
#ifndef LL_CLANG
#define LL_CLANG 1
#endif
#elif defined (__ICC) && defined(__GNUC__)
#ifndef LL_ICC
#define LL_ICC 1
#endif
#elif defined(__GNUC__)
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)

View File

@@ -55,10 +55,10 @@
# define LL_X86 1
#elif LL_MSVC && _M_IX86
# define LL_X86 1
#elif LL_GNUC && ( defined(__amd64__) || defined(__x86_64__) )
#elif LL_GNUC || LL_ICC || LL_CLANG && ( defined(__amd64__) || defined(__x86_64__) )
# define LL_X86_64 1
# define LL_X86 1
#elif LL_GNUC && ( defined(__i386__) )
#elif LL_GNUC || LL_ICC || LL_CLANG && ( defined(__i386__) )
# define LL_X86 1
#elif LL_GNUC && ( defined(__powerpc__) || defined(__ppc__) )
# define LL_PPC 1

View File

@@ -151,6 +151,14 @@ LLFloaterAbout::LLFloaterAbout()
support.append(llformat("Built with MSVC version %d\n\n", _MSC_VER));
#endif
#if LL_CLANG
support.append(llformat("Built with Clang version %d\n\n", CLANG_VERSION));
#endif
#if LL_ICC
support.append(llformat("Built with ICC version %d\n\n", __ICC));
#endif
#if LL_GNUC
support.append(llformat("Built with GCC version %d\n\n", GCC_VERSION));
#endif

View File

@@ -20,7 +20,7 @@
#include <stack>
#include "rlvcommon.h"
#if LL_GNUC
#if LL_GNUC || LL_ICC || LL_CLANG
#include "rlvhelper.h" // Needed to make GCC happy
#endif // LL_GNUC