Possible bug: qmime.h warning "char type is unused"



  • Hey folks, this warning pops up all the time, and I don't think it's my fault. I wrote an empty program just to make sure the warning still popped up, and it did.
    Here's my empty program, check it for errors (I don't think there are any):
    what.h:
    @#include <QtGui>
    class Whatever: public QWidget
    {
    Q_OBJECT
    public:
    Whatever(QWidget *parent=0);
    ~Whatever();
    private slots:
    private:
    };
    @
    what.cpp:
    @#include "what.h"

    Whatever::Whatever(QWidget *parent):QWidget(parent){};
    Whatever::~Whatever(){};

    int main(int argv, char **args){
    QApplication sup(argv,args);
    return sup.exec();
    }
    @

    Here's the warning:
    @/usr/bin/clang++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.8 -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/local/share/qt4/mkspecs/macx-g++ -I. -I. -I/opt/local/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/opt/local/Library/Frameworks/QtGui.framework/Versions/4/Headers -I. -I/opt/local/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/opt/local/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/opt/local/include -F/opt/local/Library/Frameworks -F/opt/local/lib -o moc_what.o moc_what.cpp
    In file included from moc_what.cpp:10:
    In file included from ./what.h:1:
    In file included from /opt/local/Library/Frameworks/QtGui.framework/Versions/4/Headers/QtGui:54:
    In file included from /opt/local/Library/Frameworks/QtGui.framework/Versions/4/Headers/qplaintextedit.h:52:
    In file included from /opt/local/include/QtGui/qabstracttextdocumentlayout.h:46:
    In file included from /opt/local/include/QtGui/qtextlayout.h:50:
    In file included from /opt/local/include/QtGui/qevent.h:52:
    /opt/local/include/QtGui/qmime.h:119:10: warning: private field 'type' is not
    used [-Wunused-private-field]
    char type;
    ^
    @


  • Moderators

    Thanks for reporting.

    However, the wording "bug" is a bit harsh. It is reported by your compiler as a warning. It is certainly always good to pay attention to such warnings, but sometimes they are hard to avoid. When compiling the Qt lib you will see a lot of warning, which may be ignored assuming that those folks developing Qt libs make sure that the warnings are not potential problems.

    Yes, you are right. This is not a problem on your side. You may want to check the compiler switches respectively the possible macro scanned by the compiler. Typically with such macros you can selectively switch off warnings for a certain section of your code (e.g. where the includes are). However, simply changing the warning level in order to avoid warnings is not a good idea. Warning give you some hints and may point out an area you need to have a closer look.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.