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

moc stumbles on _GLIBCXX_VISIBILITY

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.12.7
    • Build tools: moc
    • None
    • f0039bd51 (dev), ef8019af7 (6.5), 8ac712968 (6.6)

      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?

        1. moc_predefs.h
          16 kB
          tim blechmann
        For Gerrit Dashboard: QTBUG-83160
        # Subject Branch Project Status CR V

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

              Created:
              Updated:

                There are no open Gerrit changes