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

qdbusxml2cpp6 generates broken code for org.freedesktop.DBus.Deprecated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.0, 6.6.0
    • 6.4.2
    • D-Bus
    • None
    • f67b32e73 (dev), 310f66661 (6.5)

    Description

      qdbusxml2cpp6, as before its Qt5 sibling, when generating code for a method with

      <annotation name="org.freedesktop.DBus.Deprecated" value="true"/>

      adds the Q_DECL_DEPRECATED between the inline specifier and the actual method declaration.

      Just, with Qt6 Q_DECL_DEPRECATED now gets resolved to the standard attribute [[deprecated] when available, not just the compiler specific _attribute_ ((_deprecated_)).

      And as a result the compiler, which has to be strict with the order when it comes to standard attributes, fails over this

      <build-dir>/kf6/frameworks/kwallet/src/api/KWallet/kwallet_interface.h:231:12: error: standard attributes in middle of decl-specifiers
        231 |     inline Q_DECL_DEPRECATED QDBusPendingReply<QVariantMap> readEntryList(int handle, const QString &folder, const QString &key, const QString &appid)
            |            ^~~~~~~~~~~~~~~~~
      <build-dir>/kf6/frameworks/kwallet/src/api/KWallet/kwallet_interface.h:231:12: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
      

      So the Q_DECL_DEPRECATED needs to be placed before the inline specifier, at least in that case of standard attributes.

      At least with the GCC compiler having the compiler-specific attribute before the inline works as well, so the macro placed there works in both cases. No idea about all the other compilers though.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-110979
          # Subject Branch Project Status CR V

          Activity

            People

              thiago Thiago Macieira
              kossebau Friedrich W. H. Kossebau
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews