Reviewers: Benedikt Meurer,

Message:
Useful cs links:
https://code.google.com/p/chromium/codesearch#chromium/src/v8/include/v8config.h&q=v8_cc_clang&sq=package:chromium&type=cs&l=196
https://code.google.com/p/chromium/codesearch#search/&q=v8_cc_gnu&sq=package:chromium&type=cs
https://code.google.com/p/chromium/codesearch#search/&q=v8_cc_msvc&sq=package:chromium&type=cs

I think getting rid of the whole __clang__ block and conditionally setting a few
flags in the gcc block would be nice too, but one step at a time. (clang
masquerades as gcc 4.2, so most of the settings in the gcc block would already
be correct automatically.)

Unrelated questions I had while reading this file: Do you really support gccs as
old as 2.95? What's your minimum supported version? Do you intend to require
c++11 at some point?

Description:
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

Please review this at https://codereview.chromium.org/757553004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+7, -4 lines):
  M include/v8config.h


Index: include/v8config.h
diff --git a/include/v8config.h b/include/v8config.h
index 721ef373222d533f5730cd8d8d78bd8bdd9ec92d..d1ca22c229708a1611e065c4dbe8be10d20504ad 100644
--- a/include/v8config.h
+++ b/include/v8config.h
@@ -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


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to