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/+/2299189
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Leonard Grey <[email protected]>
Reviewed-by: Elly Fong-Jones <[email protected]>
Auto-Submit: Avi Drissman <[email protected]>
Commit-Queue: Avi Drissman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#791353}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 8f9116d..99a27e0 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1288,6 +1288,7 @@
# Please keep sorted.
'OS_AIX',
'OS_ANDROID',
+ 'OS_APPLE',
'OS_ASMJS',
'OS_BSD',
'OS_CAT', # For testing.
@@ -1297,6 +1298,7 @@
'OS_FUCHSIA',
'OS_IOS',
'OS_LINUX',
+ 'OS_MAC',
'OS_MACOSX',
'OS_NACL',
'OS_NACL_NONSFI',
@@ -4540,8 +4542,9 @@
'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',
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index edba20f..8286775 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -274,8 +274,7 @@
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))
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 3929e0e..5d4c9fa 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -1465,6 +1465,10 @@
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 @@
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
diff --git a/build/build_config.h b/build/build_config.h
index 7f635d5..e8588e1 100644
--- a/build/build_config.h
+++ b/build/build_config.h
@@ -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)