Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-7225

Macro arguments are not properly expanded

XMLWordPrintable

    • f978400ae5c9a7802c110ccd77db9a4dc8a95262

      The new preprocessor does not correctly handle expansion of macro arguments: when a macro argument is/uses a macro, that macro may generate multiple arguments when it is expanded. The macro arguments should be expanded first, then expanded token list is used for

      Here is a sample of showing the issue:
      #define BAR 2,3,4
      #define FOO(a,b,c) a+b+c
      FOO(BAR) --> expands as "2,3,4+" instead of 2+3+4

      Note: the generated code includes only one '+', as generation stops when Preprocessor::handleFunctionLikeMacro() finds out there are not enough argument. This does not seem correct: if the number of arguments (after expanding them) does not match the formal parameters for the macro, then that macro should not be expanded at all.

        For Gerrit Dashboard: QTCREATORBUG-7225
        # Subject Branch Project Status CR V

            leamelo Leandro T. C. Melo
            typz Francois Ferrand
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes