Commit 34594e90 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Introduce OS_MAC

In the spirit of macOS Big Sur, which is labeled as macOS 11.0,
introduce OS_MAC and OS_APPLE. OS_MACOSX implicitly included OS_IOS,
which was confusing, so OS_APPLE is the new replacement for "macOS +
iOS" and OS_MAC is the new replacement for "just macOS, not iOS".

Bug: 1105907
Change-Id: I0f24ff5a74f07eaf2fe7b7fa17bdef7e82a514fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2299189Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791353}
parent af374ccd
......@@ -1288,6 +1288,7 @@ _VALID_OS_MACROS = (
# Please keep sorted.
'OS_AIX',
'OS_ANDROID',
'OS_APPLE',
'OS_ASMJS',
'OS_BSD',
'OS_CAT', # For testing.
......@@ -1297,6 +1298,7 @@ _VALID_OS_MACROS = (
'OS_FUCHSIA',
'OS_IOS',
'OS_LINUX',
'OS_MAC',
'OS_MACOSX',
'OS_NACL',
'OS_NACL_NONSFI',
......@@ -4540,8 +4542,9 @@ def _DidYouMeanOSMacro(bad_macro):
'B': 'OS_BSD',
'C': 'OS_CHROMEOS',
'F': 'OS_FREEBSD',
'I': 'OS_IOS',
'L': 'OS_LINUX',
'M': 'OS_MACOSX',
'M': 'OS_MAC',
'N': 'OS_NACL',
'O': 'OS_OPENBSD',
'P': 'OS_POSIX',
......
......@@ -274,8 +274,7 @@ class InvalidOSMacroNamesTest(unittest.TestCase):
def testInvalidOSMacroNames(self):
lines = ['#if defined(OS_WINDOWS)',
' #elif defined(OS_WINDOW)',
' # if defined(OS_MACOSX) || defined(OS_CHROME)',
'# else // defined(OS_MAC)',
' # if defined(OS_MAC) || defined(OS_CHROME)',
'#endif // defined(OS_MACOS)']
errors = PRESUBMIT._CheckForInvalidOSMacrosInFile(
MockInputApi(), MockFile('some/path/foo_platform.cc', lines))
......
......@@ -1465,6 +1465,10 @@ bool TestLauncher::Init(CommandLine* command_line) {
results_tracker_.AddGlobalTag("OS_ANDROID");
#endif
#if defined(OS_APPLE)
results_tracker_.AddGlobalTag("OS_APPLE");
#endif
#if defined(OS_BSD)
results_tracker_.AddGlobalTag("OS_BSD");
#endif
......@@ -1485,6 +1489,10 @@ bool TestLauncher::Init(CommandLine* command_line) {
results_tracker_.AddGlobalTag("OS_LINUX");
#endif
#if defined(OS_MAC)
results_tracker_.AddGlobalTag("OS_MAC");
#endif
#if defined(OS_MACOSX)
results_tracker_.AddGlobalTag("OS_MACOSX");
#endif
......
......@@ -31,20 +31,21 @@
#elif defined(ANDROID)
#define OS_ANDROID 1
#elif defined(__APPLE__)
// only include TargetConditions after testing ANDROID as some android builds
// on mac don't have this header available and it's not needed unless the target
// is really mac/ios.
// Only include TargetConditionals after testing ANDROID as some Android builds
// on the Mac have this header available and it's not needed unless the target
// is really an Apple platform.
#include <TargetConditionals.h>
#define OS_MACOSX 1
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#define OS_IOS 1
#else
#define OS_MAC 1
#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#elif defined(__linux__)
#define OS_LINUX 1
// include a system header to pull in features.h for glibc/uclibc macros.
// Include a system header to pull in features.h for glibc/uclibc macros.
#include <unistd.h>
#if defined(__GLIBC__) && !defined(__UCLIBC__)
// we really are using glibc, not uClibc pretending to be glibc
// We really are using glibc, not uClibc pretending to be glibc.
#define LIBC_GLIBC 1
#endif
#elif defined(_WIN32)
......@@ -71,6 +72,13 @@
// NOTE: Adding a new port? Please follow
// https://chromium.googlesource.com/chromium/src/+/master/docs/new_port_policy.md
#if defined(OS_MAC) || defined(OS_IOS)
// TODO(https://crbug.com/1105907): Migrate off of OS_MACOSX to an appropriate
// combination of OS_MAC, OS_IOS, and OS_APPLE.
#define OS_MACOSX 1
#define OS_APPLE 1
#endif
// For access to standard BSD features, use OS_BSD instead of a
// more specific macro.
#if defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment