Le 11/01/2015 11:53, Georg Baum a écrit :
Because they are on by default in MSVC and off by default in gcc. You can
get similar ones with gcc by calling it with -Wconversion (but that outputs
many more).

gcc 4.9 has -Wfloat-conversion. I tried it, but it really gives many warnings (see below) and I am uncomfortable with using it.

I wonder though why MSVC only gives a few of them.

JMarc



../../../../master/src/frontends/qt4/CategorizedCombo.cpp: In member function ‘void lyx::frontend::CCItemDelegate::drawCategoryHeader(QPainter*, const QStyleOptionViewItem&, const QString&) const’:
../../../../master/src/frontends/qt4/CategorizedCombo.cpp:248:41: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
  int y = opt.rect.y() + 1.5 * fm.ascent();
                                         ^
../../../../master/src/frontends/qt4/GuiFontMetrics.cpp: In member function ‘virtual int lyx::frontend::GuiFontMetrics::pos2x(const docstring&, int, bool) const’:
../../../../master/src/frontends/qt4/GuiFontMetrics.cpp:165:50: warning: conversion to ‘int’ from ‘qreal {aka double}’ may alter its value [-Wfloat-conversion]
  return tl.lineForTextPosition(pos).cursorToX(pos);
                                                  ^
../../../../master/src/frontends/qt4/GuiFontMetrics.cpp: In member function ‘virtual int lyx::frontend::GuiFontMetrics::x2pos(const docstring&, int&, bool) const’:
../../../../master/src/frontends/qt4/GuiFontMetrics.cpp:175:4: warning: conversion to ‘int’ from ‘qreal {aka double}’ may alter its value [-Wfloat-conversion]
  x = tl.lineForTextPosition(0).cursorToX(pos);
    ^
../../../../master/src/frontends/qt4/GuiPainter.cpp: In member function ‘virtual int lyx::frontend::GuiPainter::text(int, int, const docstring&, const lyx::FontInfo&, bool)’:
../../../../master/src/frontends/qt4/GuiPainter.cpp:383:52: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
    pm = QPixmap(pixelRatio() * w , pixelRatio() * h);
                                                    ^
../../../../master/src/frontends/qt4/GuiPainter.cpp:383:52: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
../../../../master/src/frontends/qt4/GuiView.cpp: In constructor ‘lyx::frontend::{anonymous}::BackgroundWidget::BackgroundWidget()’:
../../../../master/src/frontends/qt4/GuiView.cpp:165:75: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
   int const size = toqstr(lyxrc.font_sizes[FONT_SIZE_LARGE]).toDouble() * multiplier;
                                                                           ^
../../../../master/src/frontends/qt4/GuiView.cpp:166:23: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
   int const x = 190 * multiplier;
                       ^
../../../../master/src/frontends/qt4/GuiView.cpp:167:23: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
   int const y = 225 * multiplier;
                       ^
../../../../master/src/frontends/qt4/GuiView.cpp: In member function ‘virtual void lyx::frontend::{anonymous}::BackgroundWidget::paintEvent(QPaintEvent*)’:
../../../../master/src/frontends/qt4/GuiView.cpp:184:52: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
   int const w = splash_.width() / splashPixelRatio();
                                                    ^
../../../../master/src/frontends/qt4/GuiView.cpp:185:53: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
   int const h = splash_.height() / splashPixelRatio();
                                                     ^
In file included from ../../../../master/src/frontends/qt4/GuiWorkArea.cpp:15:0:
../../../../master/src/frontends/qt4/GuiWorkArea_Private.h: In member function ‘void lyx::frontend::GuiWorkArea::Private::resetScreen()’:
../../../../master/src/frontends/qt4/GuiWorkArea_Private.h:130:80: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
     pixel_ratio_ * p->viewport()->height(), QImage::Format_ARGB32_Premultiplied);
                                                                                ^
../../../../master/src/frontends/qt4/GuiWorkArea_Private.h:130:80: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
../../../../master/src/frontends/qt4/GuiWorkArea_Private.h:137:43: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
     pixel_ratio_ * p->viewport()->height());
                                           ^
../../../../master/src/frontends/qt4/GuiWorkArea_Private.h:137:43: warning: conversion to ‘int’ from ‘double’ may alter its value [-Wfloat-conversion]
../../master/src/Text.cpp: In member function ‘void lyx::Text::readParToken(lyx::Paragraph&, lyx::Lexer&, const string&, lyx::Font&, lyx::Change&, lyx::ErrorList&)’:
../../master/src/Text.cpp:496:19: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.9/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
   auto_ptr<Inset> inset;
                   ^
../../master/src/Text.cpp:504:24: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.9/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
   auto_ptr<Inset> inset(new InsetTabular(buf));
                        ^
../../master/src/mathed/MathExtern.cpp: In function ‘void lyx::{anonymous}::extractSums(lyx::MathData&)’:
../../master/src/mathed/MathExtern.cpp:767:29: warning: ‘auto_ptr’ is deprecated (declared at /usr/include/c++/4.9/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
   auto_ptr<InsetMathExInt> p(new InsetMathExInt(buf, from_ascii("sum")));
                             ^

Reply via email to