Bug 1472030 - Use macro variant of MAKE_VERSION in DLL blocklists with MSVC. r=mhowell, a=lizzard
authorAaron Klotz <aklotz@mozilla.com>
Thu, 28 Jun 2018 16:49:42 -0600
changeset 480269 ae4c7cec37a4405685048480105f5df532ab8369
parent 480268 0ed2507b0976bda7de7f26ae1eb21f527a6e302e
child 480270 f0c51d4ad04b0f66e85f6ffe1a6d20bd2c6694f2
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell, lizzard
bugs1472030
milestone62.0
Bug 1472030 - Use macro variant of MAKE_VERSION in DLL blocklists with MSVC. r=mhowell, a=lizzard
mozglue/build/WindowsDllBlocklistCommon.h
--- a/mozglue/build/WindowsDllBlocklistCommon.h
+++ b/mozglue/build/WindowsDllBlocklistCommon.h
@@ -48,25 +48,36 @@ struct DllBlockInfoT {
   // any versioned instance.
   static const uint64_t UNVERSIONED = 0ULL;
 };
 
 } // namespace mozilla
 
 // Convert the 4 (decimal) components of a DLL version number into a
 // single unsigned long long, as needed by the blocklist
+#if defined(_MSC_VER) && !defined(__clang__)
+
+// MSVC does not properly handle the constexpr MAKE_VERSION, so we use a macro
+// instead (ugh).
+#define MAKE_VERSION(a,b,c,d) \
+  ((a##ULL << 48) + (b##ULL << 32) + (c##ULL << 16) + d##ULL)
+
+#else
+
 static inline constexpr uint64_t
 MAKE_VERSION(uint16_t a, uint16_t b, uint16_t c, uint16_t d)
 {
   return static_cast<uint64_t>(a) << 48 |
          static_cast<uint64_t>(b) << 32 |
          static_cast<uint64_t>(c) << 16 |
          static_cast<uint64_t>(d);
 }
 
+#endif
+
 #if !defined(DLL_BLOCKLIST_CHAR_TYPE)
 #error "You must define DLL_BLOCKLIST_CHAR_TYPE"
 #endif // !defined(DLL_BLOCKLIST_CHAR_TYPE)
 
 #define DLL_BLOCKLIST_DEFINITIONS_BEGIN \
   using DllBlockInfo = mozilla::DllBlockInfoT<DLL_BLOCKLIST_CHAR_TYPE>; \
   static const DllBlockInfo gWindowsDllBlocklist[] = {