mac: Be more positive

4ae896bad0af replaced OS_MACOSX with OS_APPLE and introduced OS_MAC,
disentangled from OS_IOS. This allows !defined(OS_IOS) to be written
more directly as defined(OS_MAC) in cases where OS_APPLE is assured.

Change-Id: I8848503d3318038865dd4c8586a81ce82764af0a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2384318
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Mark Mentovai 2020-08-30 22:33:41 -04:00 committed by Commit Bot
parent b3d84e0d05
commit df3bc64246
6 changed files with 17 additions and 17 deletions

View File

@ -682,7 +682,7 @@ kern_return_t ExcServerSuccessfulReturnValue(exception_type_t exception,
exception_behavior_t behavior,
bool set_thread_state) {
if (exception == EXC_CRASH
#if !defined(OS_IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11
#if defined(OS_MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11
&& MacOSXMinorVersion() >= 11
#endif
) {

View File

@ -31,9 +31,9 @@
#include "util/mach/mach_message.h"
#include "util/misc/implicit_cast.h"
#if !defined(OS_IOS)
#if defined(OS_MAC)
#include "test/mac/mach_multiprocess.h"
#endif // !OS_IOS
#endif // OS_MAC
namespace crashpad {
namespace test {
@ -961,7 +961,7 @@ TEST(ExcServerVariants, MachMessageServerRequestIDs) {
expect_request_ids);
}
#if !defined(OS_IOS)
#if defined(OS_MAC)
class TestExcServerVariants : public MachMultiprocess,
public UniversalMachExcServer::Interface {
@ -1202,7 +1202,7 @@ TEST(ExcServerVariants, ThreadStates) {
}
}
#endif // !OS_IOS
#endif // OS_MAC
TEST(ExcServerVariants, ExcServerSuccessfulReturnValue) {
#if defined(OS_IOS)

View File

@ -49,7 +49,7 @@ exception_mask_t ExcMaskAll() {
#error This code was not ported to iOS versions older than 7
#endif
#if !defined(OS_IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9
#if defined(OS_MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9
const int mac_os_x_minor_version = MacOSXMinorVersion();
#endif
@ -66,7 +66,7 @@ exception_mask_t ExcMaskAll() {
EXC_MASK_MACH_SYSCALL |
EXC_MASK_RPC_ALERT |
EXC_MASK_MACHINE;
#if !defined(OS_IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
#if defined(OS_MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
if (mac_os_x_minor_version < 8) {
return kExcMaskAll_10_6;
}
@ -76,7 +76,7 @@ exception_mask_t ExcMaskAll() {
// xnu-2050.48.11/osfmk/mach/exception_types.h.
constexpr exception_mask_t kExcMaskAll_10_8 =
kExcMaskAll_10_6 | EXC_MASK_RESOURCE;
#if !defined(OS_IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9
#if defined(OS_MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9
if (mac_os_x_minor_version < 9) {
return kExcMaskAll_10_8;
}
@ -96,7 +96,7 @@ exception_mask_t ExcMaskValid() {
#error This code was not ported to iOS versions older than 9
#endif
#if !defined(OS_IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11
#if defined(OS_MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11
if (MacOSXMinorVersion() < 11) {
return kExcMaskValid_10_6;
}

View File

@ -23,9 +23,9 @@
#include "util/misc/clock.h"
#include "util/misc/implicit_cast.h"
#if !defined(OS_IOS)
#if defined(OS_MAC)
#include <bsm/libbsm.h>
#endif // !OS_IOS
#endif // OS_MAC
namespace crashpad {
@ -253,7 +253,7 @@ bool MachMessageDestroyReceivedPort(mach_port_t port,
}
}
#if !defined(OS_IOS)
#if defined(OS_MAC)
pid_t AuditPIDFromMachMessageTrailer(const mach_msg_trailer_t* trailer) {
if (trailer->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) {
@ -287,6 +287,6 @@ pid_t AuditPIDFromMachMessageTrailer(const mach_msg_trailer_t* trailer) {
return audit_pid;
}
#endif // !OS_IOS
#endif // OS_MAC
} // namespace crashpad

View File

@ -183,7 +183,7 @@ const mach_msg_trailer_t* MachMessageTrailerFromHeader(
bool MachMessageDestroyReceivedPort(mach_port_t port,
mach_msg_type_name_t port_right_type);
#if !defined(OS_IOS) || DOXYGEN
#if defined(OS_MAC) || DOXYGEN
//! \brief Returns the process ID of a Mach messages sender from its audit
//! trailer.
@ -201,7 +201,7 @@ bool MachMessageDestroyReceivedPort(mach_port_t port,
//! audit information.
pid_t AuditPIDFromMachMessageTrailer(const mach_msg_trailer_t* trailer);
#endif // !OS_IOS
#endif // OS_MAC
} // namespace crashpad

View File

@ -158,7 +158,7 @@ TEST(MachMessage, MachMessageDestroyReceivedPort) {
EXPECT_TRUE(MachMessageDestroyReceivedPort(port, MACH_MSG_TYPE_PORT_SEND));
}
#if !defined(OS_IOS)
#if defined(OS_MAC)
TEST(MachMessage, AuditPIDFromMachMessageTrailer) {
base::mac::ScopedMachReceiveRight port(NewMachPort(MACH_PORT_RIGHT_RECEIVE));
@ -200,7 +200,7 @@ TEST(MachMessage, AuditPIDFromMachMessageTrailer) {
EXPECT_EQ(AuditPIDFromMachMessageTrailer(&receive.trailer), getpid());
}
#endif // !OS_IOS
#endif // OS_MAC
} // namespace
} // namespace test