Bugzilla – Bug 119209
Qt headers throw dozens of compiler warnings
Last modified: 2005-10-05 12:39:11 UTC
For every C++ file that includes some Qt headers, I get dozens of compiler warnings: /usr/lib/qt3/include/qtooltip.h:86: warning: 'class QToolTip' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:69: warning: 'struct QUBuffer' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:77: warning: 'struct QUType' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:104: warning: 'struct QUType_Null' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:287: warning: 'struct QUType_enum' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:307: warning: 'struct QUType_ptr' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:326: warning: 'struct QUType_iface' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:345: warning: 'struct QUType_idisp' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:364: warning: 'struct QUType_bool' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:383: warning: 'struct QUType_int' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:403: warning: 'struct QUType_double' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:423: warning: 'struct QUType_charstar' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:444: warning: 'struct QUType_QString' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucomextra_p.h:65: warning: 'struct QUType_QVariant' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucomextra_p.h:87: warning: 'struct QUType_varptr' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:69: warning: 'struct QUBuffer' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:77: warning: 'struct QUType' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:104: warning: 'struct QUType_Null' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:287: warning: 'struct QUType_enum' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:307: warning: 'struct QUType_ptr' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:326: warning: 'struct QUType_iface' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:345: warning: 'struct QUType_idisp' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:364: warning: 'struct QUType_bool' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:383: warning: 'struct QUType_int' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:403: warning: 'struct QUType_double' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:423: warning: 'struct QUType_charstar' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucom_p.h:444: warning: 'struct QUType_QString' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucomextra_p.h:65: warning: 'struct QUType_QVariant' has virtual functions but non-virtual destructor /usr/lib/qt3/include/private/qucomextra_p.h:87: warning: 'struct QUType_varptr' has virtual functions but non-virtual destructor Of course the compiler is perfectly right. But that doesn't help me very much: If there are any real compiler warnings about my own code, they get drowned out in that mass of unrelated warnings.
then disable that warning. See for example how KDE does it. (-Wno-non-virtual-dtor) fixing those warnings is binary incompatible.
Are you kidding? Disabling warnings cannot be the way to go. And remember, this will not only suppress the warnings from those Qt headers, it will also suppress the same problem occurring in the applications. We have a zero warnings policy here. And we are really serious about that.
I fully agree with Stefan here (and went through this for all my packages :-() but "fixing those warnings is binary incompatible" is indeed a problem. Aj, your call ...
Maybe there is a way to tell gcc to disable this warning only for the affected headers - some "#pragma dontknowwhat". But disabling them general is really a bad approach IMHO.
Compiler team, please provide some input here.
To hack around this problem place #pragma GCC system_header at the top of the Qt include files triggering this warning. ***HACK ALERT!!!***
Thanks for that hint! Will attach patch that suppresses those warnings for the affected include files.
Created attachment 51159 [details] Patch for affected Qt headers
that patch doesn't solve the issue. anyway, closing.