Bug 1339695 (part 2) - Reorder PlatformMacros.h.h. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 15 Feb 2017 16:24:33 +1100
changeset 485035 f6869c7b0707091d551285243c43993d7b235265
parent 485034 9d9a3692b012221e74ee6fbc70af95dff83e1a7d
child 485036 b735a190b14f0a5ea0f0ccb0793624dd89291055
push id45611
push userbmo:gasolin@mozilla.com
push dateThu, 16 Feb 2017 01:39:57 +0000
reviewersmstange
bugs1339695
milestone54.0a1
Bug 1339695 (part 2) - Reorder PlatformMacros.h.h. r=mstange. This change increases consistency: - Each OS is dealt with one at a time (no more interleaving). - For each OS, x86 is now the first listed architecture. The patch also adds the missing "#undef SPS_PLAT_x86_android".
tools/profiler/core/PlatformMacros.h
--- a/tools/profiler/core/PlatformMacros.h
+++ b/tools/profiler/core/PlatformMacros.h
@@ -7,69 +7,75 @@
 #define SPS_PLATFORM_MACROS_H
 
 /* Define platform selection macros in a consistent way.  Don't add
    anything else to this file, so it can remain freestanding.  The
    primary factorisation is on (ARCH,OS) pairs ("PLATforms") but ARCH_
    and OS_ macros are defined too, since they are sometimes
    convenient. */
 
+#undef SPS_PLAT_x86_android
 #undef SPS_PLAT_arm_android
-#undef SPS_PLAT_amd64_linux
 #undef SPS_PLAT_x86_linux
+#undef SPS_PLAT_amd64_linux
+#undef SPS_PLAT_x86_darwin
 #undef SPS_PLAT_amd64_darwin
-#undef SPS_PLAT_x86_darwin
 #undef SPS_PLAT_x86_windows
 #undef SPS_PLAT_amd64_windows
 
-#undef SPS_ARCH_arm
 #undef SPS_ARCH_x86
 #undef SPS_ARCH_amd64
+#undef SPS_ARCH_arm
 
 #undef SPS_OS_android
 #undef SPS_OS_linux
 #undef SPS_OS_darwin
 #undef SPS_OS_windows
 
-#if defined(__linux__) && defined(__x86_64__)
-#  define SPS_PLAT_amd64_linux 1
-#  define SPS_ARCH_amd64 1
-#  define SPS_OS_linux 1
+// We test __ANDROID__ before __linux__ because __linux__ is defined on both
+// Android and Linux, whereas SPS_OS_android is not defined on vanilla Linux.
+
+#if defined(__ANDROID__) && defined(__i386__)
+#  define SPS_PLAT_x86_android 1
+#  define SPS_ARCH_x86 1
+#  define SPS_OS_android 1
 
 #elif defined(__ANDROID__) && defined(__arm__)
 #  define SPS_PLAT_arm_android 1
 #  define SPS_ARCH_arm 1
 #  define SPS_OS_android 1
 
-#elif defined(__ANDROID__) && defined(__i386__)
-#  define SPS_PLAT_x86_android 1
-#  define SPS_ARCH_x86 1
-#  define SPS_OS_android 1
-
 #elif defined(__linux__) && defined(__i386__)
 #  define SPS_PLAT_x86_linux 1
 #  define SPS_ARCH_x86 1
 #  define SPS_OS_linux 1
 
-#elif defined(__APPLE__) && defined(__x86_64__)
-#  define SPS_PLAT_amd64_darwin 1
+#elif defined(__linux__) && defined(__x86_64__)
+#  define SPS_PLAT_amd64_linux 1
 #  define SPS_ARCH_amd64 1
-#  define SPS_OS_darwin 1
+#  define SPS_OS_linux 1
 
 #elif defined(__APPLE__) && defined(__i386__)
 #  define SPS_PLAT_x86_darwin 1
 #  define SPS_ARCH_x86 1
 #  define SPS_OS_darwin 1
 
-#elif (defined(_MSC_VER) || defined(__MINGW32__)) && (defined(_M_IX86) || defined(__i386__))
+#elif defined(__APPLE__) && defined(__x86_64__)
+#  define SPS_PLAT_amd64_darwin 1
+#  define SPS_ARCH_amd64 1
+#  define SPS_OS_darwin 1
+
+#elif (defined(_MSC_VER) || defined(__MINGW32__)) && \
+      (defined(_M_IX86) || defined(__i386__))
 #  define SPS_PLAT_x86_windows 1
 #  define SPS_ARCH_x86 1
 #  define SPS_OS_windows 1
 
-#elif (defined(_MSC_VER) || defined(__MINGW32__)) && (defined(_M_X64) || defined(__x86_64__))
+#elif (defined(_MSC_VER) || defined(__MINGW32__)) && \
+      (defined(_M_X64) || defined(__x86_64__))
 #  define SPS_PLAT_amd64_windows 1
 #  define SPS_ARCH_amd64 1
 #  define SPS_OS_windows 1
 
 #else
 #  error "Unsupported platform"
 #endif