| 1 | /* |
| 2 | * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 | * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 15 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 18 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 19 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 21 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | |
| 27 | #ifndef WTF_Platform_h |
| 28 | #define WTF_Platform_h |
| 29 | |
| 30 | /* ==== PLATFORM handles OS, operating environment, graphics API, and |
| 31 | CPU. This macro will be phased out in favor of platform adaptation |
| 32 | macros, policy decision macros, and top-level port definitions. ==== */ |
| 33 | #define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE) |
| 34 | |
| 35 | |
| 36 | /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */ |
| 37 | |
| 38 | /* COMPILER() - the compiler being used to build the project */ |
| 39 | #define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE) |
| 40 | /* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */ |
| 41 | #define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) (defined WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE && WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE) |
| 42 | |
| 43 | /* CPU() - the target CPU architecture */ |
| 44 | #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE) |
| 45 | /* HAVE() - specific system features (headers, functions or similar) that are present or not */ |
| 46 | #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) |
| 47 | /* OS() - underlying operating system; only to be used for mandated low-level services like |
| 48 | virtual memory, not to choose a GUI toolkit */ |
| 49 | #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) |
| 50 | |
| 51 | |
| 52 | /* ==== Policy decision macros: these define policy choices for a particular port. ==== */ |
| 53 | |
| 54 | /* USE() - use a particular third-party library or optional OS service */ |
| 55 | #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE) |
| 56 | /* ENABLE() - turn on a specific feature of WebKit */ |
| 57 | #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE) |
| 58 | |
| 59 | |
| 60 | |
| 61 | /* ==== COMPILER() - the compiler being used to build the project ==== */ |
| 62 | |
| 63 | /* COMPILER(CLANG) - Clang */ |
| 64 | #if defined(__clang__) |
| 65 | #define WTF_COMPILER_CLANG 1 |
| 66 | |
| 67 | #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_feature(c_static_assert) |
| 68 | #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_feature(cxx_static_assert) |
| 69 | #endif |
| 70 | |
| 71 | /* COMPILER(MSVC) Microsoft Visual C++ */ |
| 72 | /* COMPILER(MSVC7) Microsoft Visual C++ v7 or lower*/ |
| 73 | #if defined(_MSC_VER) |
| 74 | #define WTF_COMPILER_MSVC 1 |
| 75 | #if _MSC_VER < 1400 |
| 76 | #define WTF_COMPILER_MSVC7 1 |
| 77 | #endif |
| 78 | #endif |
| 79 | |
| 80 | /* COMPILER(RVCT) - ARM RealView Compilation Tools */ |
| 81 | #if defined(__CC_ARM) || defined(__ARMCC__) |
| 82 | #define WTF_COMPILER_RVCT 1 |
| 83 | #endif |
| 84 | |
| 85 | /* COMPILER(GCC) - GNU Compiler Collection */ |
| 86 | /* --gnu option of the RVCT compiler also defines __GNUC__ */ |
| 87 | #if defined(__GNUC__) && !COMPILER(RVCT) |
| 88 | #define WTF_COMPILER_GCC 1 |
| 89 | #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
| 90 | #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch)) |
| 91 | #else |
| 92 | /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */ |
| 93 | #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 |
| 94 | #endif |
| 95 | |
| 96 | /* Specific compiler features */ |
| 97 | #if COMPILER(GCC) && !COMPILER(CLANG) |
| 98 | #if GCC_VERSION_AT_LEAST(4, 8, 0) |
| 99 | #pragma GCC diagnostic ignored "-Wunused-local-typedefs" |
| 100 | #endif |
| 101 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L |
| 102 | /* C11 support */ |
| 103 | #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1 |
| 104 | #endif |
| 105 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) |
| 106 | /* C++11 support */ |
| 107 | #if GCC_VERSION_AT_LEAST(4, 3, 0) |
| 108 | #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1 |
| 109 | #endif |
| 110 | #endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) */ |
| 111 | #endif /* COMPILER(GCC) */ |
| 112 | |
| 113 | |
| 114 | /* COMPILER(MINGW) - MinGW GCC */ |
| 115 | /* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */ |
| 116 | #if defined(__MINGW32__) |
| 117 | #define WTF_COMPILER_MINGW 1 |
| 118 | #include <_mingw.h> /* private MinGW header */ |
| 119 | #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */ |
| 120 | #define WTF_COMPILER_MINGW64 1 |
| 121 | #endif /* __MINGW64_VERSION_MAJOR */ |
| 122 | #endif /* __MINGW32__ */ |
| 123 | |
| 124 | /* COMPILER(SUNCC) - Sun CC compiler, also known as Sun Studio or Sun Pro */ |
| 125 | #if defined(__SUNPRO_CC) || defined(__SUNPRO_C) |
| 126 | #define WTF_COMPILER_SUNCC 1 |
| 127 | #endif |
| 128 | |
| 129 | /* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */ |
| 130 | #if defined(__WINSCW__) |
| 131 | #define WTF_COMPILER_WINSCW 1 |
| 132 | #endif |
| 133 | |
| 134 | /* COMPILER(INTEL) - Intel C++ Compiler */ |
| 135 | #if defined(__INTEL_COMPILER) |
| 136 | #define WTF_COMPILER_INTEL 1 |
| 137 | #endif |
| 138 | |
| 139 | /* COMPILER(ACC) - HP aCC */ |
| 140 | #if defined(__HP_aCC) |
| 141 | #define WTF_COMPILER_ACC 1 |
| 142 | #endif |
| 143 | |
| 144 | /* COMPILER(XLC) - IBM XL */ |
| 145 | #if defined(__xlC__) |
| 146 | #define WTF_COMPILER_XLC 1 |
| 147 | #endif |
| 148 | |
| 149 | |
| 150 | /* ==== CPU() - the target CPU architecture ==== */ |
| 151 | |
| 152 | /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */ |
| 153 | |
| 154 | /* CPU(ALPHA) - DEC Alpha */ |
| 155 | #if defined(__alpha__) |
| 156 | #define WTF_CPU_ALPHA 1 |
| 157 | #endif |
| 158 | |
| 159 | /* CPU(IA64) - Itanium / IA-64 */ |
| 160 | #if defined(__ia64__) || defined(__ia64) || defined(_M_IA64) |
| 161 | #define WTF_CPU_IA64 1 |
| 162 | /* 32-bit mode on Itanium */ |
| 163 | #if !defined(__LP64__) |
| 164 | #define WTF_CPU_IA64_32 1 |
| 165 | #endif |
| 166 | /* Itanium can be both big- and little-endian; |
| 167 | we need to determine at compile time which one it is. |
| 168 | - HP's aCC compiler only compiles big-endian (so HP-UXi is always big-endian) |
| 169 | - GCC defines __BIG_ENDIAN__ for us (default on HP-UX) |
| 170 | - Linux is usually little-endian |
| 171 | - I've never seen AIX or Windows on IA-64, but they should be little-endian too |
| 172 | */ |
| 173 | #if defined(__BIG_ENDIAN__) || defined(__HP_aCC) |
| 174 | # define WTF_CPU_BIG_ENDIAN 1 |
| 175 | #endif |
| 176 | #endif |
| 177 | |
| 178 | /* CPU(HPPA) - a.k.a. PA-RISC */ |
| 179 | #if defined(__hppa) || defined(__hppa__) |
| 180 | #define WTF_CPU_HPPA 1 |
| 181 | #define WTF_CPU_BIG_ENDIAN 1 |
| 182 | #endif |
| 183 | |
| 184 | /* CPU(PPC) - PowerPC 32-bit */ |
| 185 | #if defined(__ppc__) \ |
| 186 | || defined(__PPC__) \ |
| 187 | || defined(__powerpc__) \ |
| 188 | || defined(__powerpc) \ |
| 189 | || defined(__POWERPC__) \ |
| 190 | || defined(_M_PPC) \ |
| 191 | || defined(__PPC) |
| 192 | #define WTF_CPU_PPC 1 |
| 193 | #ifndef __LITTLE_ENDIAN__ |
| 194 | #define WTF_CPU_BIG_ENDIAN 1 |
| 195 | #endif |
| 196 | #endif |
| 197 | |
| 198 | /* CPU(PPC64) - PowerPC 64-bit */ |
| 199 | #if defined(__ppc64__) \ |
| 200 | || defined(__PPC64__) |
| 201 | #define WTF_CPU_PPC64 1 |
| 202 | #ifndef __LITTLE_ENDIAN__ |
| 203 | #define WTF_CPU_BIG_ENDIAN 1 |
| 204 | #endif |
| 205 | #endif |
| 206 | |
| 207 | /* CPU(SH4) - SuperH SH-4 */ |
| 208 | #if defined(__SH4__) |
| 209 | #define WTF_CPU_SH4 1 |
| 210 | #endif |
| 211 | |
| 212 | /* CPU(SPARC32) - SPARC 32-bit */ |
| 213 | #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8) |
| 214 | #define WTF_CPU_SPARC32 1 |
| 215 | #define WTF_CPU_BIG_ENDIAN 1 |
| 216 | #endif |
| 217 | |
| 218 | /* CPU(SPARC64) - SPARC 64-bit */ |
| 219 | #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9) |
| 220 | #define WTF_CPU_SPARC64 1 |
| 221 | #define WTF_CPU_BIG_ENDIAN 1 |
| 222 | #endif |
| 223 | |
| 224 | /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */ |
| 225 | #if CPU(SPARC32) || CPU(SPARC64) |
| 226 | #define WTF_CPU_SPARC 1 |
| 227 | #endif |
| 228 | |
| 229 | /* CPU(X86) - i386 / x86 32-bit */ |
| 230 | #if defined(__i386__) \ |
| 231 | || defined(i386) \ |
| 232 | || defined(_M_IX86) \ |
| 233 | || defined(_X86_) \ |
| 234 | || defined(__THW_INTEL) |
| 235 | #define WTF_CPU_X86 1 |
| 236 | #endif |
| 237 | |
| 238 | /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */ |
| 239 | #if defined(__x86_64__) \ |
| 240 | || defined(_M_X64) |
| 241 | #define WTF_CPU_X86_64 1 |
| 242 | |
| 243 | #if defined(__ILP32__) |
| 244 | #define WTF_CPU_X32 1 |
| 245 | #endif |
| 246 | |
| 247 | #endif |
| 248 | |
| 249 | /* 64-bit mode on AIX */ |
| 250 | #ifdef __64BIT__ |
| 251 | #define WTF_CPU_AIX64 1 |
| 252 | #endif |
| 253 | |
| 254 | /* CPU(AARCH64) - AArch64 */ |
| 255 | #if defined(__aarch64__) || defined(_M_ARM64) |
| 256 | #define WTF_CPU_AARCH64 1 |
| 257 | #if defined(__AARCH64EB__) |
| 258 | #define WTF_CPU_BIG_ENDIAN 1 |
| 259 | #endif |
| 260 | #endif |
| 261 | |
| 262 | /* CPU(ARM) - ARM, any version*/ |
| 263 | #if defined(arm) \ |
| 264 | || defined(__arm__) \ |
| 265 | || defined(__MARM__) |
| 266 | #define WTF_CPU_ARM 1 |
| 267 | |
| 268 | #if defined(__ARMEB__) |
| 269 | #define WTF_CPU_BIG_ENDIAN 1 |
| 270 | |
| 271 | #elif !defined(__ARM_EABI__) \ |
| 272 | && !defined(__EABI__) \ |
| 273 | && !defined(__VFP_FP__) \ |
| 274 | && !defined(ANDROID) |
| 275 | #define WTF_CPU_MIDDLE_ENDIAN 1 |
| 276 | |
| 277 | #endif |
| 278 | |
| 279 | #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N) |
| 280 | |
| 281 | /* Set WTF_ARM_ARCH_VERSION */ |
| 282 | #if defined(__ARM_ARCH_4__) \ |
| 283 | || defined(__ARM_ARCH_4T__) \ |
| 284 | || defined(__MARM_ARMV4__) \ |
| 285 | || defined(_ARMV4I_) |
| 286 | #define WTF_ARM_ARCH_VERSION 4 |
| 287 | |
| 288 | #elif defined(__ARM_ARCH_5__) \ |
| 289 | || defined(__ARM_ARCH_5T__) \ |
| 290 | || defined(__ARM_ARCH_5E__) \ |
| 291 | || defined(__ARM_ARCH_5TE__) \ |
| 292 | || defined(__ARM_ARCH_5TEJ__) \ |
| 293 | || defined(__MARM_ARMV5__) |
| 294 | #define WTF_ARM_ARCH_VERSION 5 |
| 295 | |
| 296 | #elif defined(__ARM_ARCH_6__) \ |
| 297 | || defined(__ARM_ARCH_6J__) \ |
| 298 | || defined(__ARM_ARCH_6K__) \ |
| 299 | || defined(__ARM_ARCH_6Z__) \ |
| 300 | || defined(__ARM_ARCH_6ZK__) \ |
| 301 | || defined(__ARM_ARCH_6T2__) \ |
| 302 | || defined(__ARMV6__) |
| 303 | #define WTF_ARM_ARCH_VERSION 6 |
| 304 | |
| 305 | #elif defined(__ARM_ARCH_7A__) \ |
| 306 | || defined(__ARM_ARCH_7R__) |
| 307 | #define WTF_ARM_ARCH_VERSION 7 |
| 308 | |
| 309 | /* RVCT sets _TARGET_ARCH_ARM */ |
| 310 | #elif defined(__TARGET_ARCH_ARM) |
| 311 | #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM |
| 312 | |
| 313 | #else |
| 314 | #define WTF_ARM_ARCH_VERSION 0 |
| 315 | |
| 316 | #endif |
| 317 | |
| 318 | /* Set WTF_THUMB_ARCH_VERSION */ |
| 319 | #if defined(__ARM_ARCH_4T__) |
| 320 | #define WTF_THUMB_ARCH_VERSION 1 |
| 321 | |
| 322 | #elif defined(__ARM_ARCH_5T__) \ |
| 323 | || defined(__ARM_ARCH_5TE__) \ |
| 324 | || defined(__ARM_ARCH_5TEJ__) |
| 325 | #define WTF_THUMB_ARCH_VERSION 2 |
| 326 | |
| 327 | #elif defined(__ARM_ARCH_6J__) \ |
| 328 | || defined(__ARM_ARCH_6K__) \ |
| 329 | || defined(__ARM_ARCH_6Z__) \ |
| 330 | || defined(__ARM_ARCH_6ZK__) \ |
| 331 | || defined(__ARM_ARCH_6M__) |
| 332 | #define WTF_THUMB_ARCH_VERSION 3 |
| 333 | |
| 334 | #elif defined(__ARM_ARCH_6T2__) \ |
| 335 | || defined(__ARM_ARCH_7__) \ |
| 336 | || defined(__ARM_ARCH_7A__) \ |
| 337 | || defined(__ARM_ARCH_7R__) \ |
| 338 | || defined(__ARM_ARCH_7M__) |
| 339 | #define WTF_THUMB_ARCH_VERSION 4 |
| 340 | |
| 341 | /* RVCT sets __TARGET_ARCH_THUMB */ |
| 342 | #elif defined(__TARGET_ARCH_THUMB) |
| 343 | #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB |
| 344 | |
| 345 | #else |
| 346 | #define WTF_THUMB_ARCH_VERSION 0 |
| 347 | #endif |
| 348 | |
| 349 | |
| 350 | /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */ |
| 351 | /* On ARMv5 and below the natural alignment is required. |
| 352 | And there are some other differences for v5 or earlier. */ |
| 353 | #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6) |
| 354 | #define WTF_CPU_ARMV5_OR_LOWER 1 |
| 355 | #endif |
| 356 | |
| 357 | |
| 358 | /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */ |
| 359 | /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */ |
| 360 | /* Only one of these will be defined. */ |
| 361 | #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) |
| 362 | # if defined(thumb2) || defined(__thumb2__) \ |
| 363 | || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) |
| 364 | # define WTF_CPU_ARM_TRADITIONAL 0 |
| 365 | # define WTF_CPU_ARM_THUMB2 1 |
| 366 | # elif WTF_ARM_ARCH_AT_LEAST(4) |
| 367 | # define WTF_CPU_ARM_TRADITIONAL 1 |
| 368 | # define WTF_CPU_ARM_THUMB2 0 |
| 369 | # else |
| 370 | # error "Not supported ARM architecture" |
| 371 | # endif |
| 372 | #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */ |
| 373 | # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms" |
| 374 | #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */ |
| 375 | |
| 376 | #endif /* ARM */ |
| 377 | |
| 378 | #if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)) |
| 379 | #define WTF_CPU_MIPS 1 |
| 380 | #include <sgidefs.h> |
| 381 | #if defined(__MIPSEB__) |
| 382 | #define WTF_CPU_BIG_ENDIAN 1 |
| 383 | #endif |
| 384 | /* CPU(MIPS64) - MIPS 64-bit both BIG and LITTLE endian */ |
| 385 | #if defined(_MIPS_SIM_ABI64) && (_MIPS_SIM == _MIPS_SIM_ABI64) |
| 386 | #define WTF_CPU_MIPS64 1 |
| 387 | #endif |
| 388 | |
| 389 | /* CPU(MIPSN32) - MIPS N32 ABI both BIG and LITTLE endian */ |
| 390 | #if defined(_MIPS_SIM_ABIN32) && (_MIPS_SIM == _MIPS_SIM_ABIN32) |
| 391 | #define WTF_CPU_MIPSN32 1 |
| 392 | #endif |
| 393 | |
| 394 | /* CPU(MIPS32) - MIPS O32 ABI both BIG and LITTLE endian */ |
| 395 | #if defined(_MIPS_SIM_ABI32) && (_MIPS_SIM == _MIPS_SIM_ABI32) |
| 396 | #define WTF_CPU_MIPS32 1 |
| 397 | #endif |
| 398 | #endif /* __mips__ */ |
| 399 | |
| 400 | /* CPU(RISCV64) - RISC-V 64-bit */ |
| 401 | #if defined(__riscv) && __riscv_xlen == 64 |
| 402 | #define WTF_CPU_RISCV64 1 |
| 403 | #endif |
| 404 | |
| 405 | /* CPU(RISCV32) - RISC-V 32-bit */ |
| 406 | #if defined(__riscv) && __riscv_xlen == 32 |
| 407 | #define WTF_CPU_RISCV32 1 |
| 408 | #endif |
| 409 | |
| 410 | /* ==== OS() - underlying operating system; only to be used for mandated low-level services like |
| 411 | virtual memory, not to choose a GUI toolkit ==== */ |
| 412 | |
| 413 | /* OS(ANDROID) - Android */ |
| 414 | #ifdef ANDROID |
| 415 | #define WTF_OS_ANDROID 1 |
| 416 | #endif |
| 417 | |
| 418 | /* OS(AIX) - AIX */ |
| 419 | #ifdef _AIX |
| 420 | #define WTF_OS_AIX 1 |
| 421 | #endif |
| 422 | |
| 423 | /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ |
| 424 | #ifdef __APPLE__ |
| 425 | #define WTF_OS_DARWIN 1 |
| 426 | |
| 427 | /* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */ |
| 428 | #include <AvailabilityMacros.h> |
| 429 | #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 |
| 430 | #define BUILDING_ON_TIGER 1 |
| 431 | #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
| 432 | #define BUILDING_ON_LEOPARD 1 |
| 433 | #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 434 | #define BUILDING_ON_SNOW_LEOPARD 1 |
| 435 | #endif |
| 436 | #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 |
| 437 | #define TARGETING_TIGER 1 |
| 438 | #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 |
| 439 | #define TARGETING_LEOPARD 1 |
| 440 | #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 |
| 441 | #define TARGETING_SNOW_LEOPARD 1 |
| 442 | #endif |
| 443 | #include <TargetConditionals.h> |
| 444 | |
| 445 | #endif |
| 446 | |
| 447 | /* OS(IPHONE_OS) - iPhone OS */ |
| 448 | /* OS(MAC_OS_X) - Mac OS X (not including iPhone OS) */ |
| 449 | #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \ |
| 450 | || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \ |
| 451 | || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) |
| 452 | #define WTF_OS_IPHONE_OS 1 |
| 453 | #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC |
| 454 | #define WTF_OS_MAC_OS_X 1 |
| 455 | #endif |
| 456 | |
| 457 | /* OS(FREEBSD) - FreeBSD */ |
| 458 | #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) |
| 459 | #define WTF_OS_FREEBSD 1 |
| 460 | #endif |
| 461 | |
| 462 | /* OS(HAIKU) - Haiku */ |
| 463 | #ifdef __HAIKU__ |
| 464 | #define WTF_OS_HAIKU 1 |
| 465 | #endif |
| 466 | |
| 467 | /* OS(HPUX) - HP-UX */ |
| 468 | #if defined(hpux) || defined(__hpux) |
| 469 | #define WTF_OS_HPUX 1 |
| 470 | #ifndef MAP_ANON |
| 471 | #define MAP_ANON MAP_ANONYMOUS |
| 472 | #endif |
| 473 | #endif |
| 474 | |
| 475 | /* OS(LINUX) - Linux */ |
| 476 | #ifdef __linux__ |
| 477 | #define WTF_OS_LINUX 1 |
| 478 | #endif |
| 479 | |
| 480 | /* OS(NETBSD) - NetBSD */ |
| 481 | #if defined(__NetBSD__) |
| 482 | #define WTF_PLATFORM_NETBSD 1 |
| 483 | #endif |
| 484 | |
| 485 | /* OS(OPENBSD) - OpenBSD */ |
| 486 | #ifdef __OpenBSD__ |
| 487 | #define WTF_OS_OPENBSD 1 |
| 488 | #endif |
| 489 | |
| 490 | /* OS(QNX) - QNX */ |
| 491 | #if defined(__QNXNTO__) |
| 492 | #define WTF_OS_QNX 1 |
| 493 | #endif |
| 494 | |
| 495 | /* OS(SOLARIS) - Solaris */ |
| 496 | #if defined(sun) || defined(__sun) |
| 497 | #define WTF_OS_SOLARIS 1 |
| 498 | #endif |
| 499 | |
| 500 | /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */ |
| 501 | #if defined(_WIN32_WCE) |
| 502 | #define WTF_OS_WINCE 1 |
| 503 | #endif |
| 504 | |
| 505 | /* OS(WINDOWS) - Any version of Windows */ |
| 506 | #if defined(WIN32) || defined(_WIN32) |
| 507 | #define WTF_OS_WINDOWS 1 |
| 508 | #endif |
| 509 | |
| 510 | /* OS(SYMBIAN) - Symbian */ |
| 511 | #if defined (__SYMBIAN32__) |
| 512 | /* we are cross-compiling, it is not really windows */ |
| 513 | #undef WTF_OS_WINDOWS |
| 514 | #undef WTF_PLATFORM_WIN |
| 515 | #define WTF_OS_SYMBIAN 1 |
| 516 | #endif |
| 517 | |
| 518 | /* OS(UNIX) - Any Unix-like system */ |
| 519 | #if OS(AIX) \ |
| 520 | || OS(ANDROID) \ |
| 521 | || OS(DARWIN) \ |
| 522 | || OS(FREEBSD) \ |
| 523 | || OS(HAIKU) \ |
| 524 | || OS(HPUX) \ |
| 525 | || OS(LINUX) \ |
| 526 | || OS(NETBSD) \ |
| 527 | || OS(OPENBSD) \ |
| 528 | || OS(QNX) \ |
| 529 | || OS(SOLARIS) \ |
| 530 | || OS(SYMBIAN) \ |
| 531 | || defined(unix) \ |
| 532 | || defined(__unix) \ |
| 533 | || defined(__unix__) |
| 534 | #define WTF_OS_UNIX 1 |
| 535 | |
| 536 | #endif |
| 537 | |
| 538 | /* Operating environments */ |
| 539 | |
| 540 | /* FIXME: these are all mixes of OS, operating environment and policy choices. */ |
| 541 | /* PLATFORM(CHROMIUM) */ |
| 542 | /* PLATFORM(QT) */ |
| 543 | /* PLATFORM(WX) */ |
| 544 | /* PLATFORM(GTK) */ |
| 545 | /* PLATFORM(HAIKU) */ |
| 546 | /* PLATFORM(MAC) */ |
| 547 | /* PLATFORM(WIN) */ |
| 548 | #if defined(BUILDING_CHROMIUM__) |
| 549 | #define WTF_PLATFORM_CHROMIUM 1 |
| 550 | #elif defined(BUILDING_QT__) |
| 551 | #define WTF_PLATFORM_QT 1 |
| 552 | #elif defined(BUILDING_WX__) |
| 553 | #define WTF_PLATFORM_WX 1 |
| 554 | #elif defined(BUILDING_GTK__) |
| 555 | #define WTF_PLATFORM_GTK 1 |
| 556 | #elif defined(BUILDING_HAIKU__) |
| 557 | #define WTF_PLATFORM_HAIKU 1 |
| 558 | #elif OS(DARWIN) |
| 559 | #define WTF_PLATFORM_MAC 1 |
| 560 | #elif OS(WINDOWS) |
| 561 | #define WTF_PLATFORM_WIN 1 |
| 562 | #endif |
| 563 | |
| 564 | #if !PLATFORM(QT) |
| 565 | /* PLATFORM(IPHONE) */ |
| 566 | /* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */ |
| 567 | #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) |
| 568 | #define WTF_PLATFORM_IPHONE 1 |
| 569 | #endif |
| 570 | |
| 571 | /* PLATFORM(IPHONE_SIMULATOR) */ |
| 572 | #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR |
| 573 | #define WTF_PLATFORM_IPHONE 1 |
| 574 | #define WTF_PLATFORM_IPHONE_SIMULATOR 1 |
| 575 | #else |
| 576 | #define WTF_PLATFORM_IPHONE_SIMULATOR 0 |
| 577 | #endif |
| 578 | |
| 579 | #if !defined(WTF_PLATFORM_IPHONE) |
| 580 | #define WTF_PLATFORM_IPHONE 0 |
| 581 | #endif |
| 582 | #endif |
| 583 | |
| 584 | /* PLATFORM(ANDROID) */ |
| 585 | /* FIXME: this is sometimes used as an OS() switch, and other times to drive |
| 586 | policy choices */ |
| 587 | #if defined(ANDROID) |
| 588 | #define WTF_PLATFORM_ANDROID 1 |
| 589 | #endif |
| 590 | |
| 591 | /* Graphics engines */ |
| 592 | |
| 593 | /* PLATFORM(CG) and PLATFORM(CI) */ |
| 594 | #if PLATFORM(MAC) || PLATFORM(IPHONE) |
| 595 | #define WTF_PLATFORM_CG 1 |
| 596 | #endif |
| 597 | #if PLATFORM(MAC) && !PLATFORM(IPHONE) |
| 598 | #define WTF_PLATFORM_CI 1 |
| 599 | #endif |
| 600 | |
| 601 | /* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */ |
| 602 | #if PLATFORM(CHROMIUM) |
| 603 | #define ENABLE_HISTORY_ALWAYS_ASYNC 1 |
| 604 | #if OS(DARWIN) |
| 605 | #define WTF_PLATFORM_CG 1 |
| 606 | #define WTF_PLATFORM_CI 1 |
| 607 | #define WTF_USE_ATSUI 1 |
| 608 | #define WTF_USE_CORE_TEXT 1 |
| 609 | #else |
| 610 | #define WTF_PLATFORM_SKIA 1 |
| 611 | #endif |
| 612 | #endif |
| 613 | |
| 614 | #if PLATFORM(GTK) |
| 615 | #define WTF_PLATFORM_CAIRO 1 |
| 616 | #endif |
| 617 | |
| 618 | |
| 619 | /* OS(WINCE) && PLATFORM(QT) |
| 620 | We can not determine the endianess at compile time. For |
| 621 | Qt for Windows CE the endianess is specified in the |
| 622 | device specific makespec |
| 623 | */ |
| 624 | #if OS(WINCE) && PLATFORM(QT) |
| 625 | # include <QtGlobal> |
| 626 | # undef WTF_CPU_BIG_ENDIAN |
| 627 | # undef WTF_CPU_MIDDLE_ENDIAN |
| 628 | # if Q_BYTE_ORDER == Q_BIG_ENDIAN |
| 629 | # define WTF_CPU_BIG_ENDIAN 1 |
| 630 | # endif |
| 631 | |
| 632 | # include <ce_time.h> |
| 633 | #endif |
| 634 | |
| 635 | #if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && OS(DARWIN) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS) |
| 636 | #define ENABLE_JSC_MULTIPLE_THREADS 1 |
| 637 | #endif |
| 638 | |
| 639 | /* On Windows, use QueryPerformanceCounter by default */ |
| 640 | #if OS(WINDOWS) |
| 641 | #define WTF_USE_QUERY_PERFORMANCE_COUNTER 1 |
| 642 | #endif |
| 643 | |
| 644 | #if OS(WINCE) && !PLATFORM(QT) |
| 645 | #undef ENABLE_JSC_MULTIPLE_THREADS |
| 646 | #define ENABLE_JSC_MULTIPLE_THREADS 0 |
| 647 | #define USE_SYSTEM_MALLOC 0 |
| 648 | #define ENABLE_ICONDATABASE 0 |
| 649 | #define ENABLE_JAVASCRIPT_DEBUGGER 0 |
| 650 | #define ENABLE_FTPDIR 0 |
| 651 | #define ENABLE_PAN_SCROLLING 0 |
| 652 | #define ENABLE_WML 1 |
| 653 | #define HAVE_ACCESSIBILITY 0 |
| 654 | |
| 655 | #define NOMINMAX /* Windows min and max conflict with standard macros */ |
| 656 | #define NOSHLWAPI /* shlwapi.h not available on WinCe */ |
| 657 | |
| 658 | /* MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. */ |
| 659 | #define __usp10__ /* disable "usp10.h" */ |
| 660 | |
| 661 | #define _INC_ASSERT /* disable "assert.h" */ |
| 662 | #define assert(x) |
| 663 | |
| 664 | /* _countof is only included in CE6; for CE5 we need to define it ourself */ |
| 665 | #ifndef _countof |
| 666 | #define _countof(x) (sizeof(x) / sizeof((x)[0])) |
| 667 | #endif |
| 668 | |
| 669 | #endif /* OS(WINCE) && !PLATFORM(QT) */ |
| 670 | |
| 671 | #if PLATFORM(QT) |
| 672 | #define WTF_USE_QT4_UNICODE 1 |
| 673 | #elif OS(WINCE) |
| 674 | #define WTF_USE_WINCE_UNICODE 1 |
| 675 | #elif PLATFORM(GTK) |
| 676 | /* The GTK+ Unicode backend is configurable */ |
| 677 | #else |
| 678 | #define WTF_USE_ICU_UNICODE 1 |
| 679 | #endif |
| 680 | |
| 681 | #if PLATFORM(MAC) && !PLATFORM(IPHONE) |
| 682 | #define WTF_PLATFORM_CF 1 |
| 683 | #define WTF_USE_PTHREADS 1 |
| 684 | #define HAVE_PTHREAD_RWLOCK 1 |
| 685 | #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && CPU(X86_64) |
| 686 | #define WTF_USE_PLUGIN_HOST_PROCESS 1 |
| 687 | #endif |
| 688 | #if !defined(ENABLE_MAC_JAVA_BRIDGE) |
| 689 | #define ENABLE_MAC_JAVA_BRIDGE 1 |
| 690 | #endif |
| 691 | #if !defined(ENABLE_DASHBOARD_SUPPORT) |
| 692 | #define ENABLE_DASHBOARD_SUPPORT 1 |
| 693 | #endif |
| 694 | #define HAVE_READLINE 1 |
| 695 | #define HAVE_RUNLOOP_TIMER 1 |
| 696 | #endif /* PLATFORM(MAC) && !PLATFORM(IPHONE) */ |
| 697 | |
| 698 | #if PLATFORM(CHROMIUM) && OS(DARWIN) |
| 699 | #define WTF_PLATFORM_CF 1 |
| 700 | #define WTF_USE_PTHREADS 1 |
| 701 | #define HAVE_PTHREAD_RWLOCK 1 |
| 702 | #endif |
| 703 | |
| 704 | #if PLATFORM(QT) && OS(DARWIN) |
| 705 | #define WTF_PLATFORM_CF 1 |
| 706 | #endif |
| 707 | |
| 708 | #if PLATFORM(IPHONE) |
| 709 | #define ENABLE_CONTEXT_MENUS 0 |
| 710 | #define ENABLE_DRAG_SUPPORT 0 |
| 711 | #define ENABLE_FTPDIR 1 |
| 712 | #define ENABLE_GEOLOCATION 1 |
| 713 | #define ENABLE_ICONDATABASE 0 |
| 714 | #define ENABLE_INSPECTOR 0 |
| 715 | #define ENABLE_MAC_JAVA_BRIDGE 0 |
| 716 | #define ENABLE_NETSCAPE_PLUGIN_API 0 |
| 717 | #define ENABLE_ORIENTATION_EVENTS 1 |
| 718 | #define ENABLE_REPAINT_THROTTLING 1 |
| 719 | #define HAVE_READLINE 1 |
| 720 | #define WTF_PLATFORM_CF 1 |
| 721 | #endif |
| 722 | |
| 723 | #if OS(IPHONE_OS) && !PLATFORM(QT) |
| 724 | #define WTF_USE_PTHREADS 1 |
| 725 | #define HAVE_PTHREAD_RWLOCK 1 |
| 726 | #endif |
| 727 | |
| 728 | #if PLATFORM(ANDROID) |
| 729 | #if !PLATFORM(QT) |
| 730 | #define WTF_USE_PTHREADS 1 |
| 731 | #define ENABLE_MAC_JAVA_BRIDGE 1 |
| 732 | #define ENABLE_JAVASCRIPT_DEBUGGER 0 |
| 733 | #endif /* !PLATFORM(QT) */ |
| 734 | #define WTF_PLATFORM_SGL 1 |
| 735 | #define USE_SYSTEM_MALLOC 1 |
| 736 | #define LOG_DISABLED 1 |
| 737 | /* Prevents Webkit from drawing the caret in textfields and textareas |
| 738 | This prevents unnecessary invals. */ |
| 739 | #define ENABLE_TEXT_CARET 1 |
| 740 | #endif /* PLATFORM(ANDROID) */ |
| 741 | |
| 742 | #if PLATFORM(WIN) |
| 743 | #define WTF_USE_WININET 1 |
| 744 | #endif |
| 745 | |
| 746 | #if PLATFORM(WX) |
| 747 | #define ENABLE_ASSEMBLER 1 |
| 748 | #if OS(DARWIN) |
| 749 | #define WTF_PLATFORM_CF 1 |
| 750 | #endif |
| 751 | #endif |
| 752 | |
| 753 | #if PLATFORM(GTK) |
| 754 | #if HAVE(PTHREAD_H) |
| 755 | #define WTF_USE_PTHREADS 1 |
| 756 | #define HAVE_PTHREAD_RWLOCK 1 |
| 757 | #endif |
| 758 | #endif |
| 759 | |
| 760 | #if PLATFORM(HAIKU) |
| 761 | #define HAVE_POSIX_MEMALIGN 1 |
| 762 | #define WTF_USE_CURL 1 |
| 763 | #define WTF_USE_PTHREADS 1 |
| 764 | #define HAVE_PTHREAD_RWLOCK 1 |
| 765 | #define USE_SYSTEM_MALLOC 1 |
| 766 | #define ENABLE_NETSCAPE_PLUGIN_API 0 |
| 767 | #endif |
| 768 | |
| 769 | #if !defined(HAVE_ACCESSIBILITY) |
| 770 | #if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) |
| 771 | #define HAVE_ACCESSIBILITY 1 |
| 772 | #endif |
| 773 | #endif /* !defined(HAVE_ACCESSIBILITY) */ |
| 774 | |
| 775 | #if OS(UNIX) && !OS(SYMBIAN) |
| 776 | #define HAVE_SIGNAL_H 1 |
| 777 | #endif |
| 778 | |
| 779 | #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \ |
| 780 | && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \ |
| 781 | && !OS(ANDROID) && !OS(AIX) && !OS(HPUX) |
| 782 | #define HAVE_TM_GMTOFF 1 |
| 783 | #define HAVE_TM_ZONE 1 |
| 784 | #define HAVE_TIMEGM 1 |
| 785 | #endif |
| 786 | |
| 787 | #if OS(DARWIN) |
| 788 | |
| 789 | #define HAVE_ERRNO_H 1 |
| 790 | #define HAVE_LANGINFO_H 1 |
| 791 | #define HAVE_MMAP 1 |
| 792 | #define HAVE_MERGESORT 1 |
| 793 | #define HAVE_SBRK 1 |
| 794 | #define HAVE_STRINGS_H 1 |
| 795 | #define HAVE_SYS_PARAM_H 1 |
| 796 | #define HAVE_SYS_TIME_H 1 |
| 797 | #define HAVE_SYS_TIMEB_H 1 |
| 798 | |
| 799 | #if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD) |
| 800 | |
| 801 | #define HAVE_DISPATCH_H 1 |
| 802 | |
| 803 | #if !PLATFORM(IPHONE) |
| 804 | #define HAVE_MADV_FREE_REUSE 1 |
| 805 | #define HAVE_MADV_FREE 1 |
| 806 | #define HAVE_PTHREAD_SETNAME_NP 1 |
| 807 | #endif |
| 808 | |
| 809 | #endif |
| 810 | |
| 811 | #if PLATFORM(IPHONE) |
| 812 | #define HAVE_MADV_FREE 1 |
| 813 | #endif |
| 814 | |
| 815 | #elif OS(WINDOWS) |
| 816 | |
| 817 | #if OS(WINCE) |
| 818 | #define HAVE_ERRNO_H 0 |
| 819 | #else |
| 820 | #define HAVE_SYS_TIMEB_H 1 |
| 821 | #endif |
| 822 | #define HAVE_VIRTUALALLOC 1 |
| 823 | |
| 824 | #elif OS(SYMBIAN) |
| 825 | |
| 826 | #define HAVE_ERRNO_H 1 |
| 827 | #define HAVE_MMAP 0 |
| 828 | #define HAVE_SBRK 1 |
| 829 | |
| 830 | #define HAVE_SYS_TIME_H 1 |
| 831 | #define HAVE_STRINGS_H 1 |
| 832 | |
| 833 | #if !COMPILER(RVCT) |
| 834 | #define HAVE_SYS_PARAM_H 1 |
| 835 | #endif |
| 836 | |
| 837 | #elif OS(QNX) |
| 838 | |
| 839 | #define HAVE_ERRNO_H 1 |
| 840 | #define HAVE_MMAP 1 |
| 841 | #define HAVE_SBRK 1 |
| 842 | #define HAVE_STRINGS_H 1 |
| 843 | #define HAVE_SYS_PARAM_H 1 |
| 844 | #define HAVE_SYS_TIME_H 1 |
| 845 | |
| 846 | #elif OS(ANDROID) |
| 847 | |
| 848 | #define HAVE_ERRNO_H 1 |
| 849 | #define HAVE_LANGINFO_H 0 |
| 850 | #define HAVE_MMAP 1 |
| 851 | #define HAVE_SBRK 1 |
| 852 | #define HAVE_STRINGS_H 1 |
| 853 | #define HAVE_SYS_PARAM_H 1 |
| 854 | #define HAVE_SYS_TIME_H 1 |
| 855 | |
| 856 | #else |
| 857 | |
| 858 | /* FIXME: is this actually used or do other platforms generate their own config.h? */ |
| 859 | |
| 860 | #define HAVE_ERRNO_H 1 |
| 861 | /* As long as Haiku doesn't have a complete support of locale this will be disabled. */ |
| 862 | #if !OS(HAIKU) |
| 863 | #define HAVE_LANGINFO_H 1 |
| 864 | #endif |
| 865 | #define HAVE_MMAP 1 |
| 866 | #define HAVE_SBRK 1 |
| 867 | #define HAVE_STRINGS_H 1 |
| 868 | #define HAVE_SYS_PARAM_H 1 |
| 869 | #define HAVE_SYS_TIME_H 1 |
| 870 | |
| 871 | #endif |
| 872 | |
| 873 | /* ENABLE macro defaults */ |
| 874 | |
| 875 | /* fastMalloc match validation allows for runtime verification that |
| 876 | new is matched by delete, fastMalloc is matched by fastFree, etc. */ |
| 877 | #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION) |
| 878 | #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0 |
| 879 | #endif |
| 880 | |
| 881 | #if !defined(ENABLE_ICONDATABASE) |
| 882 | #define ENABLE_ICONDATABASE 1 |
| 883 | #endif |
| 884 | |
| 885 | #if !defined(ENABLE_DATABASE) |
| 886 | #define ENABLE_DATABASE 1 |
| 887 | #endif |
| 888 | |
| 889 | #if !defined(ENABLE_JAVASCRIPT_DEBUGGER) |
| 890 | #define ENABLE_JAVASCRIPT_DEBUGGER 1 |
| 891 | #endif |
| 892 | |
| 893 | #if !defined(ENABLE_FTPDIR) |
| 894 | #define ENABLE_FTPDIR 1 |
| 895 | #endif |
| 896 | |
| 897 | #if !defined(ENABLE_CONTEXT_MENUS) |
| 898 | #define 1 |
| 899 | #endif |
| 900 | |
| 901 | #if !defined(ENABLE_DRAG_SUPPORT) |
| 902 | #define ENABLE_DRAG_SUPPORT 1 |
| 903 | #endif |
| 904 | |
| 905 | #if !defined(ENABLE_DASHBOARD_SUPPORT) |
| 906 | #define ENABLE_DASHBOARD_SUPPORT 0 |
| 907 | #endif |
| 908 | |
| 909 | #if !defined(ENABLE_INSPECTOR) |
| 910 | #define ENABLE_INSPECTOR 1 |
| 911 | #endif |
| 912 | |
| 913 | #if !defined(ENABLE_MAC_JAVA_BRIDGE) |
| 914 | #define ENABLE_MAC_JAVA_BRIDGE 0 |
| 915 | #endif |
| 916 | |
| 917 | #if !defined(ENABLE_NETSCAPE_PLUGIN_API) |
| 918 | #define ENABLE_NETSCAPE_PLUGIN_API 1 |
| 919 | #endif |
| 920 | |
| 921 | #if !defined(WTF_USE_PLUGIN_HOST_PROCESS) |
| 922 | #define WTF_USE_PLUGIN_HOST_PROCESS 0 |
| 923 | #endif |
| 924 | |
| 925 | #if !defined(ENABLE_ORIENTATION_EVENTS) |
| 926 | #define ENABLE_ORIENTATION_EVENTS 0 |
| 927 | #endif |
| 928 | |
| 929 | #if !defined(ENABLE_OPCODE_STATS) |
| 930 | #define ENABLE_OPCODE_STATS 0 |
| 931 | #endif |
| 932 | |
| 933 | #define ENABLE_SAMPLING_COUNTERS 0 |
| 934 | #define ENABLE_SAMPLING_FLAGS 0 |
| 935 | #define ENABLE_OPCODE_SAMPLING 0 |
| 936 | #define ENABLE_CODEBLOCK_SAMPLING 0 |
| 937 | #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING) |
| 938 | #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING" |
| 939 | #endif |
| 940 | #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) |
| 941 | #define ENABLE_SAMPLING_THREAD 1 |
| 942 | #endif |
| 943 | |
| 944 | #if !defined(ENABLE_GEOLOCATION) |
| 945 | #define ENABLE_GEOLOCATION 0 |
| 946 | #endif |
| 947 | |
| 948 | #if !defined(ENABLE_NOTIFICATIONS) |
| 949 | #define ENABLE_NOTIFICATIONS 0 |
| 950 | #endif |
| 951 | |
| 952 | #if !defined(ENABLE_TEXT_CARET) |
| 953 | #define ENABLE_TEXT_CARET 1 |
| 954 | #endif |
| 955 | |
| 956 | #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL) |
| 957 | #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0 |
| 958 | #endif |
| 959 | |
| 960 | #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) |
| 961 | #if (CPU(X86_64) && !CPU(X32) && (OS(UNIX) || OS(WINDOWS) || OS(SOLARIS) || OS(HPUX))) || (CPU(IA64) && !CPU(IA64_32)) || CPU(ALPHA) || CPU(AIX64) || CPU(SPARC64) || CPU(MIPS64) || CPU(AARCH64) || CPU(RISCV64) |
| 962 | #define WTF_USE_JSVALUE64 1 |
| 963 | #elif CPU(ARM) || CPU(PPC64) || CPU(RISCV32) |
| 964 | #define WTF_USE_JSVALUE32 1 |
| 965 | #elif OS(WINDOWS) && COMPILER(MINGW) |
| 966 | /* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg |
| 967 | on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ |
| 968 | #define WTF_USE_JSVALUE32 1 |
| 969 | #else |
| 970 | #define WTF_USE_JSVALUE32_64 1 |
| 971 | #endif |
| 972 | #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */ |
| 973 | |
| 974 | #if !defined(ENABLE_REPAINT_THROTTLING) |
| 975 | #define ENABLE_REPAINT_THROTTLING 0 |
| 976 | #endif |
| 977 | |
| 978 | /* Disable JIT on x32 */ |
| 979 | #if CPU(X32) |
| 980 | #define ENABLE_JIT 0 |
| 981 | #endif |
| 982 | |
| 983 | #if !defined(ENABLE_JIT) |
| 984 | |
| 985 | /* The JIT is tested & working on x86_64 Mac */ |
| 986 | #if CPU(X86_64) && PLATFORM(MAC) |
| 987 | #define ENABLE_JIT 1 |
| 988 | /* The JIT is tested & working on x86 Mac */ |
| 989 | #elif CPU(X86) && PLATFORM(MAC) |
| 990 | #define ENABLE_JIT 1 |
| 991 | #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 |
| 992 | #elif CPU(ARM_THUMB2) && PLATFORM(IPHONE) |
| 993 | #define ENABLE_JIT 1 |
| 994 | /* The JIT is tested & working on x86 Windows */ |
| 995 | #elif CPU(X86) && PLATFORM(WIN) |
| 996 | #define ENABLE_JIT 1 |
| 997 | #endif |
| 998 | |
| 999 | #if PLATFORM(QT) |
| 1000 | #if CPU(X86_64) && OS(DARWIN) |
| 1001 | #define ENABLE_JIT 1 |
| 1002 | #elif CPU(X86) && OS(DARWIN) |
| 1003 | #define ENABLE_JIT 1 |
| 1004 | #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 |
| 1005 | #elif CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100 |
| 1006 | #define ENABLE_JIT 1 |
| 1007 | #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 |
| 1008 | #elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC) |
| 1009 | #define ENABLE_JIT 1 |
| 1010 | #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1 |
| 1011 | #elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100 |
| 1012 | #define ENABLE_JIT 1 |
| 1013 | #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 |
| 1014 | #elif CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100 |
| 1015 | #define ENABLE_JIT 1 |
| 1016 | #elif CPU(ARM_TRADITIONAL) && OS(LINUX) |
| 1017 | #define ENABLE_JIT 1 |
| 1018 | #endif |
| 1019 | #endif /* PLATFORM(QT) */ |
| 1020 | |
| 1021 | #endif /* !defined(ENABLE_JIT) */ |
| 1022 | |
| 1023 | #if ENABLE(JIT) |
| 1024 | #ifndef ENABLE_JIT_OPTIMIZE_CALL |
| 1025 | #define ENABLE_JIT_OPTIMIZE_CALL 1 |
| 1026 | #endif |
| 1027 | #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL |
| 1028 | #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1 |
| 1029 | #endif |
| 1030 | #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS |
| 1031 | #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1 |
| 1032 | #endif |
| 1033 | #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS |
| 1034 | #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1 |
| 1035 | #endif |
| 1036 | #endif |
| 1037 | |
| 1038 | #if CPU(X86) && COMPILER(MSVC) |
| 1039 | #define JSC_HOST_CALL __fastcall |
| 1040 | #elif CPU(X86) && COMPILER(GCC) |
| 1041 | #define JSC_HOST_CALL __attribute__ ((fastcall)) |
| 1042 | #else |
| 1043 | #define JSC_HOST_CALL |
| 1044 | #endif |
| 1045 | |
| 1046 | #if COMPILER(GCC) && !ENABLE(JIT) |
| 1047 | #define HAVE_COMPUTED_GOTO 1 |
| 1048 | #endif |
| 1049 | |
| 1050 | #if ENABLE(JIT) && defined(COVERAGE) |
| 1051 | #define WTF_USE_INTERPRETER 0 |
| 1052 | #else |
| 1053 | #define WTF_USE_INTERPRETER 1 |
| 1054 | #endif |
| 1055 | |
| 1056 | /* Yet Another Regex Runtime. */ |
| 1057 | #if !defined(ENABLE_YARR_JIT) |
| 1058 | |
| 1059 | /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */ |
| 1060 | #if (CPU(X86) && PLATFORM(MAC)) \ |
| 1061 | || (CPU(X86_64) && PLATFORM(MAC)) \ |
| 1062 | || (CPU(ARM_THUMB2) && PLATFORM(IPHONE)) \ |
| 1063 | || (CPU(X86) && PLATFORM(WIN)) |
| 1064 | #define ENABLE_YARR 1 |
| 1065 | #define ENABLE_YARR_JIT 1 |
| 1066 | #endif |
| 1067 | |
| 1068 | #if PLATFORM(QT) |
| 1069 | #if (CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ |
| 1070 | || (CPU(X86_64) && OS(WINDOWS) && COMPILER(MINGW64) && GCC_VERSION >= 40100) \ |
| 1071 | || (CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)) \ |
| 1072 | || (CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100) \ |
| 1073 | || (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) \ |
| 1074 | || (CPU(ARM_TRADITIONAL) && OS(LINUX)) |
| 1075 | #define ENABLE_YARR 1 |
| 1076 | #define ENABLE_YARR_JIT 1 |
| 1077 | #endif |
| 1078 | #endif |
| 1079 | |
| 1080 | #endif /* !defined(ENABLE_YARR_JIT) */ |
| 1081 | |
| 1082 | /* Sanity Check */ |
| 1083 | #if ENABLE(YARR_JIT) && !ENABLE(YARR) |
| 1084 | #error "YARR_JIT requires YARR" |
| 1085 | #endif |
| 1086 | |
| 1087 | #if ENABLE(JIT) || ENABLE(YARR_JIT) |
| 1088 | #define ENABLE_ASSEMBLER 1 |
| 1089 | #endif |
| 1090 | /* Setting this flag prevents the assembler from using RWX memory; this may improve |
| 1091 | security but currectly comes at a significant performance cost. */ |
| 1092 | #if PLATFORM(IPHONE) |
| 1093 | #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1 |
| 1094 | #else |
| 1095 | #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0 |
| 1096 | #endif |
| 1097 | |
| 1098 | /* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in. |
| 1099 | On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */ |
| 1100 | #if ENABLE(ASSEMBLER) |
| 1101 | #if CPU(X86_64) && !COMPILER(MINGW64) |
| 1102 | #define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1 |
| 1103 | #else |
| 1104 | #define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1 |
| 1105 | #endif |
| 1106 | #endif |
| 1107 | |
| 1108 | #if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS) |
| 1109 | #define ENABLE_PAN_SCROLLING 1 |
| 1110 | #endif |
| 1111 | |
| 1112 | /* Use the QXmlStreamReader implementation for XMLTokenizer */ |
| 1113 | /* Use the QXmlQuery implementation for XSLTProcessor */ |
| 1114 | #if PLATFORM(QT) |
| 1115 | #define WTF_USE_QXMLSTREAM 1 |
| 1116 | #define WTF_USE_QXMLQUERY 1 |
| 1117 | #endif |
| 1118 | |
| 1119 | #if !PLATFORM(QT) |
| 1120 | #define WTF_USE_FONT_FAST_PATH 1 |
| 1121 | #endif |
| 1122 | |
| 1123 | /* Accelerated compositing */ |
| 1124 | #if PLATFORM(MAC) |
| 1125 | #if !defined(BUILDING_ON_TIGER) |
| 1126 | #define WTF_USE_ACCELERATED_COMPOSITING 1 |
| 1127 | #endif |
| 1128 | #endif |
| 1129 | |
| 1130 | #if PLATFORM(IPHONE) |
| 1131 | #define WTF_USE_ACCELERATED_COMPOSITING 1 |
| 1132 | #endif |
| 1133 | |
| 1134 | /* FIXME: Defining ENABLE_3D_RENDERING here isn't really right, but it's always used with |
| 1135 | with WTF_USE_ACCELERATED_COMPOSITING, and it allows the feature to be turned on and |
| 1136 | off in one place. */ |
| 1137 | #if PLATFORM(WIN) |
| 1138 | #include "QuartzCorePresent.h" |
| 1139 | #if QUARTZCORE_PRESENT |
| 1140 | #define WTF_USE_ACCELERATED_COMPOSITING 1 |
| 1141 | #define ENABLE_3D_RENDERING 1 |
| 1142 | #endif |
| 1143 | #endif |
| 1144 | |
| 1145 | #if COMPILER(GCC) |
| 1146 | #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result)) |
| 1147 | #else |
| 1148 | #define WARN_UNUSED_RETURN |
| 1149 | #endif |
| 1150 | |
| 1151 | #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK))) |
| 1152 | #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1 |
| 1153 | #endif |
| 1154 | |
| 1155 | /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */ |
| 1156 | #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK |
| 1157 | |
| 1158 | #define ENABLE_JSC_ZOMBIES 0 |
| 1159 | |
| 1160 | #endif /* WTF_Platform_h */ |
| 1161 | |