2
* Copyright (C) 2006-2019 Apple Inc. All rights reserved.
3
* Copyright (C) 2007-2009 Torch Mobile, Inc.
4
* Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
15
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
16
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
19
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
#ifndef WTF_PLATFORM_GUARD_AGAINST_INDIRECT_INCLUSION
31
#error "Please #include <wtf/Platform.h> instead of this file directly."
35
#if defined(__APPLE__)
36
#include <Availability.h>
37
#include <AvailabilityMacros.h>
38
#include <TargetConditionals.h>
42
/* OS() - underlying operating system; only to be used for mandated low-level services like
43
virtual memory, not to choose a GUI toolkit */
44
#define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE)
45
#define OS_CONSTANT(WTF_FEATURE) (WTF_OS_CONSTANT_##WTF_FEATURE)
48
/* ==== OS() - underlying operating system; only to be used for mandated low-level services like
49
virtual memory, not to choose a GUI toolkit ==== */
56
/* OS(DARWIN) - Any Darwin-based OS, including macOS, iOS, macCatalyst, tvOS, and watchOS */
57
#if defined(__APPLE__)
58
#define WTF_OS_DARWIN 1
61
/* OS(IOS_FAMILY) - iOS family, including iOS, macCatalyst, tvOS, watchOS */
62
#if OS(DARWIN) && TARGET_OS_IPHONE
63
#define WTF_OS_IOS_FAMILY 1
66
/* OS(IOS) - iOS only, not including macCatalyst */
67
#if OS(DARWIN) && (TARGET_OS_IOS && !(defined(TARGET_OS_MACCATALYST) && TARGET_OS_MACCATALYST))
72
#if OS(DARWIN) && TARGET_OS_TV
76
/* OS(WATCHOS) - watchOS */
77
#if OS(DARWIN) && TARGET_OS_WATCH
78
#define WTF_OS_WATCHOS 1
81
/* FIXME: Rename this to drop the X, as that is no longer the name of the operating system. */
82
/* OS(MAC_OS_X) - macOS (not including iOS family) */
83
#if OS(DARWIN) && TARGET_OS_OSX
84
#define WTF_OS_MAC_OS_X 1
87
/* OS(FREEBSD) - FreeBSD */
88
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
89
#define WTF_OS_FREEBSD 1
92
/* OS(FUCHSIA) - Fuchsia */
93
#if defined(__Fuchsia__)
94
#define WTF_OS_FUCHSIA 1
97
/* OS(HURD) - GNU/Hurd */
102
/* OS(LINUX) - Linux */
103
#if defined(__linux__)
104
#define WTF_OS_LINUX 1
107
/* OS(NETBSD) - NetBSD */
108
#if defined(__NetBSD__)
109
#define WTF_OS_NETBSD 1
112
/* OS(OPENBSD) - OpenBSD */
113
#if defined(__OpenBSD__)
114
#define WTF_OS_OPENBSD 1
117
/* OS(WINDOWS) - Any version of Windows */
118
#if defined(WIN32) || defined(_WIN32)
119
#define WTF_OS_WINDOWS 1
123
/* OS(UNIX) - Any Unix-like system */
135
#define WTF_OS_UNIX 1
140
#if (OS(IOS) || OS(TVOS) || OS(WATCHOS)) && CPU(ARM64)
141
#define WTF_OS_CONSTANT_EFFECTIVE_ADDRESS_WIDTH 36
143
/* We strongly assume that effective address width is <= 48 in 64bit architectures (e.g. NaN boxing). */
144
#define WTF_OS_CONSTANT_EFFECTIVE_ADDRESS_WIDTH 48
147
#define WTF_OS_CONSTANT_EFFECTIVE_ADDRESS_WIDTH 32
151
/* Asserts, invariants for macro definitions */
153
#define WTF_OS_WIN ERROR "USE WINDOWS WITH OS NOT WIN"
154
#define WTF_OS_MAC ERROR "USE MAC_OS_X WITH OS NOT MAC"