Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-671

Bugs in parseFunction(), parseSiganls() and parseSlots()

XMLWordPrintable

      In bool Moc::parseFunction(FunctionDef *def, bool inMacro) in QTDIRsrc\tools\moc, the segment:

      def->isVirtual = false;
      while (test(INLINE) || test(STATIC) || test(VIRTUAL))

      { if (lookup() == VIRTUAL) def->isVirtual = true; }

      will never work and virtual functions will not be marked as such (isVirtual == true). The reason is that the default parameter value for lookup() is 1, which mean that lookup() would return the current token. However, because test() advances the internal pointer to the next token, if the current token is the expected one, then by the time lookup() is called we are already after the 'virtual' token. The solution is to
      call lookup(0) instead:

      def->isVirtual = false;
      while (test(INLINE) || test(STATIC) || test(VIRTUAL))

      { if (lookup(0) == VIRTUAL) def->isVirtual = true; }

      Also, this same code segment should be pasted in the very beginning of bool Moc::parseMaybeFunction(FunctionDef *def) as well.

      Also, the functions parseSignals() and parseSlots() do NOT set the flags isSlot and isSignal to true, as they should.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            shausman Simon Hausmann
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes