Jakob Gruber <jakob.gru...@gmail.com> writes: > I've replaced all std::shared_pointers with QSharedPointers this morning > and removed the -std=c++11 flag.
I'm now getting a few errors and warnings when trying to build picmi with g++ 4.2.1, 4.6.3 and clang 3.1: some of them are related to -pedantic being used + Qt and kdelibs using long long in a few headers, and some due to QSharedPointer being used with forward-declared classes. I've attached clang's output since it's more informative than gcc's.
[ 13%] Building CXX object src/gui/CMakeFiles/picmi_gui.dir/picmi_gui_automoc.cpp.o In file included from /tmp/picmi/build/src/gui/picmi_gui_automoc.cpp:4: In file included from /tmp/picmi/build/src/gui/moc_mainwindow.cpp:10: In file included from /tmp/picmi/build/src/gui/../../../src/gui/mainwindow.h:24: In file included from /home/rakuco/kde4/qt4/include/QtCore/QTimer:1: In file included from /home/rakuco/kde4/qt4/include/QtCore/qtimer.h:47: In file included from /home/rakuco/kde4/qt4/include/QtCore/qbasictimer.h:45: /home/rakuco/kde4/qt4/include/QtCore/qglobal.h:926:9: warning: 'long long' is an extension when C99 mode is not enabled [-pedantic,-Wlong-long] typedef long long qint64; /* 64 bit signed */ ^ /home/rakuco/kde4/qt4/include/QtCore/qglobal.h:927:18: warning: 'long long' is an extension when C99 mode is not enabled [-pedantic,-Wlong-long] typedef unsigned long long quint64; /* 64 bit unsigned */ ^ In file included from /tmp/picmi/build/src/gui/picmi_gui_automoc.cpp:4: In file included from /tmp/picmi/build/src/gui/moc_mainwindow.cpp:10: In file included from /tmp/picmi/build/src/gui/../../../src/gui/mainwindow.h:25: In file included from /tmp/opt-kde/lib/cmake/KDEGames/../../../include/highscore/kscoredialog.h:34: In file included from /home/rakuco/kde4/stow/kdelibs/include/kdialog.h:32: In file included from /home/rakuco/kde4/stow/kdelibs/include/kconfiggroup.h:718: /home/rakuco/kde4/stow/kdelibs/include/conversion_check.h:97:15: warning: 'long long' is an extension when C99 mode is not enabled [-pedantic,-Wlong-long] QVConversions(long long, supported, supported); ^ /home/rakuco/kde4/stow/kdelibs/include/conversion_check.h:87:34: note: expanded from macro 'QVConversions' template <> struct QVconvertible<type> {\ ^ /home/rakuco/kde4/stow/kdelibs/include/conversion_check.h:98:24: warning: 'long long' is an extension when C99 mode is not enabled [-pedantic,-Wlong-long] QVConversions(unsigned long long, supported, supported); ^ /home/rakuco/kde4/stow/kdelibs/include/conversion_check.h:87:34: note: expanded from macro 'QVConversions' template <> struct QVconvertible<type> {\ ^ In file included from /tmp/picmi/build/src/gui/picmi_gui_automoc.cpp:4: In file included from /tmp/picmi/build/src/gui/moc_mainwindow.cpp:10: In file included from /tmp/picmi/build/src/gui/../../../src/gui/mainwindow.h:25: In file included from /tmp/opt-kde/lib/cmake/KDEGames/../../../include/highscore/kscoredialog.h:34: In file included from /home/rakuco/kde4/stow/kdelibs/include/kdialog.h:32: In file included from /home/rakuco/kde4/stow/kdelibs/include/kconfiggroup.h:718: In file included from /home/rakuco/kde4/stow/kdelibs/include/conversion_check.h:27: In file included from /home/rakuco/kde4/qt4/include/QtGui/QFont:1: In file included from /home/rakuco/kde4/qt4/include/QtGui/qfont.h:47: In file included from /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer.h:50: /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:342:21: warning: deleting pointer to incomplete type 'IOHandler' may cause undefined behaviour [-Wdelete-incomplete] delete value; ^ ~~~~~ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:336:11: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<IOHandler>::deref' requested here { deref(d, this->value); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:401:38: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<IOHandler>::deref' requested here inline ~ExternalRefCount() { deref(); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:466:7: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<IOHandler>::~ExternalRefCount' requested here class QSharedPointer: public QtSharedPointer::ExternalRefCount<T> ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:336:11: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Picmi>::deref' requested here { deref(d, this->value); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:401:38: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Picmi>::deref' requested here inline ~ExternalRefCount() { deref(); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:466:7: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Picmi>::~ExternalRefCount' requested here class QSharedPointer: public QtSharedPointer::ExternalRefCount<T> ^ /tmp/picmi/src/logic/picmi.h:30:7: note: forward declaration of 'IOHandler' class IOHandler; ^ In file included from /tmp/picmi/build/src/gui/picmi_gui_automoc.cpp:4: In file included from /tmp/picmi/build/src/gui/moc_mainwindow.cpp:10: In file included from /tmp/picmi/build/src/gui/../../../src/gui/mainwindow.h:25: In file included from /tmp/opt-kde/lib/cmake/KDEGames/../../../include/highscore/kscoredialog.h:34: In file included from /home/rakuco/kde4/stow/kdelibs/include/kdialog.h:32: In file included from /home/rakuco/kde4/stow/kdelibs/include/kconfiggroup.h:718: In file included from /home/rakuco/kde4/stow/kdelibs/include/conversion_check.h:27: In file included from /home/rakuco/kde4/qt4/include/QtGui/QFont:1: In file included from /home/rakuco/kde4/qt4/include/QtGui/qfont.h:47: In file included from /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer.h:50: /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:342:21: warning: deleting pointer to incomplete type 'LineInfo' may cause undefined behaviour [-Wdelete-incomplete] delete value; ^ ~~~~~ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:336:11: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<LineInfo>::deref' requested here { deref(d, this->value); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:401:38: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<LineInfo>::deref' requested here inline ~ExternalRefCount() { deref(); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:466:7: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<LineInfo>::~ExternalRefCount' requested here class QSharedPointer: public QtSharedPointer::ExternalRefCount<T> ^ /home/rakuco/kde4/qt4/include/QtCore/qvector.h:124:62: note: in instantiation of member function 'QVector<QSharedPointer<LineInfo> >::free' requested here inline ~QVector() { if (!d) return; if (!d->ref.deref()) free(p); } ^ /tmp/picmi/src/logic/streaks.h:29:7: note: in instantiation of member function 'QVector<QSharedPointer<LineInfo> >::~QVector' requested here class Streaks ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:336:11: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all) { deref(d, this->value); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:401:38: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Streaks>::deref' requested here inline ~ExternalRefCount() { deref(); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:466:7: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Streaks>::~ExternalRefCount' requested here class QSharedPointer: public QtSharedPointer::ExternalRefCount<T> ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:336:11: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Picmi>::deref' requested here { deref(d, this->value); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:401:38: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Picmi>::deref' requested here inline ~ExternalRefCount() { deref(); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:466:7: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Picmi>::~ExternalRefCount' requested here class QSharedPointer: public QtSharedPointer::ExternalRefCount<T> ^ /tmp/picmi/src/logic/streaks.h:27:8: note: forward declaration of 'LineInfo' struct LineInfo; ^ In file included from /tmp/picmi/build/src/gui/picmi_gui_automoc.cpp:4: In file included from /tmp/picmi/build/src/gui/moc_mainwindow.cpp:10: In file included from /tmp/picmi/build/src/gui/../../../src/gui/mainwindow.h:25: In file included from /tmp/opt-kde/lib/cmake/KDEGames/../../../include/highscore/kscoredialog.h:34: In file included from /home/rakuco/kde4/stow/kdelibs/include/kdialog.h:32: In file included from /home/rakuco/kde4/stow/kdelibs/include/kconfiggroup.h:718: In file included from /home/rakuco/kde4/stow/kdelibs/include/conversion_check.h:27: In file included from /home/rakuco/kde4/qt4/include/QtGui/QFont:1: In file included from /home/rakuco/kde4/qt4/include/QtGui/qfont.h:47: In file included from /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer.h:50: /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:342:21: warning: deleting pointer to incomplete type 'Level' may cause undefined behaviour [-Wdelete-incomplete] delete value; ^ ~~~~~ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:336:11: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Level>::deref' requested here { deref(d, this->value); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:401:38: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Level>::deref' requested here inline ~ExternalRefCount() { deref(); } ^ /home/rakuco/kde4/qt4/include/QtCore/qsharedpointer_impl.h:466:7: note: in instantiation of member function 'QtSharedPointer::ExternalRefCount<Level>::~ExternalRefCount' requested here class QSharedPointer: public QtSharedPointer::ExternalRefCount<T> ^ /tmp/picmi/build/src/gui/../../../src/gui/mainwindow.h:40:7: note: forward declaration of 'Level' class Level; ^ 7 warnings generated.