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

moc stumbles on _GLIBCXX_VISIBILITY

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.7
    • Fix Version/s: None
    • Component/s: Build tools: moc
    • Labels:
      None

      Description

      There is at least one distribution that add GCC's C++ headers on CPLUS_INCLUDE_PATH.

      When 'moc' encounters theĀ _GLIBCXX_VISIBILITY macro, it trips and fails with a "Parse error before <token>" where token is the word just beforeĀ _GLIBCXX_VISIBILITY.

      An easy fix for this problem is:

      diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
      --- a/src/tools/moc/main.cpp
      +++ b/src/tools/moc/main.cpp
      @@ -188,6 +188,7 @@ int runMoc(int argc, char **argv)
           dummyVariadicFunctionMacro.arguments += Symbol(0, PP_IDENTIFIER, "__VA_ARGS__");
           pp.macros["__attribute__"] = dummyVariadicFunctionMacro;
           pp.macros["__declspec"] = dummyVariadicFunctionMacro;
      +    pp.macros["_GLIBCXX_VISIBILITY"] = dummyVariadicFunctionMacro;
       
           QString filename;
           QString output
      

      GLIBCXX_VISIBILITY is a preprocessor macro that expands to _attribute_ which is already ignored by moc.

      Should I send this patch through Gerrit?

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              fabiankosmale Fabian Kosmale
              Reporter:
              mbakke Marius Bakke
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes