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

QMake triggers abnormally many "zero as null pointer constant" warnings on macOS

    XMLWordPrintable

Details

    • macOS
    • 0711eb607 (dev), fa8effc7d (6.9), 957ce6868 (6.8)

    Description

      To reproduce the issue:
      1. Create a QMake QWidget project from template.
      2. Add "QMAKE_CXXFLAGS += -Wzero-as-null-pointer-constant" in .pro file
      3. Build the project (or rebuild the project if the project is not freshly built)
      4. Quite many "zero as null pointer constant" warnings are printed

      Other test being done:
      1. It does not reproduce with Windows MinGW
      2. It does not reproduce with CMake on macOS (flag passed by target_compile_options)

      So it seems that the combination of QMake + macOS causes the problem. The workaround is of course do not add that C++ compiler flag in .pro file but people may need to use it in practice.

      In file included from ../../qtcreator/untitled13/main.cpp:1:
      In file included from ../../qtcreator/untitled13/mainwindow.h:4:
      In file included from ../../../qt/official/6.8.1/macos/lib/QtWidgets.framework/Headers/QMainWindow:1:
      In file included from ../../../qt/official/6.8.1/macos/lib/QtWidgets.framework/Headers/qmainwindow.h:8:
      In file included from /Users/alex/Dev/qt/official/6.8.1/macos/lib/QtWidgets.framework/Headers/qwidget.h:8:
      In file included from /Users/alex/Dev/qt/official/6.8.1/macos/lib/QtGui.framework/Headers/qwindowdefs.h:8:
      In file included from /Users/alex/Dev/qt/official/6.8.1/macos/lib/QtCore.framework/Headers/qobjectdefs.h:12:
      In file included from /Users/alex/Dev/qt/official/6.8.1/macos/lib/QtCore.framework/Headers/qnamespace.h:13:
      /Users/alex/Dev/qt/official/6.8.1/macos/lib/QtCore.framework/Headers/qcompare.h:226:78: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
        226 |     friend constexpr bool is_eq  (partial_ordering o) noexcept { return o == 0; }
            |                                                                              ^
            |                                                                              nullptr
      /Users/alex/Dev/qt/official/6.8.1/macos/lib/QtCore.framework/Headers/qcompare.h:227:78: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
        227 |     friend constexpr bool is_neq (partial_ordering o) noexcept { return o != 0; }
            |                                                                              ^
            |                                                                              nullptr
      /Users/alex/Dev/qt/official/6.8.1/macos/lib/QtCore.framework/Headers/qcompare.h:228:78: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
        228 |     friend constexpr bool is_lt  (partial_ordering o) noexcept { return o <  0; }
            |                                                                              ^
            |                                                                              nullptr
      

      Attachments

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

        Activity

          People

            alexandru.croitor Alexandru Croitor
            luqiaochen Luqiao Chen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes