WebCorePrefix.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * Copyright (C) 2004, 2005, 2006, 2007, 2013 Apple Inc.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public License
  15. * along with this library; see the file COPYING.LIB. If not, write to
  16. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. *
  19. */
  20. /* This prefix file should contain only:
  21. * 1) files to precompile for faster builds
  22. * 2) in one case at least: OS-X-specific performance bug workarounds
  23. * 3) the special trick to catch us using new or delete without including "config.h"
  24. * The project should be able to build without this header, although we rarely test that.
  25. */
  26. /* Things that need to be defined globally should go into "config.h". */
  27. #include <wtf/Platform.h>
  28. #if defined(__APPLE__)
  29. #ifdef __cplusplus
  30. #define NULL __null
  31. #else
  32. #define NULL ((void *)0)
  33. #endif
  34. #endif
  35. #if OS(WINDOWS)
  36. #ifndef _WIN32_WINNT
  37. #define _WIN32_WINNT 0x0502
  38. #endif
  39. #ifndef WINVER
  40. #define WINVER 0x0502
  41. #endif
  42. #if !USE(CURL)
  43. #ifndef _WINSOCKAPI_
  44. #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
  45. #endif
  46. #endif
  47. // If we don't define these, they get defined in windef.h.
  48. // We want to use std::min and std::max
  49. #ifdef __cplusplus
  50. #define max max
  51. #define min min
  52. #endif
  53. #else
  54. #include <pthread.h>
  55. #endif // OS(WINDOWS)
  56. #include <sys/types.h>
  57. #include <fcntl.h>
  58. #if defined(__APPLE__)
  59. #include <regex.h>
  60. #endif
  61. #include <setjmp.h>
  62. #include <signal.h>
  63. #include <stdarg.h>
  64. #include <stddef.h>
  65. #include <stdio.h>
  66. #include <stdlib.h>
  67. #include <string.h>
  68. #include <time.h>
  69. #if defined(__APPLE__)
  70. #include <unistd.h>
  71. #endif
  72. #ifdef __cplusplus
  73. #include <ciso646>
  74. #if defined(_LIBCPP_VERSION)
  75. // Add work around for a bug in libc++ that caused standard heap
  76. // APIs to not compile <rdar://problem/10858112>.
  77. #include <type_traits>
  78. namespace WebCore {
  79. class TimerHeapReference;
  80. }
  81. _LIBCPP_BEGIN_NAMESPACE_STD
  82. inline _LIBCPP_INLINE_VISIBILITY
  83. const WebCore::TimerHeapReference& move(const WebCore::TimerHeapReference& t)
  84. {
  85. return t;
  86. }
  87. _LIBCPP_END_NAMESPACE_STD
  88. #endif // defined(_LIBCPP_VERSION)
  89. #include <algorithm>
  90. #include <cstddef>
  91. #include <new>
  92. #endif
  93. #if defined(__APPLE__)
  94. #include <sys/param.h>
  95. #endif
  96. #include <sys/stat.h>
  97. #if defined(__APPLE__)
  98. #include <sys/time.h>
  99. #include <sys/resource.h>
  100. #endif
  101. #include <CoreFoundation/CoreFoundation.h>
  102. #if PLATFORM(WIN_CAIRO)
  103. #include <ConditionalMacros.h>
  104. #include <windows.h>
  105. #else
  106. #if OS(WINDOWS)
  107. #if USE(CG)
  108. #if defined(_MSC_VER) && _MSC_VER <= 1600
  109. #include <WebCore/WebCoreHeaderDetection.h>
  110. #if HAVE(AVCF_LEGIBLE_OUTPUT)
  111. // These must be defined before including CGFloat.h
  112. // This can be removed once we move to VS2012 or newer
  113. #include <wtf/ExportMacros.h>
  114. #include <wtf/MathExtras.h>
  115. #define isnan _isnan
  116. #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
  117. #include <CoreGraphics/CGFloat.h>
  118. #endif
  119. #include <CoreGraphics/CoreGraphics.h>
  120. #include <CoreGraphics/CGFloat.h>
  121. #undef isnan
  122. #endif
  123. #endif
  124. // FIXME <rdar://problem/8208868> Remove support for obsolete ColorSync API, CoreServices header in CoreGraphics
  125. // We can remove this once the new ColorSync APIs are available in an internal Safari SDK.
  126. #include <ColorSync/ColorSync.h>
  127. #ifdef __COLORSYNCDEPRECATED__
  128. #define COREGRAPHICS_INCLUDES_CORESERVICES_HEADER
  129. #define OBSOLETE_COLORSYNC_API
  130. #endif
  131. #endif
  132. #if USE(CFNETWORK)
  133. /* Windows doesn't include CFNetwork.h via CoreServices.h, so we do
  134. it explicitly here to make Windows more consistent with Mac. */
  135. #include <CFNetwork/CFNetwork.h>
  136. #endif
  137. #include <windows.h>
  138. #else
  139. #if !PLATFORM(IOS)
  140. #include <CoreServices/CoreServices.h>
  141. #endif // !PLATFORM(IOS)
  142. #endif // OS(WINDOWS)
  143. #endif
  144. #ifdef __OBJC__
  145. #if PLATFORM(IOS)
  146. #import <Foundation/Foundation.h>
  147. #else
  148. #import <Cocoa/Cocoa.h>
  149. #endif // PLATFORM(IOS)
  150. #endif
  151. #ifdef __cplusplus
  152. #define new ("if you use new/delete make sure to include config.h at the top of the file"())
  153. #define delete ("if you use new/delete make sure to include config.h at the top of the file"())
  154. #endif
  155. /* When C++ exceptions are disabled, the C++ library defines |try| and |catch|
  156. * to allow C++ code that expects exceptions to build. These definitions
  157. * interfere with Objective-C++ uses of Objective-C exception handlers, which
  158. * use |@try| and |@catch|. As a workaround, undefine these macros. */
  159. #ifdef __OBJC__
  160. #undef try
  161. #undef catch
  162. #endif