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

#if defined(QT_X11_DEFINES_FOUND) in qcborstreamreader.h problem

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.15.0, 5.15.1
    • Fix Version/s: 6.0.0 RC
    • Component/s: Core: Other
    • Labels:
      None
    • Platform/s:
      Windows
    • Commits:
      be0f1af3f1829da0d321c12dbd40d5743d3b2eb5 (qt/qtbase/dev)

      Description

      in qcborstreamreader.h there is

      // See qcborcommon.h for why we check
      #if defined(QT_X11_DEFINES_FOUND)
      #  undef True
      #  undef False
      #endif
      

      and in qcborcommon.h

      #if defined(False) && defined(True)
      #  define QT_X11_DEFINES_FOUND 1
      #  undef True
      #  undef False
      #endif
      

      This can lead to includes order hell, if True/False isn't defined when qcborcommon.h is included which QJsonValue does.
      my example is using live555 which defines True/False. If live555 includes do not come before any Qt includes which leads to qcborcommon.h, than the above inĀ  qcborstreamreader.h will not undefine True/False.

      Besides the point using True/False in an enum is poor practice, bridging these #if defined will certainly force a includes order. Proper practice is to also check True/False in qcborstreamreader.h

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            purdueschmidt Justin Schmidt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes