Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Too many initializers error in MSVC.

Too many initializers error in MSVC.

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brisingr Aerowing
    wrote on last edited by
    #1

    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;
    
    D 1 Reply Last reply
    0
    • B Brisingr Aerowing

      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;
      
      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • D David Crow

        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

        B Offline
        B Offline
        Brisingr Aerowing
        wrote on last edited by
        #3

        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???

        L 1 Reply Last reply
        0
        • B Brisingr Aerowing

          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???

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Not exactly easy to figure out what those values should be. I would suggest posting the question at XULRunner - Mozilla | MDN[^].

          B 1 Reply Last reply
          0
          • L Lost User

            Not exactly easy to figure out what those values should be. I would suggest posting the question at XULRunner - Mozilla | MDN[^].

            B Offline
            B Offline
            Brisingr Aerowing
            wrote on last edited by
            #5

            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???

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups