Compiling with -Wconversion gives lots and lots of warning messages in the Qt headers

Bug #341411 reported by Sjors Gielen
4
Affects Status Importance Assigned to Milestone
qt4-x11 (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

I noticed (and I think this is the case with many, many more versions of Qt) that when compiling with -Wconversion, the headers give lots and lots of warnings. For example, when compiling a program containing only "#include <QChar>" using <g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4 -c test.cpp> no warnings appear, but when adding -Wconversion, this is the output:

In file included from /usr/include/qt4/QtCore/qchar.h:45,
                 from /usr/include/qt4/QtCore/QChar:1,
                 from test.cpp:1:
/usr/include/qt4/QtCore/qglobal.h: In function ‘qint64 qRound64(qreal)’:
/usr/include/qt4/QtCore/qglobal.h:1027: warning: conversion to ‘qreal’ from ‘qint64’ may alter its value
In file included from /usr/include/qt4/QtCore/QChar:1,
                 from test.cpp:1:
/usr/include/qt4/QtCore/qchar.h: In static member function ‘static ushort QChar::highSurrogate(uint)’:
/usr/include/qt4/QtCore/qchar.h:295: warning: conversion to ‘ushort’ from ‘unsigned int’ mayalter its value
/usr/include/qt4/QtCore/qchar.h: In static member function ‘static ushort QChar::lowSurrogate(uint)’:
/usr/include/qt4/QtCore/qchar.h:298: warning: conversion to ‘ushort’ from ‘unsigned int’ mayalter its value
/usr/include/qt4/QtCore/qchar.h: In constructor ‘QChar::QChar(uchar, uchar)’:
/usr/include/qt4/QtCore/qchar.h:369: warning: conversion to ‘ushort’ from ‘int’ may alter its value
/usr/include/qt4/QtCore/qchar.h: In member function ‘void QChar::setCell(uchar)’:
/usr/include/qt4/QtCore/qchar.h:377: warning: conversion to ‘ushort’ from ‘int’ may alter its value
/usr/include/qt4/QtCore/qchar.h: In member function ‘void QChar::setRow(uchar)’:
/usr/include/qt4/QtCore/qchar.h:379: warning: conversion to ‘ushort’ from ‘int’ may alter its value

These are unmodified headers. Should I just not compile with -Wconversion, i.e. is this a wontfix bug? I understand that *really* fixing it makes the headers a lot more ugly and complicated, yet it's an ugly bug.

Revision history for this message
Sjors Gielen (sgielen) wrote :

Seems like for example SuSE doesn't have this bug because it does not apply things like -Wconversion to files in /usr/include, or something like that. Would that be possible for Ubuntu? To which package do I file a bug?

Revision history for this message
Jonathan Thomas (echidnaman) wrote :

Yeah, this is something that we're not going to fix.
I'd suggest taking it up with Qt Software.

Changed in qt4-x11 (Ubuntu):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.