Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Yet another post to Qt creator 4.7.0
Forum Updated to NodeBB v4.3 + New Features

Yet another post to Qt creator 4.7.0

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
10 Posts 3 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koahnig
    wrote on last edited by
    #1

    After updating to most recent Qt creator 4.7.0 I receive buckets of warnings throughout my source.

    Also lines like

    qDebug() << "my special output";
    

    are marked by a warning that "zero as null pointer constant".

    Naivly I assumed that I have adopted some less favorable over the years. Right now I checked the documentation and found qDebug() is used correctly. The warning stems apparently from using an older Qt version 5.4.

    Does anyone know how to get rid of those warnings for older Qt lib versions?

    Vote the answer(s) that helped you to solve your issue(s)

    aha_1980A 1 Reply Last reply
    0
    • K koahnig

      After updating to most recent Qt creator 4.7.0 I receive buckets of warnings throughout my source.

      Also lines like

      qDebug() << "my special output";
      

      are marked by a warning that "zero as null pointer constant".

      Naivly I assumed that I have adopted some less favorable over the years. Right now I checked the documentation and found qDebug() is used correctly. The warning stems apparently from using an older Qt version 5.4.

      Does anyone know how to get rid of those warnings for older Qt lib versions?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @koahnig,

      Right now you can adopt the Clang warnings globally or per project.

      Setting them per Kit is not possible AFAIK. But as I have a lot of legacy code I stumbled over the same problem some days ago.

      If two have it, it's worth a bugreport I think. Do you want to create one?

      Qt has to stay free or it will die.

      K 1 Reply Last reply
      0
      • aha_1980A aha_1980

        Hi @koahnig,

        Right now you can adopt the Clang warnings globally or per project.

        Setting them per Kit is not possible AFAIK. But as I have a lot of legacy code I stumbled over the same problem some days ago.

        If two have it, it's worth a bugreport I think. Do you want to create one?

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        @aha_1980 said in Yet another post to Qt creator 4.7.0:

        Hi @koahnig,

        Right now you can adopt the Clang warnings globally or per project.

        You mean with that switching off warnings with macros and/or compile switches?

        I can write a bug report and post link here.

        Vote the answer(s) that helped you to solve your issue(s)

        aha_1980A 1 Reply Last reply
        0
        • K koahnig

          @aha_1980 said in Yet another post to Qt creator 4.7.0:

          Hi @koahnig,

          Right now you can adopt the Clang warnings globally or per project.

          You mean with that switching off warnings with macros and/or compile switches?

          I can write a bug report and post link here.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @koahnig,

          No, you can disable the warning from Clang. Tools > Options > C++ > Code Model > Manage. Then create a copy and modify the warning options to your need (I think you need to add -Wno-zero-as-null-pointer-constant)

          It would be good to assign that at Kit level, IMHO.

          Regards

          Qt has to stay free or it will die.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            Bug report filed https://bugreports.qt.io/browse/QTCREATORBUG-20877

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            2
            • kkoehneK Offline
              kkoehneK Offline
              kkoehne
              Moderators
              wrote on last edited by
              #6

              qDebug is a macro, but I can't see how it can resolve to anything that warrants a "zero as null pointer constant" warning...

              Do you set any special DEFINE's , like QT_NO_DEBUG_OUTPUT? Have you tried isolating it to a minimal example?

              Director R&D, The Qt Company

              K 2 Replies Last reply
              0
              • kkoehneK kkoehne

                qDebug is a macro, but I can't see how it can resolve to anything that warrants a "zero as null pointer constant" warning...

                Do you set any special DEFINE's , like QT_NO_DEBUG_OUTPUT? Have you tried isolating it to a minimal example?

                K Offline
                K Offline
                koahnig
                wrote on last edited by koahnig
                #7

                @kkoehne

                Thanks for feedback.

                I didn't before, but tried right now. I cannot provide a minimal example.

                With my large legacy project the warning disappears as soon as I choose the kit with Qt 5.10. After selecting the another than this kit Qt 5.4.2 (MinGW pre-build) or self-compiled Qt5.9.3 (also MinGW) the warning appears in editor.

                For the minimla example I have used the standard template from qt creator and included QDebug and wrote

                qDebug() << "test output";
                

                There must be something else then.

                [edit:koahnig]

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • kkoehneK kkoehne

                  qDebug is a macro, but I can't see how it can resolve to anything that warrants a "zero as null pointer constant" warning...

                  Do you set any special DEFINE's , like QT_NO_DEBUG_OUTPUT? Have you tried isolating it to a minimal example?

                  K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #8

                  @kkoehne

                  Sorry that was stupid. Ignore previous post. I blame it to the heat and the up-coming weekend. ;)
                  I had changed the settings in creator to ignore the warning.

                  Here it is with prebuild Qt5.4.2 MinGW on windows 10 64 bit

                  0_1532702695557_f678a29b-a882-4922-9354-423ac3387ec9-image.png

                  main.cpp

                  #include <QCoreApplication>
                  
                  #include <QDebug>
                  
                  int main(int argc, char *argv[])
                  {
                      QCoreApplication a(argc, argv);
                  
                      qDebug() << "test output";
                  
                      return a.exec();
                  }
                  

                  TestqDebug.pro

                  QT -= gui
                  
                  CONFIG += c++11 console
                  CONFIG -= app_bundle
                  
                  # The following define makes your compiler emit warnings if you use
                  # any feature of Qt which as been marked deprecated (the exact warnings
                  # depend on your compiler). Please consult the documentation of the
                  # deprecated API in order to know how to port your code away from it.
                  DEFINES += QT_DEPRECATED_WARNINGS
                  
                  # You can also make your code fail to compile if you use deprecated APIs.
                  # In order to do so, uncomment the following line.
                  # You can also select to disable deprecated APIs only up to a certain version of Qt.
                  #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                  
                  SOURCES += \
                          main.cpp
                  
                  # Default rules for deployment.
                  qnx: target.path = /tmp/$${TARGET}/bin
                  else: unix:!android: target.path = /opt/$${TARGET}/bin
                  !isEmpty(target.path): INSTALLS += target
                  

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  0
                  • kkoehneK Offline
                    kkoehneK Offline
                    kkoehne
                    Moderators
                    wrote on last edited by kkoehne
                    #9

                    I see. I guess you've selected a Release build? Then I can reproduce.

                    qDebug is actually a macro in Qt 5, so that additional metadata can be captured:

                    #define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug
                    

                    QMessageLogger expects strings (const char *) as first and third constructor argument. However, for release builds QT_MESSAGELOG_FILE, QT_MESSAGELOG_FUNC were defined to 0.

                    This got changed in Qt 5.5.0 so that they are defined to nullptr. This is why you cannot reproduce in dev ...

                    I don't think we can do much here though: We can't change older Qt versions anymore, and the warning itself is legit.

                    Director R&D, The Qt Company

                    K 1 Reply Last reply
                    2
                    • kkoehneK kkoehne

                      I see. I guess you've selected a Release build? Then I can reproduce.

                      qDebug is actually a macro in Qt 5, so that additional metadata can be captured:

                      #define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug
                      

                      QMessageLogger expects strings (const char *) as first and third constructor argument. However, for release builds QT_MESSAGELOG_FILE, QT_MESSAGELOG_FUNC were defined to 0.

                      This got changed in Qt 5.5.0 so that they are defined to nullptr. This is why you cannot reproduce in dev ...

                      I don't think we can do much here though: We can't change older Qt versions anymore, and the warning itself is legit.

                      K Offline
                      K Offline
                      koahnig
                      wrote on last edited by
                      #10

                      @kkoehne

                      Ah, OK you are right. It is limited to release mode. When switching to debug and rerun qmake it is gone.

                      The only solution would be to have different diagnostic configurations per kit.

                      At the moment I have added "-Wno-zero-as-null-pointer-constant" to a copy of the built-in settings. This solves the problem with the warning at the time being.

                      Vote the answer(s) that helped you to solve your issue(s)

                      1 Reply Last reply
                      3

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved