Too many initializers error in MSVC.
-
I am trying to build XULRunner from sources, and I am getting a 'Too Many Initializers' error, and I have no idea why. The code is as follows (Register is a struct):
static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = { edi, eax, ebx, ecx, esi, edx };
the values in the array are defined earlier in the file (X86Encoding is a namespace, and the values are defined in an enum):
static MOZ_CONSTEXPR_VAR Register eax = { X86Encoding::rax };
static MOZ_CONSTEXPR_VAR Register ecx = { X86Encoding::rcx };
static MOZ_CONSTEXPR_VAR Register edx = { X86Encoding::rdx };
static MOZ_CONSTEXPR_VAR Register ebx = { X86Encoding::rbx };
static MOZ_CONSTEXPR_VAR Register esp = { X86Encoding::rsp };
static MOZ_CONSTEXPR_VAR Register ebp = { X86Encoding::rbp };
static MOZ_CONSTEXPR_VAR Register esi = { X86Encoding::rsi };
static MOZ_CONSTEXPR_VAR Register edi = { X86Encoding::rdi };The Register struct is defined as follows:
struct Register {
typedef Registers Codes;
typedef Codes::Encoding Encoding;
typedef Codes::Code Code;
typedef Codes::SetType SetType;Codes::Encoding reg\_; static Register FromCode(Code i) { MOZ\_ASSERT(i < Registers::Total); Register r = { Encoding(i) }; return r; } static Register FromName(const char\* name) { Code code = Registers::FromName(name); Register r = { Encoding(code) }; return r; } MOZ\_CONSTEXPR Code code() const { return Code(reg\_); } Encoding encoding() const { MOZ\_ASSERT(Code(reg\_) < Registers::Total); return reg\_; } const char\* name() const { return Registers::GetName(code()); } bool operator ==(Register other) const { return reg\_ == other.reg\_; } bool operator !=(Register other) const { return reg\_ != other.reg\_; } bool volatile\_() const { return !!((SetType(1) << code()) & Registers::VolatileMask); } bool aliases(const Register& other) const { return reg\_ == other.reg\_; } uint32\_t numAliased() const { return 1; } // N.B. FloatRegister is an explicit outparam here because msvc-2010 // miscompiled it on win64 when the value was simply returned. This // now has an explicit outparam for compatability. void aliased(uint32\_t aliasIdx, Register\* ret) const { MOZ\_ASSERT(aliasIdx == 0); \*ret = \*this;
-
I am trying to build XULRunner from sources, and I am getting a 'Too Many Initializers' error, and I have no idea why. The code is as follows (Register is a struct):
static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = { edi, eax, ebx, ecx, esi, edx };
the values in the array are defined earlier in the file (X86Encoding is a namespace, and the values are defined in an enum):
static MOZ_CONSTEXPR_VAR Register eax = { X86Encoding::rax };
static MOZ_CONSTEXPR_VAR Register ecx = { X86Encoding::rcx };
static MOZ_CONSTEXPR_VAR Register edx = { X86Encoding::rdx };
static MOZ_CONSTEXPR_VAR Register ebx = { X86Encoding::rbx };
static MOZ_CONSTEXPR_VAR Register esp = { X86Encoding::rsp };
static MOZ_CONSTEXPR_VAR Register ebp = { X86Encoding::rbp };
static MOZ_CONSTEXPR_VAR Register esi = { X86Encoding::rsi };
static MOZ_CONSTEXPR_VAR Register edi = { X86Encoding::rdi };The Register struct is defined as follows:
struct Register {
typedef Registers Codes;
typedef Codes::Encoding Encoding;
typedef Codes::Code Code;
typedef Codes::SetType SetType;Codes::Encoding reg\_; static Register FromCode(Code i) { MOZ\_ASSERT(i < Registers::Total); Register r = { Encoding(i) }; return r; } static Register FromName(const char\* name) { Code code = Registers::FromName(name); Register r = { Encoding(code) }; return r; } MOZ\_CONSTEXPR Code code() const { return Code(reg\_); } Encoding encoding() const { MOZ\_ASSERT(Code(reg\_) < Registers::Total); return reg\_; } const char\* name() const { return Registers::GetName(code()); } bool operator ==(Register other) const { return reg\_ == other.reg\_; } bool operator !=(Register other) const { return reg\_ != other.reg\_; } bool volatile\_() const { return !!((SetType(1) << code()) & Registers::VolatileMask); } bool aliases(const Register& other) const { return reg\_ == other.reg\_; } uint32\_t numAliased() const { return 1; } // N.B. FloatRegister is an explicit outparam here because msvc-2010 // miscompiled it on win64 when the value was simply returned. This // now has an explicit outparam for compatability. void aliased(uint32\_t aliasIdx, Register\* ret) const { MOZ\_ASSERT(aliasIdx == 0); \*ret = \*this;
Brisingr Aerowing wrote:
static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = { edi, eax, ebx, ecx, esi, edx };
What about:
static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[6] = { edi, eax, ebx, ecx, esi, edx };
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Brisingr Aerowing wrote:
static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = { edi, eax, ebx, ecx, esi, edx };
What about:
static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[6] = { edi, eax, ebx, ecx, esi, edx };
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
Same error. I even tried larger numbers with the same result.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
Same error. I even tried larger numbers with the same result.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
Not exactly easy to figure out what those values should be. I would suggest posting the question at XULRunner - Mozilla | MDN[^].
I found this bug report[^], and it turns out that this is a VS2015u1 compiler bug.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???