Bug 1472030: Use macro variant of MAKE_VERSION in DLL blocklists with MSVC; r=mhowell

This commit is contained in:
Aaron Klotz 2018-06-28 16:49:42 -06:00
parent fcb00cb36f
commit 61f9bf0bc0

View File

@ -53,6 +53,15 @@ struct DllBlockInfoT {
// 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)
{
@ -62,6 +71,8 @@ MAKE_VERSION(uint16_t a, uint16_t b, uint16_t c, uint16_t d)
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)