Set V8_CC_GNU or V8_CC_MSVC for clang in gcc / cl mode.

Also, remove V8_CC_CLANG since it's not read anywhere (and ideally shouldn't
be).

Clang tries to be compatible with gcc in clang mode, and with msvc in clang-cl
mode. It wants to go down the same code paths that these compilers want to go
down in most cases.

For example, V8PRIxPTR was set incorrectly on Windows 64-bit before this change
since macros.h assumed that checking for V8_CC_MSVC is enough to find LLP64
systems, but V8_CC_MSVC wasn't set for clang.  Most other existing checks for
V8_CC_MSVC should be taken for clang-cl too (and for the remaining ones,
clang-cl is happy with either code path).

Likewise, V8_IMMEDIATE_CRASH is currently set to a suboptimal value with clang
since __builtin_trap() is only used if V8_CC_GNU is set.

Including clang in the gcc and cl macros is also what chromium does.

BUG=chromium:82385
LOG=y

Review URL: https://codereview.chromium.org/757553004

Cr-Commit-Position: refs/heads/master@{#25592}
This commit is contained in:
thakis 2014-12-01 21:23:09 -08:00 committed by Commit bot
parent c516d4f094
commit 643c24eb95

View File

@ -142,13 +142,12 @@
// -----------------------------------------------------------------------------
// Compiler detection
//
// V8_CC_CLANG - Clang
// V8_CC_GNU - GNU C++
// V8_CC_GNU - GCC, or clang in gcc mode
// V8_CC_INTEL - Intel C++
// V8_CC_MINGW - Minimalist GNU for Windows
// V8_CC_MINGW32 - Minimalist GNU for Windows (mingw32)
// V8_CC_MINGW64 - Minimalist GNU for Windows (mingw-w64)
// V8_CC_MSVC - Microsoft Visual C/C++
// V8_CC_MSVC - Microsoft Visual C/C++, or clang in cl.exe mode
//
// C++11 feature detection
//
@ -193,7 +192,11 @@
#if defined(__clang__)
# define V8_CC_CLANG 1
#if defined(__GNUC__) // Clang in gcc mode.
# define V8_CC_GNU 1
#elif defined(_MSC_VER) // Clang in cl mode.
# define V8_CC_MSVC 1
#endif
// Clang defines __alignof__ as alias for __alignof
# define V8_HAS___ALIGNOF 1